From 2685dd79d5052b24617363a6db5bfa0baeddd53e Mon Sep 17 00:00:00 2001 From: Mike Phares Date: Mon, 16 May 2022 15:34:24 -0700 Subject: [PATCH] MET08ANLYSDIFAAST230 - v4.43.0 - Use EDA multiple --- .gitignore | 1 - .groovy | 172 + Adaptation/.editorconfig | 495 ++- Adaptation/.vscode/format-report.json | 1 + Adaptation/.vscode/launch.json | 10 + Adaptation/.vscode/settings.json | 45 + Adaptation/.vscode/tasks.json | 42 + .../Core/AutoGenerated/BackboneComponent.cs | 7 +- .../Core/AutoGenerated/BackboneStatusCache.cs | 7 +- .../AutoGenerated/ILoggingSetupManager.cs | 7 +- .../Eaf/Core/AutoGenerated/StatusItem.cs | 7 +- Adaptation/Eaf/Core/Backbone.cs | 85 +- Adaptation/Eaf/Core/Smtp/EmailMessage.cs | 33 +- Adaptation/Eaf/Core/Smtp/ISmtp.cs | 13 +- Adaptation/Eaf/Core/Smtp/MailPriority.cs | 17 +- .../ChangeDataCollectionHandler.cs | 7 +- .../AutoGenerated/DataCollectionRequest.cs | 7 +- .../Control/AutoGenerated/EquipmentEvent.cs | 7 +- .../AutoGenerated/EquipmentException.cs | 7 +- .../AutoGenerated/EquipmentSelfDescription.cs | 7 +- .../GetParameterValuesHandler.cs | 7 +- .../AutoGenerated/IConnectionControl.cs | 7 +- .../AutoGenerated/IDataTracingHandler.cs | 7 +- .../AutoGenerated/IEquipmentCommandService.cs | 7 +- .../AutoGenerated/IEquipmentControl.cs | 23 +- .../IEquipmentSelfDescriptionBuilder.cs | 7 +- .../Control/AutoGenerated/IPackage.cs | 7 +- .../AutoGenerated/ISelfDescriptionLookup.cs | 7 +- .../IVirtualParameterValuesHandler.cs | 7 +- .../SetParameterValuesHandler.cs | 7 +- .../Control/AutoGenerated/TraceRequest.cs | 7 +- .../Control/IEquipmentDataCollection.cs | 63 +- .../EquipmentCore/Control/IPackageSource.cs | 7 +- .../Reporting/ParameterValue.cs | 29 +- .../ElementDescription/EquipmentParameter.cs | 37 +- .../SelfDescription/ParameterTypes/Field.cs | 26 +- .../ParameterTypes/ParameterTypeDefinition.cs | 22 +- .../ParameterTypes/StructuredType.cs | 18 +- .../CellAutomation/IConfigurationObject.cs | 7 +- .../ModelObjectParameterDefinition.cs | 44 +- .../ModelObjectParameterType.cs | 29 +- .../SecsConnectionConfiguration.cs | 77 +- Adaptation/FileHandlers/APC/FileRead.cs | 123 + Adaptation/FileHandlers/Archive/FileRead.cs | 139 + .../CellInstanceConnectionName.cs | 31 + Adaptation/FileHandlers/Dummy/FileRead.cs | 292 ++ Adaptation/FileHandlers/EDA/FileRead.cs | 204 ++ Adaptation/FileHandlers/FileRead.cs | 324 -- Adaptation/FileHandlers/FileReadShared.cs | 1016 ------ Adaptation/FileHandlers/IQSSi/FileRead.cs | 145 + .../FileHandlers/OpenInsight/FileRead.cs | 123 + .../OpenInsightMetrologyViewer/FileRead.cs | 123 + .../FileRead.cs | 123 + Adaptation/FileHandlers/Processed/FileRead.cs | 123 + Adaptation/FileHandlers/SPaCe/FileRead.cs | 123 + Adaptation/Helpers/ConfigData.Level.cs | 20 - Adaptation/Helpers/ConfigData.cs | 711 ---- Adaptation/Helpers/ProcessData.cs | 147 - Adaptation/Helpers/Si/EpiControlPlan.cs | 1237 ------- Adaptation/Helpers/Si/LDS2559Reply.cs | 218 -- Adaptation/Helpers/Si/LDS2559Send.cs | 317 -- .../Si/Metrology/MET08ANLYSDIFAAST230.cs | 35 - .../Helpers/Si/Metrology/MET08DDUPSFS6420.cs | 104 - .../Helpers/Si/Metrology/MET08DDUPSP1TBI.cs | 104 - .../Helpers/Si/Metrology/MET08RESIHGCV.cs | 104 - .../Helpers/Si/Metrology/MET08RESIMAPCDE.cs | 104 - .../Helpers/Si/Metrology/MET08THFTIRQS408M.cs | 104 - .../Si/Metrology/MET08THFTIRSTRATUS.cs | 104 - Adaptation/Helpers/Si/PreRunInfo.cs | 54 - Adaptation/Helpers/Si/SQLDatabase.cs | 208 -- Adaptation/Helpers/Si/Transport.cs | 945 ----- .../Common/Configuration/ConnectionSetting.cs | 26 +- .../EquipmentConnector/File/Component/File.cs | 28 +- .../File/Component/FilePathGenerator.cs | 57 +- .../FileConnectorConfiguration.cs | 253 +- ...onnectorParameterTypeDefinitionProvider.cs | 23 +- Adaptation/MET08ANLYSDIFAAST230.Tests.csproj | 92 + .../GCL/Annotations/NotNullAttribute.cs | 11 +- .../GCL/SecsDriver/HsmsConnectionMode.cs | 11 +- .../GCL/SecsDriver/HsmsSessionMode.cs | 11 +- .../GCL/SecsDriver/SecsTransportType.cs | 11 +- .../GCL/SecsDriver/SerialBaudRate.cs | 27 +- Adaptation/Shared/CellInstance.cs | 1 - .../Shared/Deposition/DEP08EGANAIXG5H.cs | 20 - Adaptation/Shared/Deposition/Test.cs | 16 - Adaptation/Shared/Description.cs | 182 - Adaptation/Shared/Duplicator/Description.cs | 142 + Adaptation/Shared/EquipmentType.cs | 53 - Adaptation/Shared/ExtendedParameter.cs | 178 - Adaptation/Shared/ExtractResult.cs | 613 ---- Adaptation/Shared/FileRead.cs | 815 +++++ Adaptation/Shared/IProcessData.cs | 16 - Adaptation/Shared/IProcessDataDescription.cs | 26 - Adaptation/Shared/IQSRecord.cs | 239 -- Adaptation/Shared/IScopeInfo.cs | 21 - Adaptation/Shared/IsEnvironment.cs | 171 - Adaptation/Shared/Logistics.cs | 366 +- Adaptation/Shared/Logistics2.cs | 140 +- Adaptation/Shared/Methods/IDescription.cs | 22 + Adaptation/Shared/Methods/IFileRead.cs | 23 + Adaptation/Shared/Methods/ILogistics.cs | 5 + Adaptation/Shared/Methods/ILogistics2.cs | 5 + Adaptation/Shared/Methods/IProcessData.cs | 14 + Adaptation/Shared/Methods/ISMTP.cs | 8 + Adaptation/Shared/Metrology/Column.cs | 803 ----- Adaptation/Shared/Metrology/ConfigDataBase.cs | 398 --- Adaptation/Shared/Metrology/EventName.cs | 13 - Adaptation/Shared/Metrology/ILogic.cs | 45 - Adaptation/Shared/Metrology/MET08AFMD3100.cs | 14 - .../Shared/Metrology/MET08ANLYSDIFAAST230.cs | 14 - Adaptation/Shared/Metrology/MET08BVHGPROBE.cs | 16 - .../Shared/Metrology/MET08CVHGPROBE802B150.cs | 16 - .../Shared/Metrology/MET08DDINCAN8620.cs | 18 - .../Shared/Metrology/MET08DDUPSFS6420.cs | 14 - .../Shared/Metrology/MET08DDUPSP1TBI.cs | 14 - .../Shared/Metrology/MET08EBEAMINTEGRITY26.cs | 14 - .../Shared/Metrology/MET08HALLHL5580.cs | 16 - .../Shared/Metrology/MET08MESMICROSCOPE.cs | 14 - .../Shared/Metrology/MET08NDFRESIMAP151C.cs | 15 - Adaptation/Shared/Metrology/MET08PLMAPRPM.cs | 20 - .../Shared/Metrology/MET08PRFUSB4000.cs | 14 - Adaptation/Shared/Metrology/MET08RESIHGCV.cs | 14 - .../Shared/Metrology/MET08RESIMAPCDE.cs | 14 - .../Shared/Metrology/MET08THFTIRQS408M.cs | 14 - .../Shared/Metrology/MET08THFTIRSTRATUS.cs | 14 - .../Shared/Metrology/MET08UVH44GS100M.cs | 14 - Adaptation/Shared/Metrology/MET08VPDSUBCON.cs | 14 - .../Shared/Metrology/MET08WGEOMX203641Q.cs | 15 - .../Shared/Metrology/MET08XRDXPERTPROMRDXL.cs | 23 - Adaptation/Shared/Metrology/OIGaNViewer.cs | 36 - .../Metrology/ProcessData.Duplicator.cs | 110 - .../Metrology/ProcessDataStandardFormat.cs | 527 --- Adaptation/Shared/Metrology/ScopeInfo.cs | 691 ++-- Adaptation/Shared/Metrology/Test.cs | 57 - Adaptation/Shared/Metrology/WS.Attachment.cs | 21 + Adaptation/Shared/Metrology/WS.Results.cs | 27 + Adaptation/Shared/Metrology/WS.cs | 124 + Adaptation/Shared/ParameterType.cs | 10 + .../Shared/ProcessDataStandardFormat.cs | 411 +++ Adaptation/Shared/Properties/IDescription.cs | 10 + Adaptation/Shared/Properties/IFileRead.cs | 17 + Adaptation/Shared/Properties/ILogistics.cs | 22 + Adaptation/Shared/Properties/ILogistics2.cs | 14 + Adaptation/Shared/Properties/IProcessData.cs | 10 + Adaptation/Shared/Properties/IScopeInfo.cs | 17 + Adaptation/Shared/Test.cs | 58 + .../Staging/v2.43.0/MET08ANLYSDIFAAST230.cs | 154 + .../Staging/v2.43.0/MET08ANLYSDIFAAST230.cs | 74 + Adaptation/_Tests/Helpers/Metrology.cs | 192 ++ Adaptation/_Tests/Shared/AdaptationTesting.cs | 1047 ++++++ .../_Tests/Shared/EAFLoggingUnitTesting.cs | 28 + Adaptation/_Tests/Shared/IsEnvironment.cs | 168 + Adaptation/_Tests/Shared/Log/ConsoleLogger.cs | 35 + .../_Tests/Shared/Log/ConsoleProvider.cs | 26 + Adaptation/_Tests/Shared/Log/DebugLogger.cs | 35 + Adaptation/_Tests/Shared/Log/DebugProvider.cs | 26 + .../_Tests/Shared/Log/FeedbackLogger.cs | 48 + .../_Tests/Shared/Log/FeedbackProvider.cs | 28 + Adaptation/_Tests/Shared/Log/IFeedback.cs | 9 + Adaptation/_Tests/Shared/Log/Log.cs | 136 + .../_Tests/Shared/LoggingUnitTesting.cs | 112 + .../EAF XML API/CellInstance.cs | 3056 +++++++++++++++++ .../EAF XML API/ConfigurationData.cs | 23 + .../EAF XML API/EquipmentDictionary.cs | 1300 +++++++ .../EAF XML API/EquipmentType.cs | 962 ++++++ Adaptation/_Tests/Shared/UnitTesting.cs | 90 + Adaptation/appsettings.Development.json | 139 + Adaptation/appsettings.json | 139 + Adaptation/package.json | 26 +- FileHandlers/FileRead.cs | 367 +- FileHandlers/FileReadShared.cs | 249 -- Jenkinsfile | 172 + MET08ANLYSDIFAAST230.csproj | 123 +- Properties/AssemblyInfo.cs | 4 +- Shared/Description.cs | 182 - Shared/FilePathGenerator.cs | 35 +- Shared/FilePathGeneratorInfo.cs | 112 +- Shared/Mapper.cs | 74 + 178 files changed, 13498 insertions(+), 11875 deletions(-) create mode 100644 .groovy create mode 100644 Adaptation/.vscode/format-report.json create mode 100644 Adaptation/.vscode/launch.json create mode 100644 Adaptation/.vscode/settings.json create mode 100644 Adaptation/.vscode/tasks.json create mode 100644 Adaptation/FileHandlers/APC/FileRead.cs create mode 100644 Adaptation/FileHandlers/Archive/FileRead.cs create mode 100644 Adaptation/FileHandlers/CellInstanceConnectionName.cs create mode 100644 Adaptation/FileHandlers/Dummy/FileRead.cs create mode 100644 Adaptation/FileHandlers/EDA/FileRead.cs delete mode 100644 Adaptation/FileHandlers/FileRead.cs delete mode 100644 Adaptation/FileHandlers/FileReadShared.cs create mode 100644 Adaptation/FileHandlers/IQSSi/FileRead.cs create mode 100644 Adaptation/FileHandlers/OpenInsight/FileRead.cs create mode 100644 Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs create mode 100644 Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs create mode 100644 Adaptation/FileHandlers/Processed/FileRead.cs create mode 100644 Adaptation/FileHandlers/SPaCe/FileRead.cs delete mode 100644 Adaptation/Helpers/ConfigData.Level.cs delete mode 100644 Adaptation/Helpers/ConfigData.cs delete mode 100644 Adaptation/Helpers/ProcessData.cs delete mode 100644 Adaptation/Helpers/Si/EpiControlPlan.cs delete mode 100644 Adaptation/Helpers/Si/LDS2559Reply.cs delete mode 100644 Adaptation/Helpers/Si/LDS2559Send.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs delete mode 100644 Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs delete mode 100644 Adaptation/Helpers/Si/PreRunInfo.cs delete mode 100644 Adaptation/Helpers/Si/SQLDatabase.cs delete mode 100644 Adaptation/Helpers/Si/Transport.cs create mode 100644 Adaptation/MET08ANLYSDIFAAST230.Tests.csproj delete mode 100644 Adaptation/Shared/CellInstance.cs delete mode 100644 Adaptation/Shared/Deposition/DEP08EGANAIXG5H.cs delete mode 100644 Adaptation/Shared/Deposition/Test.cs delete mode 100644 Adaptation/Shared/Description.cs create mode 100644 Adaptation/Shared/Duplicator/Description.cs delete mode 100644 Adaptation/Shared/EquipmentType.cs delete mode 100644 Adaptation/Shared/ExtendedParameter.cs delete mode 100644 Adaptation/Shared/ExtractResult.cs create mode 100644 Adaptation/Shared/FileRead.cs delete mode 100644 Adaptation/Shared/IProcessData.cs delete mode 100644 Adaptation/Shared/IProcessDataDescription.cs delete mode 100644 Adaptation/Shared/IQSRecord.cs delete mode 100644 Adaptation/Shared/IScopeInfo.cs delete mode 100644 Adaptation/Shared/IsEnvironment.cs create mode 100644 Adaptation/Shared/Methods/IDescription.cs create mode 100644 Adaptation/Shared/Methods/IFileRead.cs create mode 100644 Adaptation/Shared/Methods/ILogistics.cs create mode 100644 Adaptation/Shared/Methods/ILogistics2.cs create mode 100644 Adaptation/Shared/Methods/IProcessData.cs create mode 100644 Adaptation/Shared/Methods/ISMTP.cs delete mode 100644 Adaptation/Shared/Metrology/Column.cs delete mode 100644 Adaptation/Shared/Metrology/ConfigDataBase.cs delete mode 100644 Adaptation/Shared/Metrology/EventName.cs delete mode 100644 Adaptation/Shared/Metrology/ILogic.cs delete mode 100644 Adaptation/Shared/Metrology/MET08AFMD3100.cs delete mode 100644 Adaptation/Shared/Metrology/MET08ANLYSDIFAAST230.cs delete mode 100644 Adaptation/Shared/Metrology/MET08BVHGPROBE.cs delete mode 100644 Adaptation/Shared/Metrology/MET08CVHGPROBE802B150.cs delete mode 100644 Adaptation/Shared/Metrology/MET08DDINCAN8620.cs delete mode 100644 Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs delete mode 100644 Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs delete mode 100644 Adaptation/Shared/Metrology/MET08EBEAMINTEGRITY26.cs delete mode 100644 Adaptation/Shared/Metrology/MET08HALLHL5580.cs delete mode 100644 Adaptation/Shared/Metrology/MET08MESMICROSCOPE.cs delete mode 100644 Adaptation/Shared/Metrology/MET08NDFRESIMAP151C.cs delete mode 100644 Adaptation/Shared/Metrology/MET08PLMAPRPM.cs delete mode 100644 Adaptation/Shared/Metrology/MET08PRFUSB4000.cs delete mode 100644 Adaptation/Shared/Metrology/MET08RESIHGCV.cs delete mode 100644 Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs delete mode 100644 Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs delete mode 100644 Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs delete mode 100644 Adaptation/Shared/Metrology/MET08UVH44GS100M.cs delete mode 100644 Adaptation/Shared/Metrology/MET08VPDSUBCON.cs delete mode 100644 Adaptation/Shared/Metrology/MET08WGEOMX203641Q.cs delete mode 100644 Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs delete mode 100644 Adaptation/Shared/Metrology/OIGaNViewer.cs delete mode 100644 Adaptation/Shared/Metrology/ProcessData.Duplicator.cs delete mode 100644 Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs delete mode 100644 Adaptation/Shared/Metrology/Test.cs create mode 100644 Adaptation/Shared/Metrology/WS.Attachment.cs create mode 100644 Adaptation/Shared/Metrology/WS.Results.cs create mode 100644 Adaptation/Shared/Metrology/WS.cs create mode 100644 Adaptation/Shared/ParameterType.cs create mode 100644 Adaptation/Shared/ProcessDataStandardFormat.cs create mode 100644 Adaptation/Shared/Properties/IDescription.cs create mode 100644 Adaptation/Shared/Properties/IFileRead.cs create mode 100644 Adaptation/Shared/Properties/ILogistics.cs create mode 100644 Adaptation/Shared/Properties/ILogistics2.cs create mode 100644 Adaptation/Shared/Properties/IProcessData.cs create mode 100644 Adaptation/Shared/Properties/IScopeInfo.cs create mode 100644 Adaptation/Shared/Test.cs create mode 100644 Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs create mode 100644 Adaptation/_Tests/Extract/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs create mode 100644 Adaptation/_Tests/Helpers/Metrology.cs create mode 100644 Adaptation/_Tests/Shared/AdaptationTesting.cs create mode 100644 Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs create mode 100644 Adaptation/_Tests/Shared/IsEnvironment.cs create mode 100644 Adaptation/_Tests/Shared/Log/ConsoleLogger.cs create mode 100644 Adaptation/_Tests/Shared/Log/ConsoleProvider.cs create mode 100644 Adaptation/_Tests/Shared/Log/DebugLogger.cs create mode 100644 Adaptation/_Tests/Shared/Log/DebugProvider.cs create mode 100644 Adaptation/_Tests/Shared/Log/FeedbackLogger.cs create mode 100644 Adaptation/_Tests/Shared/Log/FeedbackProvider.cs create mode 100644 Adaptation/_Tests/Shared/Log/IFeedback.cs create mode 100644 Adaptation/_Tests/Shared/Log/Log.cs create mode 100644 Adaptation/_Tests/Shared/LoggingUnitTesting.cs create mode 100644 Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/CellInstance.cs create mode 100644 Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/ConfigurationData.cs create mode 100644 Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentDictionary.cs create mode 100644 Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentType.cs create mode 100644 Adaptation/_Tests/Shared/UnitTesting.cs create mode 100644 Adaptation/appsettings.Development.json create mode 100644 Adaptation/appsettings.json delete mode 100644 FileHandlers/FileReadShared.cs create mode 100644 Jenkinsfile delete mode 100644 Shared/Description.cs create mode 100644 Shared/Mapper.cs diff --git a/.gitignore b/.gitignore index 7c7ee90..6ba6148 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ x86/ bld/ [Bb]in/ [Oo]bj/ -[Ll]og/ # Visual Studio 2015/2017 cache/options directory .vs/ diff --git a/.groovy b/.groovy new file mode 100644 index 0000000..8aaf66f --- /dev/null +++ b/.groovy @@ -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 = 'MET08ANLYSDIFAAST230' +@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() + } + } +} diff --git a/Adaptation/.editorconfig b/Adaptation/.editorconfig index a3ebdb2..ace6d65 100644 --- a/Adaptation/.editorconfig +++ b/Adaptation/.editorconfig @@ -1,137 +1,10 @@ -# Remove the line below if you want to inherit .editorconfig settings from higher directories -root = true - -# C# files [*.cs] - -#### Core EditorConfig Options #### - -# Indentation and spacing -indent_size = 4 -indent_style = space -tab_width = 4 - -# New line preferences -end_of_line = crlf -insert_final_newline = false - -#### .NET Coding Conventions #### - -# Organize usings -dotnet_separate_import_directive_groups = false -dotnet_sort_system_directives_first = false -file_header_template = unset - -# this. and Me. preferences -dotnet_style_qualification_for_event = false:error -dotnet_style_qualification_for_field = false -dotnet_style_qualification_for_method = false:error -dotnet_style_qualification_for_property = false:error - -# Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true -dotnet_style_predefined_type_for_member_access = true - -# Parentheses preferences -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity -dotnet_style_parentheses_in_other_operators = never_if_unnecessary -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity - -# Modifier preferences -dotnet_style_require_accessibility_modifiers = for_non_interface_members - -# Expression-level preferences -dotnet_style_coalesce_expression = true -dotnet_style_collection_initializer = true:warning -dotnet_style_explicit_tuple_names = true:warning -dotnet_style_namespace_match_folder = true -dotnet_style_null_propagation = true:warning -dotnet_style_object_initializer = true:warning -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_prefer_auto_properties = true:warning -dotnet_style_prefer_compound_assignment = true:warning -dotnet_style_prefer_conditional_expression_over_assignment = false -dotnet_style_prefer_conditional_expression_over_return = false -dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning -dotnet_style_prefer_inferred_tuple_names = true:warning -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning -dotnet_style_prefer_simplified_boolean_expressions = true:warning -dotnet_style_prefer_simplified_interpolation = true - -# Field preferences -dotnet_style_readonly_field = true:warning - -# Parameter preferences -dotnet_code_quality_unused_parameters = all - -# Suppression preferences -dotnet_remove_unnecessary_suppression_exclusions = 0 - -# New line preferences -dotnet_style_allow_multiple_blank_lines_experimental = false:warning -dotnet_style_allow_statement_immediately_after_block_experimental = true - -#### C# Coding Conventions #### - -# var preferences -csharp_style_var_elsewhere = false:warning -csharp_style_var_for_built_in_types = false:warning -csharp_style_var_when_type_is_apparent = false:warning - -# Expression-bodied members -csharp_style_expression_bodied_accessors = when_on_single_line:warning -csharp_style_expression_bodied_constructors = when_on_single_line:warning -csharp_style_expression_bodied_indexers = when_on_single_line:warning -csharp_style_expression_bodied_lambdas = when_on_single_line:warning -csharp_style_expression_bodied_local_functions = when_on_single_line:warning -csharp_style_expression_bodied_methods = when_on_single_line:warning -csharp_style_expression_bodied_operators = when_on_single_line:warning -csharp_style_expression_bodied_properties = when_on_single_line:warning - -# Pattern matching preferences -csharp_style_pattern_matching_over_as_with_null_check = true:warning -csharp_style_pattern_matching_over_is_with_cast_check = true:warning -csharp_style_prefer_not_pattern = true:warning -csharp_style_prefer_pattern_matching = true:warning -csharp_style_prefer_switch_expression = true:warning - -# Null-checking preferences -csharp_style_conditional_delegate_call = true - -# Modifier preferences -csharp_prefer_static_local_function = true:warning -csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async - -# Code-block preferences -csharp_prefer_braces = false -csharp_prefer_simple_using_statement = true:warning -csharp_style_namespace_declarations = file_scoped:warning - -# Expression-level preferences -csharp_prefer_simple_default_expression = true:warning -csharp_style_deconstructed_variable_declaration = false -csharp_style_implicit_object_creation_when_type_is_apparent = true:warning -csharp_style_inlined_variable_declaration = false -csharp_style_pattern_local_over_anonymous_function = true:warning -csharp_style_prefer_index_operator = false:warning -csharp_style_prefer_null_check_over_type_check = true -csharp_style_prefer_range_operator = false:warning -csharp_style_throw_expression = true -csharp_style_unused_value_assignment_preference = discard_variable:warning -csharp_style_unused_value_expression_statement_preference = discard_variable:warning - -# 'using' directive preferences -csharp_using_directive_placement = outside_namespace - -# New line preferences -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true -csharp_style_allow_embedded_statements_on_same_line_experimental = true - -#### C# Formatting Rules #### - -# New line preferences +csharp_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 @@ -139,16 +12,13 @@ csharp_new_line_before_members_in_anonymous_types = true csharp_new_line_before_members_in_object_initializers = true csharp_new_line_before_open_brace = all csharp_new_line_between_query_expression_clauses = true - -# Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_labels = one_less_than_current -csharp_indent_switch_labels = true - -# Space preferences +csharp_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 @@ -171,166 +41,203 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false - -# Wrapping preferences -csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = false - -#### Naming styles #### - -# Naming rules - -dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning -dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface -dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i - -dotnet_naming_rule.types_should_be_pascal_case.severity = warning -dotnet_naming_rule.types_should_be_pascal_case.symbols = types -dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning -dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field -dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field - -dotnet_naming_rule.enum_should_be_pascal_case.severity = warning -dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum -dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning -dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field -dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field - -dotnet_naming_rule.class_should_be_pascal_case.severity = warning -dotnet_naming_rule.class_should_be_pascal_case.symbols = class -dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.method_should_be_pascal_case.severity = warning -dotnet_naming_rule.method_should_be_pascal_case.symbols = method -dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning -dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field -dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field - -dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning -dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field -dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.property_should_be_pascal_case.severity = warning -dotnet_naming_rule.property_should_be_pascal_case.symbols = property -dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning -dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method -dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case - +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 = suggestion # Using directive is unnecessary using System.Text; +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.symbols = abstract_method dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning -dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method -dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.event_should_be_pascal_case.severity = warning -dotnet_naming_rule.event_should_be_pascal_case.symbols = event -dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case - +dotnet_naming_rule.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.symbols = delegate dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case - -dotnet_naming_rule.struct_should_be_pascal_case.severity = warning -dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct -dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case - +dotnet_naming_rule.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.symbols = non_field_members dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case - -# Symbol specifications - -dotnet_naming_symbols.class.applicable_kinds = class -dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.class.required_modifiers = - -dotnet_naming_symbols.interface.applicable_kinds = interface -dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.interface.required_modifiers = - -dotnet_naming_symbols.struct.applicable_kinds = struct -dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.struct.required_modifiers = - -dotnet_naming_symbols.enum.applicable_kinds = enum -dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.enum.required_modifiers = - -dotnet_naming_symbols.delegate.applicable_kinds = delegate -dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.delegate.required_modifiers = - -dotnet_naming_symbols.event.applicable_kinds = event -dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.event.required_modifiers = - -dotnet_naming_symbols.method.applicable_kinds = method -dotnet_naming_symbols.method.applicable_accessibilities = public -dotnet_naming_symbols.method.required_modifiers = - -dotnet_naming_symbols.private_method.applicable_kinds = method -dotnet_naming_symbols.private_method.applicable_accessibilities = private -dotnet_naming_symbols.private_method.required_modifiers = - -dotnet_naming_symbols.abstract_method.applicable_kinds = method -dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.abstract_method.required_modifiers = abstract - -dotnet_naming_symbols.static_method.applicable_kinds = method -dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.static_method.required_modifiers = static - -dotnet_naming_symbols.property.applicable_kinds = property -dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.property.required_modifiers = - -dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field -dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected -dotnet_naming_symbols.public_or_protected_field.required_modifiers = - -dotnet_naming_symbols.static_field.applicable_kinds = field -dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.static_field.required_modifiers = static - -dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field -dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected -dotnet_naming_symbols.private_or_internal_field.required_modifiers = - -dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field -dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected -dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static - -dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum -dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.types.required_modifiers = - -dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method -dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected -dotnet_naming_symbols.non_field_members.required_modifiers = - -# Naming styles - -dotnet_naming_style.pascal_case.required_prefix = -dotnet_naming_style.pascal_case.required_suffix = -dotnet_naming_style.pascal_case.word_separator = -dotnet_naming_style.pascal_case.capitalization = pascal_case - +dotnet_naming_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.begins_with_i.capitalization = pascal_case - +dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.private_of_internal_field.capitalization = pascal_case dotnet_naming_style.private_of_internal_field.required_prefix = _ dotnet_naming_style.private_of_internal_field.required_suffix = dotnet_naming_style.private_of_internal_field.word_separator = -dotnet_naming_style.private_of_internal_field.capitalization = pascal_case +dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.abstract_method.applicable_kinds = method +dotnet_naming_symbols.abstract_method.required_modifiers = abstract +dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.class.applicable_kinds = class +dotnet_naming_symbols.class.required_modifiers = +dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.delegate.applicable_kinds = delegate +dotnet_naming_symbols.delegate.required_modifiers = +dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enum.applicable_kinds = enum +dotnet_naming_symbols.enum.required_modifiers = +dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.event.applicable_kinds = event +dotnet_naming_symbols.event.required_modifiers = +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.required_modifiers = +dotnet_naming_symbols.method.applicable_accessibilities = public +dotnet_naming_symbols.method.applicable_kinds = method +dotnet_naming_symbols.method.required_modifiers = +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.required_modifiers = +dotnet_naming_symbols.private_method.applicable_accessibilities = private +dotnet_naming_symbols.private_method.applicable_kinds = method +dotnet_naming_symbols.private_method.required_modifiers = +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.required_modifiers = +dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected +dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static +dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.property.applicable_kinds = property +dotnet_naming_symbols.property.required_modifiers = +dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected +dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field +dotnet_naming_symbols.public_or_protected_field.required_modifiers = +dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_field.applicable_kinds = field +dotnet_naming_symbols.static_field.required_modifiers = static +dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.static_method.applicable_kinds = method +dotnet_naming_symbols.static_method.required_modifiers = static +dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.struct.applicable_kinds = struct +dotnet_naming_symbols.struct.required_modifiers = +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.required_modifiers = +dotnet_remove_unnecessary_suppression_exclusions = 0 +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false +dotnet_style_allow_multiple_blank_lines_experimental = false:warning +dotnet_style_allow_statement_immediately_after_block_experimental = true +dotnet_style_coalesce_expression = true +dotnet_style_collection_initializer = true:warning +dotnet_style_explicit_tuple_names = true:warning +dotnet_style_namespace_match_folder = true +dotnet_style_null_propagation = true:warning +dotnet_style_object_initializer = true:warning +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_operators = never_if_unnecessary +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity +dotnet_style_predefined_type_for_locals_parameters_members = true +dotnet_style_predefined_type_for_member_access = true +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_prefer_compound_assignment = true:warning +dotnet_style_prefer_conditional_expression_over_assignment = false +dotnet_style_prefer_conditional_expression_over_return = false +dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning +dotnet_style_prefer_inferred_tuple_names = true:warning +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +dotnet_style_prefer_simplified_boolean_expressions = true:warning +dotnet_style_prefer_simplified_interpolation = true +dotnet_style_qualification_for_event = false:error +dotnet_style_qualification_for_field = false +dotnet_style_qualification_for_method = false:error +dotnet_style_qualification_for_property = false:error +dotnet_style_readonly_field = true:warning +dotnet_style_require_accessibility_modifiers = for_non_interface_members +end_of_line = crlf +file_header_template = unset +indent_size = 4 +indent_style = space +insert_final_newline = false +root = true +tab_width = 4 +# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822 +# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig +# https://github.com/dotnet/project-system/blob/main/.editorconfig \ No newline at end of file diff --git a/Adaptation/.vscode/format-report.json b/Adaptation/.vscode/format-report.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/Adaptation/.vscode/format-report.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/Adaptation/.vscode/launch.json b/Adaptation/.vscode/launch.json new file mode 100644 index 0000000..2927e60 --- /dev/null +++ b/Adaptation/.vscode/launch.json @@ -0,0 +1,10 @@ +{ + "configurations": [ + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": 14072 + } + ] +} diff --git a/Adaptation/.vscode/settings.json b/Adaptation/.vscode/settings.json new file mode 100644 index 0000000..3c7d3b3 --- /dev/null +++ b/Adaptation/.vscode/settings.json @@ -0,0 +1,45 @@ +{ + "cSpell.words": [ + "ANLYSDIFAAST", + "datauniqueid", + "Epuipment", + "EQPT", + "headerid", + "Idrv", + "ipdsf", + "Irng", + "ISMTP", + "JOBID", + "messa", + "messv", + "pdsf", + "pdsfc", + "PPID", + "Rcpe", + "RESIMAPCDE", + "Rsens", + "Smpl", + "Villach", + "Vrng" + ], + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#0fc5f0", + "activityBar.activeBorder": "#d20dac", + "activityBar.background": "#0fc5f0", + "activityBar.foreground": "#15202b", + "activityBar.inactiveForeground": "#15202b99", + "activityBarBadge.background": "#d20dac", + "activityBarBadge.foreground": "#e7e7e7", + "sash.hoverBorder": "#0fc5f0", + "statusBar.background": "#0c9ec0", + "statusBar.foreground": "#e7e7e7", + "statusBarItem.hoverBackground": "#0fc5f0", + "statusBarItem.remoteBackground": "#0c9ec0", + "statusBarItem.remoteForeground": "#e7e7e7", + "titleBar.activeBackground": "#0c9ec0", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveBackground": "#0c9ec099", + "titleBar.inactiveForeground": "#e7e7e799" + }, + "peacock.color": "#0c9ec0" +} \ No newline at end of file diff --git a/Adaptation/.vscode/tasks.json b/Adaptation/.vscode/tasks.json new file mode 100644 index 0000000..1deb1a8 --- /dev/null +++ b/Adaptation/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/MET08ANLYSDIFAAST230.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs index 4b83dcf..06ec233 100644 --- a/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneComponent.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.Core +namespace Adaptation.Eaf.Core; + +public class BackboneComponent { - public class BackboneComponent - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs index 5da2cda..69d3b7a 100644 --- a/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs +++ b/Adaptation/Eaf/Core/AutoGenerated/BackboneStatusCache.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.Core +namespace Adaptation.Eaf.Core; + +public class BackboneStatusCache { - public class BackboneStatusCache - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs index ba939e7..62e12d8 100644 --- a/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs +++ b/Adaptation/Eaf/Core/AutoGenerated/ILoggingSetupManager.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.Core +namespace Adaptation.Eaf.Core; + +public interface ILoggingSetupManager { - public interface ILoggingSetupManager - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs index 4dc8f3b..f981297 100644 --- a/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs +++ b/Adaptation/Eaf/Core/AutoGenerated/StatusItem.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.Core +namespace Adaptation.Eaf.Core; + +public class StatusItem { - public class StatusItem - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Backbone.cs b/Adaptation/Eaf/Core/Backbone.cs index aa7ddc8..f39f081 100644 --- a/Adaptation/Eaf/Core/Backbone.cs +++ b/Adaptation/Eaf/Core/Backbone.cs @@ -2,47 +2,52 @@ using System; using System.Collections.Generic; -namespace Adaptation.Eaf.Core +namespace Adaptation.Eaf.Core; + +public class Backbone { - public class Backbone - { - public const string STATE_ERROR = "Error"; - public const string STATE_OFFLINE = "Offline"; - public const string STATE_RUNNING = "Running"; - public const string STATE_SHUTDOWN = "Shutting Down"; - public const string STATE_STARTING = "Starting"; - protected Backbone() { } +#pragma warning disable CA1822 +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - [NotNull] - public static Backbone Instance { get; } - [NotNull] - public ILoggingSetupManager LoggingConfigurationManager { get; set; } - public BackboneStatusCache Status { get; } - public bool IsAutomatedRestartActive { get; } - public bool IsReadyForRestart { get; } - public string StartTime { get; } - public string State { get; } - public string Name { get; } - public string ConfigurationServiceAddress { get; } - public string CellName { get; } - protected bool IsInitialized { get; set; } - protected Dictionary BackboneComponents { get; } + public 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"; - public void AddBackboneComponent(BackboneComponent backboneComponent) { } - public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); } - [Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")] - public List GetAllStatuses() { throw new NotImplementedException(); } - public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); } - public List GetBackboneComponentsOfType() { throw new NotImplementedException(); } - public List GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); } - public void RegisterSubprocess(int pid) { } - [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] - public void SetStatus(string statusName, string statusValue) { } - [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] - public void SetStatus(BackboneComponent source, string statusName, string statusValue) { } - protected void CloseConnectionOfComponents(List components) { } - protected virtual void StopAllComponents() { } - protected void StopComponents(List components) { } - } -} + protected Backbone() { } + + [NotNull] + public static Backbone Instance { get; } + [NotNull] + public ILoggingSetupManager LoggingConfigurationManager { get; set; } + public BackboneStatusCache Status { get; } + public bool IsAutomatedRestartActive { get; } + public bool IsReadyForRestart { get; } + public string StartTime { get; } + public string State { get; } + public string Name { get; } + public string ConfigurationServiceAddress { get; } + public string CellName { get; } + protected bool IsInitialized { get; set; } + protected Dictionary BackboneComponents { get; } + + public void AddBackboneComponent(BackboneComponent backboneComponent) { } + public bool ContainsBackboneComponent(string id) => throw new NotImplementedException(); + [Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")] + public List GetAllStatuses() => throw new NotImplementedException(); + public BackboneComponent GetBackboneComponentById(string id) => throw new NotImplementedException(); + public List GetBackboneComponentsOfType() => throw new NotImplementedException(); + public List GetBackboneComponentsOfType(Type type) => throw new NotImplementedException(); + public void RegisterSubprocess(int pid) { } + [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] + public void SetStatus(string statusName, string statusValue) { } + [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] + public void SetStatus(BackboneComponent source, string statusName, string statusValue) { } + protected void CloseConnectionOfComponents(List components) { } + protected virtual void StopAllComponents() { } + protected void StopComponents(List components) { } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/EmailMessage.cs b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs index af96cd0..e16b8aa 100644 --- a/Adaptation/Eaf/Core/Smtp/EmailMessage.cs +++ b/Adaptation/Eaf/Core/Smtp/EmailMessage.cs @@ -1,24 +1,25 @@ using System; -namespace Adaptation.Eaf.Core.Smtp +namespace Adaptation.Eaf.Core.Smtp; + +public class EmailMessage { - public class EmailMessage - { - public EmailMessage() { } - public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { } +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - public string Body { get; } - public MailPriority Priority { get; } - public string Subject { get; } + public EmailMessage() { } + public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { } - 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(); } + public string Body { get; } + public MailPriority Priority { get; } + public string Subject { get; } - } + public EmailMessage PriorityHigh() => throw new NotImplementedException(); + public EmailMessage PriorityLow() => throw new NotImplementedException(); + public EmailMessage PriorityNormal() => throw new NotImplementedException(); + public EmailMessage SetBody(string body) => throw new NotImplementedException(); + public EmailMessage SetPriority(MailPriority priority) => throw new NotImplementedException(); + public EmailMessage SetSubject(string subject) => throw new NotImplementedException(); -} +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/ISmtp.cs b/Adaptation/Eaf/Core/Smtp/ISmtp.cs index cca7633..0446065 100644 --- a/Adaptation/Eaf/Core/Smtp/ISmtp.cs +++ b/Adaptation/Eaf/Core/Smtp/ISmtp.cs @@ -1,9 +1,6 @@ -namespace Adaptation.Eaf.Core.Smtp +namespace Adaptation.Eaf.Core.Smtp; + +public interface ISmtp { - - public interface ISmtp - { - void Send(EmailMessage message); - } - -} + void Send(EmailMessage message); +} \ No newline at end of file diff --git a/Adaptation/Eaf/Core/Smtp/MailPriority.cs b/Adaptation/Eaf/Core/Smtp/MailPriority.cs index 07b564a..b59d146 100644 --- a/Adaptation/Eaf/Core/Smtp/MailPriority.cs +++ b/Adaptation/Eaf/Core/Smtp/MailPriority.cs @@ -1,11 +1,8 @@ -namespace Adaptation.Eaf.Core.Smtp +namespace Adaptation.Eaf.Core.Smtp; + +public enum MailPriority { - - public enum MailPriority - { - Low = 0, - Normal = 1, - High = 2 - } - -} + Low = 0, + Normal = 1, + High = 2 +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs index 096cfd8..80e911e 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ChangeDataCollectionHandler.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class ChangeDataCollectionHandler { - public class ChangeDataCollectionHandler - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs index f085c14..d49c557 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/DataCollectionRequest.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class DataCollectionRequest { - public class DataCollectionRequest - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs index fd97bcb..9d45cb1 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentEvent.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class EquipmentEvent { - public class EquipmentEvent - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs index 1a3babd..c0cf1c3 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentException.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class EquipmentException { - public class EquipmentException - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs index 3697004..92d7722 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/EquipmentSelfDescription.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class EquipmentSelfDescription { - public class EquipmentSelfDescription - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs index bc26e0f..dca26fc 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/GetParameterValuesHandler.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class GetParameterValuesHandler { - public class GetParameterValuesHandler - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs index a9e800c..7481501 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IConnectionControl.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IConnectionControl { - public interface IConnectionControl - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs index 3b98f85..cf0602a 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IDataTracingHandler.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IDataTracingHandler { - public interface IDataTracingHandler - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs index 2a54add..9f6000e 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentCommandService.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IEquipmentCommandService { - public interface IEquipmentCommandService - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs index a119d2b..8b4f8d1 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentControl.cs @@ -1,16 +1,15 @@ using Adaptation.PeerGroup.GCL.Annotations; -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IEquipmentControl : IPackageSource { - public interface IEquipmentControl : IPackageSource - { - [NotNull] - IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; } - [NotNull] - IEquipmentDataCollection DataCollection { get; } - [NotNull] - IEquipmentCommandService Commands { get; } - [NotNull] - IConnectionControl Connection { get; } - } + [NotNull] + IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; } + [NotNull] + IEquipmentDataCollection DataCollection { get; } + [NotNull] + IEquipmentCommandService Commands { get; } + [NotNull] + IConnectionControl Connection { get; } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs index b583e8c..f34413f 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IEquipmentSelfDescriptionBuilder.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IEquipmentSelfDescriptionBuilder { - public interface IEquipmentSelfDescriptionBuilder - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs index 67ef808..eef26c3 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IPackage.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IPackage { - public interface IPackage - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs index 57b3215..be924e9 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/ISelfDescriptionLookup.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface ISelfDescriptionLookup { - public interface ISelfDescriptionLookup - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs index 64e4621..e7a76fc 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/IVirtualParameterValuesHandler.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IVirtualParameterValuesHandler { - public interface IVirtualParameterValuesHandler - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs index 200fb13..2615f40 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/SetParameterValuesHandler.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class SetParameterValuesHandler { - public class SetParameterValuesHandler - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs index 84511e9..8d26e7b 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/AutoGenerated/TraceRequest.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public class TraceRequest { - public class TraceRequest - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs index 7a704b5..d0980ee 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/IEquipmentDataCollection.cs @@ -3,37 +3,36 @@ using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; using System; using System.Collections.Generic; -namespace Adaptation.Eaf.EquipmentCore.Control -{ - public interface IEquipmentDataCollection - { - IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; } - ISelfDescriptionLookup SelfDescriptionLookup { get; } - EquipmentSelfDescription SelfDescription { get; } - IEnumerable ActiveRequests { get; } - IDataTracingHandler DataTracingHandler { get; } +namespace Adaptation.Eaf.EquipmentCore.Control; - ParameterValue CreateParameterValue(EquipmentParameter parameter, object value); - void NotifyDataTracingAvailable(bool isAvailable); - void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler); - void RegisterDataTracingHandler(IDataTracingHandler handler); - void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler); - void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler); - void TriggerDeactivate(DataCollectionRequest deactivateRequest); - void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters); - void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters, IPackage sourcePackage); - void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters); - void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); - void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); - void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); - void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); - void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); - void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); - void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters); - void TriggerPerformanceRestored(); - void TriggerPerformanceWarning(); - void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters); - void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, IPackage sourcePackage); - void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, DateTime equipmentTimeStamp); - } +public interface IEquipmentDataCollection +{ + IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; } + ISelfDescriptionLookup SelfDescriptionLookup { get; } + EquipmentSelfDescription SelfDescription { get; } + IEnumerable ActiveRequests { get; } + IDataTracingHandler DataTracingHandler { get; } + + ParameterValue CreateParameterValue(EquipmentParameter parameter, object value); + void NotifyDataTracingAvailable(bool isAvailable); + void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler); + void RegisterDataTracingHandler(IDataTracingHandler handler); + void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler); + void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler); + void TriggerDeactivate(DataCollectionRequest deactivateRequest); + void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters); + void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, string severityOverride, string descriptionOverride); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters, IPackage sourcePackage); + void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable parameters); + void TriggerPerformanceRestored(); + void TriggerPerformanceWarning(); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, IPackage sourcePackage); + void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable parameters, DateTime equipmentTimeStamp); } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs index 2c0371e..86760aa 100644 --- a/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs +++ b/Adaptation/Eaf/EquipmentCore/Control/IPackageSource.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.EquipmentCore.Control +namespace Adaptation.Eaf.EquipmentCore.Control; + +public interface IPackageSource { - public interface IPackageSource - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs index 9f0b794..468230d 100644 --- a/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs +++ b/Adaptation/Eaf/EquipmentCore/DataCollection/Reporting/ParameterValue.cs @@ -2,19 +2,24 @@ using Adaptation.PeerGroup.GCL.Annotations; using System; -namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting +namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; + +public class ParameterValue { - public class ParameterValue - { - public ParameterValue(EquipmentParameter definition, object value) { } - public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { } - public virtual object Value { get; protected internal set; } - [NotNull] - public EquipmentParameter Definition { get; } - public DateTime Timestamp { get; protected set; } +#pragma warning disable CA1822 +#pragma warning disable CA2254 +#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(); - public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); } - public override string ToString() { return base.ToString(); } - } } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs index 852fb8d..f9c126d 100644 --- a/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ElementDescription/EquipmentParameter.cs @@ -1,24 +1,27 @@ using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; -namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; + +public class EquipmentParameter { - public class EquipmentParameter - { - public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { } - public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } - public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } - public string Name { get; } - public string Id { get; } - public string Description { get; } - public string SourcePath { get; } - public string SourceEquipment { get; } - public ParameterTypeDefinition TypeDefinition { get; } - public bool IsTransient { get; } - public bool IsReadOnly { get; } +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - public override string ToString() { return base.ToString(); } - public string ToStringWithDetails() { return base.ToString(); } - } + 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(); } \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs index d1e2c0c..726b51a 100644 --- a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/Field.cs @@ -1,12 +1,16 @@ -namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes -{ - public class Field - { - public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { } +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; - public string Name { get; } - public string Description { get; } - public ParameterTypeDefinition TypeDefinition { get; } - public bool CanBeNull { get; } - } -} +public class Field +{ + +#pragma warning disable CA2254 +#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; } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs index 2b71408..00fc42a 100644 --- a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/ParameterTypeDefinition.cs @@ -1,12 +1,16 @@ -namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; + +public abstract class ParameterTypeDefinition { - public abstract class ParameterTypeDefinition - { - public ParameterTypeDefinition(string name, string description) { } - public string Name { get; } - public string Description { get; } +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - public override string ToString() { return base.ToString(); } - } -} + public ParameterTypeDefinition(string name, string description) { } + + public string Name { get; } + public string Description { get; } + + public override string ToString() => base.ToString(); + +} \ No newline at end of file diff --git a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs index 6eb9bc1..fe5fbce 100644 --- a/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs +++ b/Adaptation/Eaf/EquipmentCore/SelfDescription/ParameterTypes/StructuredType.cs @@ -1,12 +1,16 @@ using System.Collections.Generic; -namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes +namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; + +public class StructuredType : ParameterTypeDefinition { - public class StructuredType : ParameterTypeDefinition - { - public StructuredType(string name, string description, IList fields) : base(name, description) { } +#pragma warning disable CA1822 +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - public IList Fields { get; } - } -} + public StructuredType(string name, string description, IList fields) : base(name, description) { } + + public IList Fields { get; } + +} \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs index 597ace3..70ef834 100644 --- a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/IConfigurationObject.cs @@ -1,6 +1,5 @@ -namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation; + +public interface IConfigurationObject { - public interface IConfigurationObject - { - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs index 0b772a2..bdc8731 100644 --- a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterDefinition.cs @@ -1,26 +1,30 @@ using System; -namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation; + +[System.Runtime.Serialization.DataContract(IsReference = true)] +public class ModelObjectParameterDefinition : IConfigurationObject { - [System.Runtime.Serialization.DataContractAttribute(IsReference = true)] - public class ModelObjectParameterDefinition : IConfigurationObject - { - public ModelObjectParameterDefinition() { } - public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { } - public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long Id { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual string Name { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual string Value { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual ModelObjectParameterType ValueType { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual string EnumType { get; set; } +#pragma warning disable CA2254 +#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; - public virtual ModelObjectParameterDefinition Clone() { return null; } - public virtual bool IsValidValue(string value) { return false; } - } } \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs index 6f779af..c5a85c2 100644 --- a/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs +++ b/Adaptation/Eaf/Management/ConfigurationData/CellAutomation/ModelObjectParameterType.cs @@ -1,17 +1,16 @@ -namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation +namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation; + +public enum ModelObjectParameterType { - 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 - } + String = 0, + Bool = 1, + Byte = 2, + SignedByte = 3, + Integer = 4, + UnsignedInteger = 5, + LongInteger = 6, + UnsignedLongInteger = 7, + Double = 8, + Float = 9, + Enum = 10 } \ No newline at end of file diff --git a/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs index 91493b0..b8c1bd3 100644 --- a/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs +++ b/Adaptation/Eaf/Management/ConfigurationData/Semiconductor/CellInstances/SecsConnectionConfiguration.cs @@ -1,44 +1,43 @@ using Adaptation.PeerGroup.GCL.SecsDriver; using System; -namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances -{ - [System.Runtime.Serialization.DataContractAttribute] - public class SecsConnectionConfiguration - { - public SecsConnectionConfiguration() { } +namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances; - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T6HsmsControlMessage { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T5ConnectionSeperation { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T4InterBlock { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T3MessageReply { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T2Protocol { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T1InterCharacter { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual SerialBaudRate? BaudRate { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual SecsTransportType? PortType { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? Port { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan LinkTestTimer { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual string Host { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? DeviceId { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual HsmsSessionMode? SessionMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual HsmsConnectionMode? ConnectionMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T7ConnectionIdle { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual TimeSpan T8NetworkIntercharacter { get; set; } - } +[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; } } \ No newline at end of file diff --git a/Adaptation/FileHandlers/APC/FileRead.cs b/Adaptation/FileHandlers/APC/FileRead.cs new file mode 100644 index 0000000..d2fe9ca --- /dev/null +++ b/Adaptation/FileHandlers/APC/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.APC; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/Archive/FileRead.cs b/Adaptation/FileHandlers/Archive/FileRead.cs new file mode 100644 index 0000000..a502d10 --- /dev/null +++ b/Adaptation/FileHandlers/Archive/FileRead.cs @@ -0,0 +1,139 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.Archive; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) => Move(extractResults, exception); + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private void MoveArchive(DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + string logisticsSequence = _Logistics.Sequence.ToString(); + string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); + string jobIdDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", _Logistics.JobID); + if (!Directory.Exists(jobIdDirectory)) + _ = Directory.CreateDirectory(jobIdDirectory); + //string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory); + string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\Archive\", _Logistics.JobID, @"\", weekDirectory); + if (!Directory.Exists(destinationArchiveDirectory)) + _ = Directory.CreateDirectory(destinationArchiveDirectory); + string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() }; + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]); + destinationArchiveDirectory = string.Concat(destinationArchiveDirectory, @"\", Path.GetFileName(sourceDirectory)); + Directory.Move(sourceDirectory, destinationArchiveDirectory); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + Tuple> results; + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf); + List descriptions = GetDuplicatorDescriptions(jsonElements); + Tuple>> tuple = GetTuple(this, descriptions, extra: false); + MoveArchive(dateTime); + results = new Tuple>(pdsf.Item1, tuple.Item1, jsonElements, new List()); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/CellInstanceConnectionName.cs b/Adaptation/FileHandlers/CellInstanceConnectionName.cs new file mode 100644 index 0000000..2f4234a --- /dev/null +++ b/Adaptation/FileHandlers/CellInstanceConnectionName.cs @@ -0,0 +1,31 @@ +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 fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) + { + IFileRead result = cellInstanceConnectionName switch + { + nameof(Archive) => new Archive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(Dummy) => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(IQSSi) => new IQSSi.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(MoveMatchingFiles) => new MoveMatchingFiles.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(OpenInsight) => new OpenInsight.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(OpenInsightMetrologyViewer) => new OpenInsightMetrologyViewer.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(OpenInsightMetrologyViewerAttachments) => new OpenInsightMetrologyViewerAttachments.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(Processed) => new Processed.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(APC) => new APC.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + nameof(SPaCe) => new SPaCe.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted), + _ => throw new Exception($"\"{cellInstanceConnectionName}\" not mapped") + }; + return result; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/Dummy/FileRead.cs b/Adaptation/FileHandlers/Dummy/FileRead.cs new file mode 100644 index 0000000..6ef5f81 --- /dev/null +++ b/Adaptation/FileHandlers/Dummy/FileRead.cs @@ -0,0 +1,292 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using Infineon.Monitoring.MonA; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text.Json; +using System.Threading; + +namespace Adaptation.FileHandlers.Dummy; + +public class FileRead : Shared.FileRead, IFileRead +{ + + private readonly Timer _Timer; + private int _LastDummyRunIndex; + private readonly string[] _CellNames; + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + _LastDummyRunIndex = -1; + List cellNames = new(); + _Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite); + ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Alias"); + foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection) + cellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1]); + _CellNames = cellNames.ToArray(); + if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process) + Callback(null); + else + { + TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks); + _ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite); + } + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) => Move(extractResults, exception); + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) => throw new Exception(string.Concat("See ", nameof(CallbackFileExists))); + + Tuple> IFileRead.ReExtract() => throw new Exception(string.Concat("See ", nameof(CallbackFileExists))); + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private void CallbackInProcessCleared(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, string inProcessDirectory, long sequence, bool warning) + { + const string site = "sjc"; + string stateName = string.Concat("Dummy_", _EventName); + const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; + MonIn monIn = MonIn.GetInstance(monInURL); + try + { + if (warning) + { + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() }); + _ = monIn.SendStatus(site, monARessource, stateName, State.Warning); + for (int i = 1; i < 12; i++) + Thread.Sleep(500); + } + ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory); + string[] files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly); + if (files.Length > 250) + throw new Exception("Safety net!"); + foreach (string file in files) + File.SetLastWriteTime(file, new DateTime(sequence)); + if (!_FileConnectorConfiguration.IncludeSubDirectories.Value) + { + foreach (string file in files) + File.Move(file, Path.Combine(targetFileLocation, Path.GetFileName(file))); + } + else + { + string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories); + foreach (string directory in directories) + _ = Directory.CreateDirectory(string.Concat(targetFileLocation, directory.Substring(inProcessDirectory.Length))); + foreach (string file in files) + File.Move(file, string.Concat(targetFileLocation, file.Substring(inProcessDirectory.Length))); + } + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() }); + _ = monIn.SendStatus(site, monARessource, stateName, State.Ok); + } + catch (Exception exception) + { + string subject = string.Concat("Exception:", _CellInstanceConnectionName); + string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace); + try + { _SMTP.SendHighPriorityEmailMessage(subject, body); } + catch (Exception) { } + File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace }); + _ = monIn.SendStatus(site, monARessource, stateName, State.Critical); + } + } + + private void CallbackFileExists(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, long sequence) + { + string[] files; + bool warning = false; + if (!_DummyRuns.ContainsKey(monARessource)) + _DummyRuns.Add(monARessource, new List()); + if (!_DummyRuns[monARessource].Contains(sequence)) + _DummyRuns[monARessource].Add(sequence); + File.AppendAllLines(traceDummyFile, new string[] { sourceArchiveFile }); + string inProcessDirectory = Path.Combine(_ProgressPath, "Dummy In-Process", sequence.ToString()); + if (!Directory.Exists(inProcessDirectory)) + _ = Directory.CreateDirectory(inProcessDirectory); + files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories); + if (files.Any()) + { + if (files.Length > 250) + throw new Exception("Safety net!"); + try + { + foreach (string file in files) + File.Delete(file); + } + catch (Exception) { } + } + if (_FileConnectorConfiguration.IncludeSubDirectories.Value) + files = Directory.GetFiles(targetFileLocation, "*", SearchOption.AllDirectories); + else + files = Directory.GetFiles(targetFileLocation, "*", SearchOption.TopDirectoryOnly); + foreach (string file in files) + { + if (new FileInfo(file).LastWriteTime.Ticks == sequence) + { + warning = true; + break; + } + } + CallbackInProcessCleared(sourceArchiveFile, traceDummyFile, targetFileLocation, monARessource, inProcessDirectory, sequence, warning); + } + + private string GetCellName(string pathSegment) + { + string result = string.Empty; + foreach (string cellName in _CellNames) + { + if (pathSegment.ToLower().Contains(cellName.ToLower())) + { + result = cellName; + break; + } + } + if (string.IsNullOrEmpty(result)) + { + int count; + List<(string CellName, int Count)> cellNames = new(); + foreach (string cellName in _CellNames) + { + count = 0; + foreach (char @char in cellName.ToLower()) + count += pathSegment.Length - pathSegment.ToLower().Replace(@char.ToString(), string.Empty).Length; + cellNames.Add(new(cellName, count)); + } + result = (from l in cellNames orderby l.CellName.Length, l.Count descending select l.CellName).First(); + } + return result; + } + + private void Callback(object state) + { + try + { + string sourceParentDirectory; + string targetParentDirectory; + DateTime dateTime = DateTime.Now; + if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.SourceFileLocation))) + sourceParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation); + else + sourceParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation)); + if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.TargetFileLocation))) + targetParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation); + else + targetParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)); + if (sourceParentDirectory != targetParentDirectory) + throw new Exception("Target and source must have the same parent for Si Dummy FileConnectorConfiguration!"); + bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday; + if (!_IsEAFHosted || check) + { + string monARessource; + string sourceFileFilter; + string sourceArchiveFile; + string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string traceDummyDirectory = Path.Combine(Path.GetPathRoot(_TracePath), "TracesDummy", _CellInstanceName, "Source", $"{dateTime:yyyy}___Week_{weekOfYear}"); + if (!Directory.Exists(traceDummyDirectory)) + _ = Directory.CreateDirectory(traceDummyDirectory); + string traceDummyFile = Path.Combine(traceDummyDirectory, $"{dateTime.Ticks} - {_CellInstanceName}.txt"); + File.AppendAllText(traceDummyFile, string.Empty); + for (int i = 0; i < _FileConnectorConfiguration.SourceFileFilters.Count; i++) + { + _LastDummyRunIndex += 1; + if (_LastDummyRunIndex >= _FileConnectorConfiguration.SourceFileFilters.Count) + _LastDummyRunIndex = 0; + sourceFileFilter = _FileConnectorConfiguration.SourceFileFilters[_LastDummyRunIndex]; + sourceArchiveFile = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, sourceFileFilter); + if (File.Exists(sourceArchiveFile)) + { + if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) + throw new Exception("Invalid file name for source archive file!"); + monARessource = GetCellName(sourceArchiveFile); + if (string.IsNullOrEmpty(monARessource)) + throw new Exception("Could not determine which cell archive file is associated with!"); + if (_IsEAFHosted) + CallbackFileExists(sourceArchiveFile, traceDummyFile, _FileConnectorConfiguration.TargetFileLocation, monARessource, sequence); + break; + } + } + } + } + catch (Exception exception) + { + string subject = string.Concat("Exception:", _CellInstanceConnectionName); + string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace); + try + { _SMTP.SendHighPriorityEmailMessage(subject, body); } + catch (Exception) { } + } + try + { + TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks); + _ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite); + } + catch (Exception exception) + { + string subject = string.Concat("Exception:", _CellInstanceConnectionName); + string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace); + try + { _SMTP.SendHighPriorityEmailMessage(subject, body); } + catch (Exception) { } + } + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/EDA/FileRead.cs b/Adaptation/FileHandlers/EDA/FileRead.cs new file mode 100644 index 0000000..8524337 --- /dev/null +++ b/Adaptation/FileHandlers/EDA/FileRead.cs @@ -0,0 +1,204 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.MoveMatchingFiles; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private static List GetSearchDirectories(int numberLength, string parentDirectory) + { + List results = new(); + string[] directories = Directory.GetDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly); + foreach (string directory in directories) + { + if (Path.GetFileName(directory).Length != numberLength) + continue; + results.Add(directory); + } + results.Sort(); + return results; + } + + private List GetMatchingFiles(long ticks, string reportFullPath, List searchDirectories) + { + List results = new(); + string[] found; + string fileName = Path.GetFileName(reportFullPath); + foreach (string searchDirectory in searchDirectories) + { + for (int i = 0; i < int.MaxValue; i++) + { + found = Directory.GetFiles(searchDirectory, fileName, SearchOption.AllDirectories); + if (found.Any()) + { + results.AddRange(found); + break; + } + if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds) + break; + } + } + return results; + } + + private static List<(string matchingFile, string checkFile)> GetCollection(int numberLength, string parentDirectory, List matchingFiles) + { + List<(string matchingFile, string checkFile)> results = new(); + string checkFile; + int parentDirectoryLength = parentDirectory.Length; + foreach (string matchingFile in matchingFiles) + { + checkFile = $"{matchingFile[0]}{matchingFile.Substring(parentDirectoryLength + numberLength + 1)}"; + results.Add(new(matchingFile, checkFile)); + } + return results; + } + + private void MoveCollection(long ticks, List<(string matchingFile, string checkFile)> collection) + { + string errFile; + string checkDirectory; + foreach ((string matchingFile, string checkFile) in collection) + { + errFile = string.Concat(checkFile, ".err"); + checkDirectory = Path.GetDirectoryName(checkFile); + if (!Directory.Exists(checkDirectory)) + _ = Directory.CreateDirectory(checkDirectory); + File.Move(matchingFile, checkFile); + for (int i = 0; i < int.MaxValue; i++) + { + if (File.Exists(errFile)) + throw new Exception(File.ReadAllText(errFile)); + if (!File.Exists(checkFile)) + break; + if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds) + throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!"); + } + } + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + int numberLength = 2; + long ticks = DateTime.Now.Ticks; + string parentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)); + List searchDirectories = GetSearchDirectories(numberLength, parentDirectory); + List matchingFiles = GetMatchingFiles(ticks, reportFullPath, searchDirectories); + if (matchingFiles.Count != searchDirectories.Count) + throw new Exception($"Didn't find all files after {_BreakAfterSeconds} second(s)!"); + List<(string matchingFile, string checkFile)> collection = GetCollection(numberLength, parentDirectory, matchingFiles); + MoveCollection(ticks, collection); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/FileRead.cs b/Adaptation/FileHandlers/FileRead.cs deleted file mode 100644 index c1a5eb0..0000000 --- a/Adaptation/FileHandlers/FileRead.cs +++ /dev/null @@ -1,324 +0,0 @@ -using Adaptation.Helpers; -using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using log4net; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text.Json; - -namespace Adaptation.FileHandlers -{ - - public partial class FileRead : ILogic - { - - private ConfigData _ConfigData; - - public FileRead() - { - Logistics = new Logistics(); - _Log = LogManager.GetLogger(typeof(FileRead)); - } - - public ILogic ShallowCopy() - { - return (ILogic)MemberwiseClone(); - } - - public void WaitForThread() - { - WaitForThread(thread: null, threadExceptions: null); - } - - public Tuple GetOpenInsightTuple() - { - Tuple restuls = new Tuple(_ConfigData.OpenInsightSiViewer, _ConfigData); - return restuls; - } - - public override bool Extract(string reportFullPath, string eventName) - { - MethodBase methodBase = new StackFrame().GetMethod(); - _Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}")); - Tuple> extractResults = null; - try - { - extractResults = GetExtractResult(reportFullPath, eventName); - int count = extractResults.Item2.Value.GetArrayLength(); - if (count > 0 && _ConfigData.EafHosted && (_ConfigData.IsDatabaseExportToIPDSF || !_ConfigData.IsSourceTimer)) - Shared1140(extractResults.Item2.Value); - Shared0704(reportFullPath, extractResults, count); - Move(reportFullPath, extractResults); - Shared0406(reportFullPath); - _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); - return true; - } - catch (Exception ex) - { - _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); - Move(reportFullPath, extractResults, exception: ex); - return false; - } - } - - //public void SetColumns(string equipmentElementName, EquipmentType? equipmentType, string reportFullPath, Exception ex) //GaN - //{ - // if (equipmentConnection is null) - // throw new Exception(string.Concat("Unable to cast EquipmentElementName {", equipmentElementName, "}!")); - // int breakAfterSeconds; - // if (_Configuration is null) - // breakAfterSeconds = 360; - // else - // { - // if (_Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased) - // breakAfterSeconds = 360; - // else - // breakAfterSeconds = Math.Abs(_Configuration.FileScanningIntervalInSeconds); - // } - // ExtractResult = new ExtractResult(breakAfterSeconds, enumColumns: null, pairedColumns: null); - // switch (equipmentConnection.Value) - // { - // case EquipmentConnection.MET08DDUPSFS6420: - // ExtractResult.HeadersAddRange(Column.Process); - // ExtractResult.DetailsAddRange(); - // ExtractResult.ParametersAddRange(); - // ExtractResult.DatabaseHeadersAddRange(); - // ExtractResult.DatabaseDetailsAddRange(); - // break; - // case EquipmentConnection.MET08DDUPSP1TBI: - // ExtractResult.HeadersAddRange(Column.Process); - // ExtractResult.DetailsAddRange(); - // ExtractResult.ParametersAddRange(); - // ExtractResult.DatabaseHeadersAddRange(); - // ExtractResult.DatabaseDetailsAddRange(); - // break; - // case EquipmentConnection.MET08RESIHGCV: - // ExtractResult.HeadersAddRange(Column.Process); - // ExtractResult.DetailsAddRange(); - // ExtractResult.ParametersAddRange(); - // ExtractResult.DatabaseHeadersAddRange(); - // ExtractResult.DatabaseDetailsAddRange(); - // break; - // case EquipmentConnection.MET08THFTIRQS408M: - // ExtractResult.HeadersAddRange(Column.Process); - // ExtractResult.DetailsAddRange(); - // ExtractResult.ParametersAddRange(); - // ExtractResult.DatabaseHeadersAddRange(); - // ExtractResult.DatabaseDetailsAddRange(); - // break; - // case EquipmentConnection.MET08THFTIRSTRATUS: - // ExtractResult.HeadersAddRange(Column.Process); - // ExtractResult.DetailsAddRange(); - // ExtractResult.ParametersAddRange(); - // ExtractResult.DatabaseHeadersAddRange(); - // ExtractResult.DatabaseDetailsAddRange(); - // break; - // default: - // throw new Exception(string.Concat("Else {", equipmentElementName, "}!")); - // } - // if (!string.IsNullOrEmpty(reportFullPath) && !(ex is null)) - // { - // if (!(_Configuration is null) && _ConfigData.IsDuplicator) - // try { File.WriteAllLines(string.Concat(_Configuration.ErrorTargetFileLocation, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".err"), new string[] { Logistics.Sequence.ToString(), ex.Message, string.Empty, string.Empty, ex.StackTrace }); } catch (Exception) { } - // if (!_ConfigData.IsSourceTimer && !_ConfigData.IsDatabaseExportToIPDSF) - // { - // string fileName = string.Concat(reportFullPath, ".IO"); - // if (!(Configuration is null) && Configuration.PostProcessingMode == FileConnectorConfiguration.PostProcessingModeEnum.Copy) - // try { File.WriteAllLines(fileName, new string[] { Configuration.TargetFileName, Logistics.Sequence.ToString(), ex.Message, string.Empty, string.Empty, ex.StackTrace }); } catch (Exception) { } - // } - // if (_ConfigData.EquipmentConnection.HasValue && _ConfigData.EquipmentConnection.Value != _ConfigData.EquipmentType) - // { - // if (!reportFullPath.EndsWith(".pdsf") && !reportFullPath.EndsWith(".ipdsf")) - // { - // string fileName = string.Concat(reportFullPath, ".IO"); - // try { File.WriteAllLines(fileName, new string[] { "Configuration.TargetFileName", Logistics.Sequence.ToString(), ex.Message, string.Empty, string.Empty, ex.StackTrace }); } catch (Exception) { } - // } - // else - // { - // List debug = new List { "//Exception:" }; - // if (!(Logistics is null) && !(Logistics.Tags is null)) - // debug.AddRange(Logistics.Tags); - // debug.Add(ex.Message); - // debug.Add(ex.StackTrace); - // try { File.AppendAllLines(reportFullPath, debug); } catch (Exception) { } - // if (!(Logistics is null) && Logistics.DateTimeFromSequence != DateTime.MinValue && Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) - // { - // try { File.SetLastWriteTime(reportFullPath, Logistics.DateTimeFromSequence); } catch (Exception) { } - // } - // } - // } - // } - //} - - public Tuple> GetExtractResult(string reportFullPath, string eventName) - { - Tuple> results; - _FileParameter.Clear(); - DateTime dateTime = DateTime.Now; - if (_ConfigData.IsEvent && _ConfigData.Duplicator is null) - results = GetExtractResult(reportFullPath); - else if (_ConfigData.Duplicator.HasValue) - results = GetDuplicatorExtractResult(reportFullPath, dateTime); - else if (!_ConfigData.IsSourceIPDSF && reportFullPath.EndsWith(".ipdsf")) - { - results = new Tuple>(string.Empty, null, new List()); - NewMethod1(reportFullPath); - } - else if (reportFullPath.EndsWith(".pdsf")) - { - results = new Tuple>(string.Empty, null, new List()); - NewMethod2(reportFullPath, results); - } - else - throw new Exception(); - if (results.Item2 is null) - results = new Tuple>(results.Item1, JsonSerializer.Deserialize("[]"), results.Item3); - int count = results.Item2.Value.GetArrayLength(); - if (count > 0 && _ConfigData.EafHosted) - WritePDSF(results.Item2.Value); - UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); - return results; - } - - private void NewMethod2(string reportFullPath, Tuple> results) - { - FileInfo fileInfo = new FileInfo(reportFullPath); - Logistics = new Logistics(ConfigData.NullData, _ConfigData.CellNames, _ConfigData.MesEntities, fileInfo, useSplitForMID: false); - ProcessData processData = new ProcessData(this, _ConfigData, results.Item3, string.Empty, string.Empty); - if (!processData.Details.Any()) - throw new Exception(); - else - { - //foreach (var item in result.Details) - //{ - // ExtractResult.RowColumns[Description.RowColumn.Test].Add((int)Shared.Metrology.MET08ANLYSDIFAAST230.Test.DiffusionLength); - // ExtractResult.Headers[Column.Process].Add(item.Reactor); - // ExtractResult.Headers[Column.Employee].Add(item.Employee); - // ExtractResult.Headers[Column.Wafer_ID].Add(item.Slot); - // ExtractResult.Headers[Column.Recipe].Add(item.Recipe); - // ExtractResult.Parameters[Column.Wafer_Region].Add(item.DiffusionLength); - // ExtractResult.Parameters[Column.Wafer_Scribe].Add(item.DiffusionLengthStandardDeviation); - //} - System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Reactor)).Append(";"); - stringBuilder.Append("Date").Append(";"); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Employee)).Append(";"); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Slot)).Append(";"); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.Recipe)).Append(";"); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.DiffusionLength)).Append(";"); - stringBuilder.Append(nameof(ProcessData.DiffusionLengthDetail.DiffusionLengthStandardDeviation)).Append(";"); - stringBuilder.AppendLine(); - foreach (var item in processData.Details) - { - stringBuilder.Append("!"); - stringBuilder.Append(item.Reactor).Append(";"); - stringBuilder.Append(Logistics.DateTimeFromSequence.ToString("MM/dd/yyyy HH:mm:ss")).Append(";"); - stringBuilder.Append(item.Employee).Append(";"); - stringBuilder.Append(item.Slot).Append(";"); - stringBuilder.Append(item.Recipe).Append(";"); - stringBuilder.Append(item.DiffusionLength).Append(";"); - stringBuilder.Append(item.DiffusionLengthStandardDeviation); - stringBuilder.AppendLine(); - } - string copyFile = string.Concat(_ConfigData.IqsTempPath, @"\", _ConfigData.IqsFile, ".txt"); - File.WriteAllText(copyFile, stringBuilder.ToString()); - File.Copy(copyFile, string.Concat(_ConfigData.IqsPath, @"\", _ConfigData.IqsFile, ".txt")); - } - } - - private void NewMethod1(string reportFullPath) - { - Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); - Logistics = new Logistics(reportFullPath, pdsf.Item1); - SetFileParameterLotIDToLogisticsMID(); - SetFileParameterSystemDateTimeToLogisticsSequence(); - var data = ProcessDataStandardFormat.GetTestDictionary(pdsf); - ExtractResult.SetCollections(Logistics, data.Item2); - } - - private void NewMethod(string reportFullPath) - { - Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); - Logistics = new Logistics(reportFullPath, pdsf.Item1); - SetFileParameterLotIDToLogisticsMID(); - SetFileParameterSystemDateTimeToLogisticsSequence(); - bool hardSkip = _Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased; //false; - if (!hardSkip && _Configuration.FileScanningIntervalInSeconds > 0 && !_ConfigData.IsArchive) - { - string successDirectory; - string duplicateDirectory; - if (!_ConfigData.IsXToAPC) - successDirectory = string.Empty; - else - { - successDirectory = string.Concat(Path.GetDirectoryName(_Configuration.TargetFileLocation), @"\ViewerPath"); - if (!Directory.Exists(successDirectory)) - Directory.CreateDirectory(successDirectory); - } - if (_ConfigData.IsXToSPaCe || _ConfigData.IsXToSPaCeVillach) - duplicateDirectory = _Configuration.TargetFileLocation; - else - duplicateDirectory = string.Concat(_Configuration.TargetFileLocation, @"\", Logistics.JobID); - if (!Directory.Exists(duplicateDirectory)) - Directory.CreateDirectory(duplicateDirectory); - string logisticsSequence = Logistics.Sequence.ToString(); - List> tuples = new List>(); - string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath)); - if (!_ConfigData.IsXToArchive && !_ConfigData.IsXToIQS) - File.Copy(reportFullPath, duplicateFile, overwrite: true); - else - { - //Enum[] enumColumns = new Enum[] { ... - } - } - } - - public void Move(string reportFullPath, Tuple> extractResults, Exception exception = null) - { - bool isErrorFile = !(exception is null); - object filePathGeneratorInfo = GetFilePathGeneratorInfo(reportFullPath, isErrorFile); - if (filePathGeneratorInfo is null || !(filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator)) - OISiViewer.WebClientDownloadString(_Description, reportFullPath, isErrorFile, string.Empty); - else - { - FilePathGeneratorInfo info = (FilePathGeneratorInfo)filePathGeneratorInfo; - OISiViewer.WebClientDownloadString(_Description, reportFullPath, isErrorFile, filePathGenerator.To); - if (isErrorFile) - { - string[] exceptionLines = new string[] { Logistics.Sequence.ToString(), filePathGenerator.ReportFullPath, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, filePathGenerator.To, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace }; - if (_ConfigData.IsDuplicator) - CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, level, exceptionLines); - else - { - string fileName = string.Concat(filePathGenerator.To, @"\readme.txt"); - try - { - if (!Directory.Exists(filePathGenerator.To)) - Directory.CreateDirectory(filePathGenerator.To); - File.WriteAllLines(fileName, exceptionLines); - } - catch (Exception ex) { _Log.Error(ex.Message); } - } - } - } - if (!isErrorFile && _ConfigData.IsDuplicator) - { - if (_ConfigData.IsXToArchive) - Shared0192(reportFullPath); - else if (_ConfigData.IsArchive) - { - //Archive - } - if (_ConfigData.EafHosted && !string.IsNullOrEmpty(_ConfigData.ProgressPath)) - CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, level, exceptionLines: null); - } - } - - } - -} diff --git a/Adaptation/FileHandlers/FileReadShared.cs b/Adaptation/FileHandlers/FileReadShared.cs deleted file mode 100644 index 92c65cc..0000000 --- a/Adaptation/FileHandlers/FileReadShared.cs +++ /dev/null @@ -1,1016 +0,0 @@ -using Adaptation.Eaf.Core; -using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; -using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; -using Adaptation.Helpers; -using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using log4net; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.Threading; - -namespace Adaptation.FileHandlers -{ - - public partial class FileRead - { - - public Logistics Logistics { get; protected set; } - - private bool _TargetFileLocationOkay; - private bool _ErrorTargetFileLocationOkay; - - private string _OriginalSourceFileLocation; - private string _OriginalTargetFileLocation; - private string _OriginalTarget2FileLocation; - private string _OriginalErrorTargetFileLocation; - -#pragma warning disable CS0169 - private readonly ILog _Log; - private Description _Description; -#pragma warning restore CS0169 - - private Type _ConfigurationType; - private MethodInfo _SetPlaceHolderMethodInfo; - private PropertyInfo _Target2FileLocationPropertyInfo; - private MethodInfo _ResolveSourcePlaceHoldersMethodInfo; - private MethodInfo _ResolveTargetPlaceHoldersMethodInfo; - private MethodInfo _ResolveTarget2PlaceHoldersMethodInfo; - private MethodInfo _ResolveErrorTargetPlaceHoldersMethodInfo; - - private string _LastReportFullPath; - private long _BreakAfterSeconds = 0; - private long _LastTicksDuration = 0; - private Dictionary _FileParameter; - private FileConnectorConfiguration _Configuration; - - public ConfigDataBase GetConfigDataBase(MethodBase methodBase, string cellInstanceName, string equipmentElementName, FileConnectorConfiguration fileConnectorConfiguration, IList modelObjectParameterDefinitions, bool eafHosted) - { - ConfigData result; - _Configuration = fileConnectorConfiguration; - Type type = methodBase.DeclaringType; - string equipmentTypeName = string.Empty; - result = new ConfigData(this, cellInstanceName, equipmentElementName, fileConnectorConfiguration, equipmentTypeName, modelObjectParameterDefinitions, type.FullName, isEAFHosted: true); - _ConfigData = result; - return result; - } - - public string GetTarget2FileLocation() - { - string result; - if (_Target2FileLocationPropertyInfo is null) - _Target2FileLocationPropertyInfo = _ConfigurationType.GetProperty("Target2FileLocation", BindingFlags.Instance | BindingFlags.Public); - if (_Target2FileLocationPropertyInfo is null) - result = string.Empty; - else - { - object @object = _Target2FileLocationPropertyInfo.GetValue(_Configuration); - if (@object is null) - result = string.Empty; - else - result = @object.ToString(); - } - return result; - } - - public void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums) - { - throw new NotImplementedException("Use V2"); - } - - public ConfigDataBase ReflectionCreateSelfDescriptionV2(string json) - { - ConfigData result; - string cellInstanceName; - string equipmentTypeName; - string cellInstanceConnectionName; - string parameterizedModelObjectDefinitionType; - if (!json.Contains(nameof(cellInstanceName))) - throw new Exception(); - if (!json.Contains(nameof(equipmentTypeName))) - throw new Exception(); - if (!json.Contains(nameof(cellInstanceConnectionName))) - throw new Exception(); - if (!json.Contains(nameof(FileConnectorConfiguration))) - throw new Exception(); - if (!json.Contains(nameof(IList))) - throw new Exception(); - if (!json.Contains(nameof(parameterizedModelObjectDefinitionType))) - throw new Exception(); - MethodBase methodBase = new StackFrame().GetMethod(); - JsonElement jsonElement = JsonSerializer.Deserialize(json); - cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString(); - equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString(); - cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString(); - JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration)); - parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString(); - if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object) - throw new Exception(); - JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; - FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions); - _Configuration = fileConnectorConfiguration; - JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList)); - if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - IList modelObjectParameterDefinitions = JsonSerializer.Deserialize>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions); -#if (false) - FileConnectorConfiguration fileConnectorConfigurationOld = GetFileConnectorConfiguration(strings, booleans, numbers, enums); - jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true }; - string @new = JsonSerializer.Serialize(fileConnectorConfiguration, fileConnectorConfiguration.GetType(), jsonSerializerOptions); - string old = JsonSerializer.Serialize(fileConnectorConfigurationOld, fileConnectorConfiguration.GetType(), jsonSerializerOptions); - if (@new != old) - throw new Exception(); -#endif - if (!(Backbone.Instance is null)) - { - Type type = Backbone.Instance.GetType(); - PropertyInfo propertyInfo = type.GetProperty(nameof(Backbone.Instance.CellName)); - if (!(propertyInfo is null)) - { - MethodInfo methodInfo = propertyInfo.GetSetMethod(nonPublic: true); - if (!(methodInfo is null)) - methodInfo.Invoke(Backbone.Instance, new object[] { cellInstanceName }); - } - } - _Configuration = fileConnectorConfiguration; - result = new ConfigData(this, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, modelObjectParameterDefinitions, parameterizedModelObjectDefinitionType, isEAFHosted: false); - _ConfigData = result; - _Description = new Description(this, result, equipmentControl: null); - Shared0749(); - _FileParameter = new Dictionary(); - Shared1301(_FileParameter, fileConnectorConfiguration); - return result; - } - - public object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) - { - string result; - if (!_Configuration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString())) - result = _Configuration.TargetFileLocation; - else - result = Path.GetDirectoryName(_Configuration.TargetFileLocation); - foreach (KeyValuePair keyValuePair in _FileParameter) - result = result.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value); - return result; - } - - private void TriggerEvents(string reportFullPath, Tuple> extractResults) - { - List parameters; - int count = extractResults.Item2.Value.GetArrayLength(); - for (int i = 0; i < count; i++) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); - parameters = _Description.GetParameterValues(this, null, extractResults.Item2.Value, i); -#if (false) - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); -#endif - if (_ConfigData.UseCyclicalForDescription) - break; - } - if (_ConfigData.IsDatabaseExportToIPDSF && count > 0) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); - parameters = _Description.GetParameterValues(this, null, extractResults.Item2.Value, null); -#if (false) - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); -#endif - } - } - - public Tuple> ReExtract(string searchDirectory, string sourceFileFilter) - { - Tuple> results; - if (!Directory.Exists(searchDirectory)) - results = null; - else - { - string[] segments; - string[] matches = null; - foreach (string subSourceFileFilter in sourceFileFilter.Split('|')) - { - segments = subSourceFileFilter.Split('\\'); - if (_Configuration.IncludeSubDirectories.Value) - matches = Directory.GetFiles(searchDirectory, segments.Last(), SearchOption.AllDirectories); - else - matches = Directory.GetFiles(searchDirectory, segments.Last(), SearchOption.TopDirectoryOnly); - if (matches.Any()) - break; - } - if (matches is null || !matches.Any()) - results = null; - else - { - string reportFullPath = matches[0]; - results = GetExtractResult(reportFullPath, Description.FileFound); - if (!_ConfigData.EafHosted) - TriggerEvents(Logistics.ReportFullPath, results); - } - } - return results; - } - - public void SetTarget2FileLocation(string value) - { - if (_Target2FileLocationPropertyInfo is null) - _Target2FileLocationPropertyInfo = _ConfigurationType.GetProperty("Target2FileLocation", BindingFlags.Instance | BindingFlags.Public); - if (!(_Target2FileLocationPropertyInfo is null)) - _Target2FileLocationPropertyInfo.SetValue(_Configuration, value); - } - - public void ConfigurationRestore() - { - _Configuration.SourceFileLocation = _OriginalSourceFileLocation; - _Configuration.TargetFileLocation = _OriginalTargetFileLocation; - SetTarget2FileLocation(_OriginalTarget2FileLocation); - _Configuration.ErrorTargetFileLocation = _OriginalErrorTargetFileLocation; - } - - public string GetConfigurationSourceFileLocation() - { - return _Configuration.SourceFileLocation; - } - - public string GetConfigurationTargetFileLocation() - { - return _Configuration.TargetFileLocation; - } - - public string GetConfigurationTargetFileName() - { - return _Configuration.TargetFileName; - } - - public string GetConfigurationTarget2FileLocation() - { - return GetTarget2FileLocation(); - } - - public string GetConfigurationErrorTargetFileLocation() - { - return _Configuration.ErrorTargetFileLocation; - } - - public void SetPlaceHolder(string reportFullPath, string key, string value) - { - if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) - _LastReportFullPath = reportFullPath; - if (_SetPlaceHolderMethodInfo is null) - _SetPlaceHolderMethodInfo = _ConfigurationType.GetMethod(nameof(this.SetPlaceHolder)); - object @object = _SetPlaceHolderMethodInfo.Invoke(_Configuration, new object[] { key, value }); - if (!_FileParameter.ContainsKey(key)) - _FileParameter[key] = string.Empty; - _FileParameter[key] = value; - } - - public string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true) - { - string result; - if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) - _LastReportFullPath = reportFullPath; - _FileParameter.Clear(); - if (_ResolveSourcePlaceHoldersMethodInfo is null) - _ResolveSourcePlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveSourcePlaceHolders)); - if (_ResolveSourcePlaceHoldersMethodInfo is null) - result = string.Empty; - else - { - object @object = _ResolveSourcePlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory }); - if (@object is null) - result = string.Empty; - else - result = @object.ToString(); - } - return result; - } - - public string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") - { - string result; - if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) - _LastReportFullPath = reportFullPath; - if (!string.IsNullOrEmpty(reportFullPath) || !string.IsNullOrEmpty(_LastReportFullPath)) - { - //bool isErrorFile = false; - //Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator filePathGenerator; - //if (!string.IsNullOrEmpty(reportFullPath)) - // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, reportFullPath, isErrorFile, _FileParameter); - //else if (!string.IsNullOrEmpty(_LastReportFullPath)) - // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, _LastReportFullPath, isErrorFile, _FileParameter); - //else - // throw new Exception(); - //result = filePathGenerator.GetTargetFolder(); - } - _FileParameter.Clear(); - if (_ResolveTargetPlaceHoldersMethodInfo is null) - _ResolveTargetPlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveTargetPlaceHolders)); - if (_ResolveTargetPlaceHoldersMethodInfo is null) - result = string.Empty; - else - { - object @object = _ResolveTargetPlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); - if (@object is null) - result = string.Empty; - else - result = @object.ToString(); - } - return result; - } - - public string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") - { - string result; - if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) - _LastReportFullPath = reportFullPath; - _FileParameter.Clear(); - if (_ResolveTarget2PlaceHoldersMethodInfo is null) - _ResolveTarget2PlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveTarget2PlaceHolders)); - if (_ResolveTarget2PlaceHoldersMethodInfo is null) - result = string.Empty; - else - { - object @object = _ResolveTarget2PlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); - if (@object is null) - result = string.Empty; - else - result = @object.ToString(); - } - return result; - } - - public string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "") - { - string result; - if (!string.IsNullOrEmpty(reportFullPath) && _LastReportFullPath != reportFullPath) - _LastReportFullPath = reportFullPath; - if (!string.IsNullOrEmpty(reportFullPath) || !string.IsNullOrEmpty(_LastReportFullPath)) - { - //bool isErrorFile = true; - //Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator filePathGenerator; - //if (!string.IsNullOrEmpty(reportFullPath)) - // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, reportFullPath, isErrorFile, _FileParameter); - //else if (!string.IsNullOrEmpty(_LastReportFullPath)) - // filePathGenerator = new Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator(_Configuration, _LastReportFullPath, isErrorFile, _FileParameter); - //else - // throw new Exception(); - //result = filePathGenerator.GetTargetFolder(); - } - _FileParameter.Clear(); - if (_ResolveErrorTargetPlaceHoldersMethodInfo is null) - _ResolveErrorTargetPlaceHoldersMethodInfo = _ConfigurationType.GetMethod(nameof(this.ResolveErrorTargetPlaceHolders)); - if (_ResolveErrorTargetPlaceHoldersMethodInfo is null) - result = string.Empty; - else - { - object @object = _ResolveErrorTargetPlaceHoldersMethodInfo.Invoke(_Configuration, new object[] { createDirectory, fileFoundPath }); - if (@object is null) - result = string.Empty; - else - result = @object.ToString(); - } - return result; - } - - public string GetReportFullPath(Dictionary keyValuePairs) - { - string result; - if (keyValuePairs is null || !keyValuePairs.Any()) - result = string.Empty; - else - { - string key; - key = "Param1"; - Dictionary eventDataList; - if (!keyValuePairs.ContainsKey(key)) - eventDataList = keyValuePairs; - else - eventDataList = (Dictionary)keyValuePairs[key]; - key = "InputFileName"; - if (!eventDataList.ContainsKey(key)) - result = string.Empty; - else - result = eventDataList[key].ToString(); - } - return result; - } - - public void SetFileParameter(string key, string value) - { - if (_Configuration is null || _Configuration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _Configuration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _Configuration.TargetFileName.Contains(string.Concat("%", key, "%")) || _Configuration.ErrorTargetFileName.Contains(string.Concat("%", key, "%"))) - { - if (_FileParameter.ContainsKey(key)) - _FileParameter[key] = value; - else - _FileParameter.Add(key, value); - } - } - - public 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); - } - - public 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); - } - - public void SetFileParameterSystemDateTimeToLogisticsSequence() - { - string key = "SystemDateTime"; - string value = string.Concat(DateTime.Now.ToString("hh;mm;ss_tt_"), Logistics.Sequence); - SetFileParameter(key, value); - } - - private void UpdateLastTicksDuration(long ticksDuration) - { - if (ticksDuration < 50000000) - ticksDuration = 50000000; - _LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); - } - - private string GetTupleFile(Logistics logistics, 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; - } - - private void WaitForFileConsumption(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, string successDirectory, string duplicateDirectory, string duplicateFile, List> tuples) - { - bool check; - long preWait; - string tupleFile; - List consumedFileIndices = new List(); - List duplicateFiles = new List(); - bool moreThanAnHour = (_BreakAfterSeconds > 3600); - StringBuilder stringBuilder = new StringBuilder(); - long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; - if (moreThanAnHour) - preWait = dateTime.AddSeconds(30).Ticks; - else - preWait = dateTime.AddTicks(_LastTicksDuration).Ticks; - if (!tuples.Any()) - duplicateFiles.Add(duplicateFile); - string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); - string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath)); - foreach (Tuple tuple in tuples) - { - if (tuple.Item1.FileName.StartsWith(@"\")) - tupleFile = tuple.Item1.FileName; - else if (!tuple.Item1.FileName.Contains('%')) - tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); - else - tupleFile = GetTupleFile(logistics, tuple.Item1, duplicateDirectory); - duplicateFiles.Add(tupleFile); - File.WriteAllText(tupleFile, tuple.Item2); - } - for (short i = 0; i < short.MaxValue; i++) - { - if (DateTime.Now.Ticks > preWait) - break; - Thread.Sleep(500); - } - if (!moreThanAnHour) - { - for (short z = 0; z < short.MaxValue; z++) - { - try - { - check = (string.IsNullOrEmpty(successDirectory) || File.Exists(successFile)); - if (check) - { - consumedFileIndices.Clear(); - for (int i = 0; i < duplicateFiles.Count; i++) - { - if (!File.Exists(duplicateFiles[i])) - consumedFileIndices.Add(i); - } - if (consumedFileIndices.Count == duplicateFiles.Count) - break; - } - } - catch (Exception) { } - if (DateTime.Now.Ticks > breakAfter) - { - for (int i = 0; i < duplicateFiles.Count; i++) - { - if (File.Exists(duplicateFiles[i])) - { - try { File.Delete(duplicateFiles[i]); } catch (Exception) { } - stringBuilder.Append("<").Append(duplicateFiles[i]).Append("> "); - } - } - throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder)); - } - Thread.Sleep(500); - } - } - } - - private IEnumerable GetDirectoriesRecursively(string path, string directoryNameSegment = null) - { - Queue queue = new Queue(); - queue.Enqueue(path); - while (queue.Count > 0) - { - path = queue.Dequeue(); - foreach (string subDirectory in Directory.GetDirectories(path)) - { - queue.Enqueue(subDirectory); - if (string.IsNullOrEmpty(directoryNameSegment) || Path.GetFileName(subDirectory).Contains(directoryNameSegment)) - yield return subDirectory; - } - } - } - - private string GetProcessedDirectory(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory) - { - string result = duplicateDirectory; - string logisticsSequence = logistics.Sequence.ToString(); - string[] matchDirectories; - if (!_ConfigData.EafHosted) - matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(logistics.ReportFullPath)) }; - else - matchDirectories = new string[] { GetDirectoriesRecursively(Path.GetDirectoryName(progressPath), logisticsSequence).FirstOrDefault() }; - if (matchDirectories.Length == 0 || string.IsNullOrEmpty(matchDirectories[0])) - matchDirectories = Directory.GetDirectories(duplicateDirectory, string.Concat('*', logisticsSequence, '*'), SearchOption.AllDirectories); - if ((matchDirectories is null) || matchDirectories.Length != 1) - throw new Exception("Didn't find directory by logistics sequence"); - if (!matchDirectories[0].Contains("_processed")) - { - result = string.Concat(matchDirectories[0].Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), dateTime.Ticks - logistics.Sequence, "_processed"); - Directory.Move(matchDirectories[0], result); - result = string.Concat(result, @"\", logistics.Sequence); - if (!Directory.Exists(result)) - Directory.CreateDirectory(result); - } - return result; - } - - private string WriteScopeInfo(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory, List> tuples) - { - string result = GetProcessedDirectory(progressPath, logistics, dateTime, duplicateDirectory); - string tupleFile; - string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); - string duplicateFile = string.Concat(result, @"\", fileName, ".pdsf"); - foreach (Tuple tuple in tuples) - { - if (tuple.Item1.FileName.StartsWith(@"\")) - tupleFile = tuple.Item1.FileName; - else - tupleFile = string.Concat(result, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); - File.WriteAllText(tupleFile, tuple.Item2); - } - File.Copy(logistics.ReportFullPath, duplicateFile, overwrite: true); - return result; - } - - private void CreateProgressDirectory(string progressPath, Logistics logistics, int? duplicator, string[] exceptionLines) - { - string progressDirectory; - StringBuilder stringBuilder = new StringBuilder(); - if (duplicator is null || duplicator.Value == 0) - progressDirectory = string.Concat(progressPath, @"\", ProcessDataStandardFormat.EquipmentIntegration()); - else - { - stringBuilder.Clear(); - for (int i = 0; i < duplicator.Value; i++) - { - if (i > 0 && (i % 2) == 0) - stringBuilder.Append(' '); - stringBuilder.Append('-'); - } - progressDirectory = string.Concat(progressPath, @"\", (duplicator.Value + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim(); - } - DateTime dateTime = DateTime.Now; - CultureInfo cultureInfo = new CultureInfo("en-US"); - Calendar calendar = cultureInfo.Calendar; - string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); - progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", logistics.MID, "_", logistics.Sequence, "_", DateTime.Now.Ticks - logistics.Sequence); - if (!Directory.Exists(progressDirectory)) - Directory.CreateDirectory(progressDirectory); - if (!(exceptionLines is null)) - { - string fileName = string.Concat(progressDirectory, @"\readme.txt"); - try { File.WriteAllLines(fileName, exceptionLines); } catch (Exception) { } - } - } - - private void Shared0192(string reportFullPath) - { - if (!string.IsNullOrEmpty(reportFullPath)) - { - FileInfo fileInfo = new FileInfo(reportFullPath); - if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) - File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime); - } - } - - public void Shared0231(List directories) - { - if (_Configuration.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); - } - } - } - - private void WriteIO(string reportFullPath) - { - if (!_ConfigData.IsSourceTimer && !_ConfigData.IsDatabaseExportToIPDSF) - { - string fileName = string.Concat(reportFullPath, ".IO"); - if (!(_Configuration is null) && _Configuration.PostProcessingMode == FileConnectorConfiguration.PostProcessingModeEnum.Copy) - File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString() }); - } - } - - private void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List> tuples, string duplicateFile) - { - if (!isDummyRun && _ConfigData.EafHosted) - WaitForFileConsumption(_Configuration.SourceDirectoryCloaking, Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples); - else - { - long breakAfter = DateTime.Now.AddSeconds(_Configuration.ConnectionRetryInterval.Value).Ticks; - for (short i = 0; i < short.MaxValue; i++) - { - if (!_ConfigData.EafHosted || DateTime.Now.Ticks > breakAfter) - break; - Thread.Sleep(500); - } - } - } - - public void Shared0449(string to, string[] exceptionLines) - { - if (_ConfigData.Duplicator.HasValue) - CreateProgressDirectory(_ConfigData.ProgressPath, Logistics, (int?)_ConfigData.Duplicator, exceptionLines); - else - { - string fileName = string.Concat(to, @"\readme.txt"); - try - { - if (!Directory.Exists(to)) - Directory.CreateDirectory(to); - File.WriteAllLines(fileName, exceptionLines); - } - catch (Exception ex) { _Log.Error(ex.Message); } - } - } - - private static void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory) - { - if (destinationDirectory == duplicateDirectory) - throw new Exception("Check Target File Folder for %LotIDWithLogisticsSequence%_in process on CI (not Duplicator)"); - if (destinationDirectory.EndsWith(logisticsSequence)) - destinationDirectory = Path.GetDirectoryName(destinationDirectory); - string[] deleteFiles = Directory.GetFiles(destinationDirectory, "*", SearchOption.AllDirectories); - if (deleteFiles.Length > 250) - throw new Exception("Safety net!"); - foreach (string file in deleteFiles) - File.Delete(file); - Directory.Delete(destinationDirectory, recursive: true); - File.Delete(reportFullPath); - } - - public void Shared0749() - { - long breakAfterSeconds; - if (_Configuration is null) - breakAfterSeconds = 360; - else - { - if (_Configuration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased) - breakAfterSeconds = 360; - else - breakAfterSeconds = Math.Abs(_Configuration.FileScanningIntervalInSeconds.Value); - } - _BreakAfterSeconds = breakAfterSeconds; - UpdateLastTicksDuration(breakAfterSeconds * 10000000); - if (_ConfigData.Duplicator.HasValue) - { - if (string.IsNullOrEmpty(_Configuration.TargetFileLocation) || string.IsNullOrEmpty(_Configuration.ErrorTargetFileLocation)) - throw new Exception("_Configuration is empty?"); - if (_Configuration.TargetFileLocation.Contains('%') || _Configuration.ErrorTargetFileLocation.Contains('%')) - throw new Exception("_Configuration is incorrect for a duplicator!"); - if (!(_Configuration is null)) - { - if (string.IsNullOrEmpty(_Configuration.SourceDirectoryCloaking)) - throw new Exception("SourceDirectoryCloaking is empty?"); - if (!_Configuration.SourceDirectoryCloaking.StartsWith("~")) - throw new Exception("SourceDirectoryCloaking is incorrect for a duplicator!"); - } - } - } - - public string[] Shared1124(string reportFullPath, Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception = null) - { - string[] results; - bool isErrorFile = !(exception is null); - if (!to.EndsWith(@"\")) - string.Concat(to, @"\"); - if (!isErrorFile) - results = new string[] { }; - else - { - results = new string[] { Logistics.Sequence.ToString(), reportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace }; - Shared0449(to, results); - } - if (!(extractResults is null) && !(extractResults.Item3 is null) && extractResults.Item3.Any()) - { - string itemFile; - List directories = new List(); - foreach (FileInfo sourceFile in extractResults.Item3) - { - if (sourceFile.FullName != reportFullPath) - { - itemFile = sourceFile.FullName.Replace(from, to); - Shared1880(reportFullPath, itemFile, directories, sourceFile, isErrorFile); - } - else if (!isErrorFile && !(Logistics is null)) - Shared1811(to, sourceFile); - } - Shared0231(directories); - } - return results; - } - - private void WritePDSF(JsonElement jsonElement) - { - string directory; - string eventName = _ConfigData.GetEventName(); - string equipmentType = _ConfigData.GetEquipmentType(); - if (_ConfigData.EquipmentConnection is null || _ConfigData.EquipmentConnection.Value == _ConfigData.EquipmentType) - directory = Path.Combine(_ConfigData.TracePath, equipmentType, "Source", _ConfigData.CellName, _ConfigData.EquipmentElementName); - else - directory = Path.Combine(_ConfigData.VillachPath, equipmentType, "Target"); - if (!Directory.Exists(directory)) - Directory.CreateDirectory(directory); - string file = Path.Combine(directory, string.Concat(Logistics.MesEntity, "_", Logistics.Sequence, ".ipdsf")); - string lines = ProcessDataStandardFormat.GetPDSFText(this, eventName, equipmentType, jsonElement, logisticsText: string.Empty); - File.WriteAllText(file, lines); - if (Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) - { - try { File.SetLastWriteTime(file, Logistics.DateTimeFromSequence); } catch (Exception) { } - } - } - - private void Shared1277(string reportFullPath, string destinationDirectory, string logisticsSequence, string jobIdDirectory, string json) - { - string ecCharacterizationSi = Path.GetDirectoryName(Path.GetDirectoryName(jobIdDirectory)); - string destinationJobIdDirectory = string.Concat(ecCharacterizationSi, @"\Processed\", Logistics.JobID); - if (!Directory.Exists(destinationJobIdDirectory)) - Directory.CreateDirectory(destinationJobIdDirectory); - destinationJobIdDirectory = string.Concat(destinationJobIdDirectory, @"\", Path.GetFileName(destinationDirectory).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), DateTime.Now.Ticks - Logistics.Sequence); - string sequenceDirectory = string.Concat(destinationJobIdDirectory, @"\", logisticsSequence); - string jsonFileName = string.Concat(sequenceDirectory, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".json"); - Directory.Move(destinationDirectory, destinationJobIdDirectory); - if (!Directory.Exists(sequenceDirectory)) - Directory.CreateDirectory(sequenceDirectory); - File.Copy(reportFullPath, string.Concat(sequenceDirectory, @"\", Path.GetFileName(reportFullPath)), overwrite: true); - File.WriteAllText(jsonFileName, json); - } - - public void Shared1301(Dictionary fileParameter, FileConnectorConfiguration configuration) - { - if (fileParameter is null) - throw new Exception("File Parameter is null?"); - _FileParameter = fileParameter; - _LastReportFullPath = string.Empty; - _TargetFileLocationOkay = true; - _ErrorTargetFileLocationOkay = true; - _ConfigurationType = configuration.GetType(); - _OriginalSourceFileLocation = configuration.SourceFileLocation; - _OriginalTargetFileLocation = configuration.TargetFileLocation; - _OriginalTarget2FileLocation = GetTarget2FileLocation(); - _OriginalErrorTargetFileLocation = configuration.ErrorTargetFileLocation; - if (_TargetFileLocationOkay) { } - if (_ErrorTargetFileLocationOkay) { } - } - - private string[] Shared1567(string reportFullPath, List> tuples) - { - string[] results; - string historicalText; - string logisticsSequence = Logistics.Sequence.ToString(); - string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_Configuration.TargetFileLocation)), @"\", Logistics.JobID); - if (!Directory.Exists(jobIdDirectory)) - Directory.CreateDirectory(jobIdDirectory); - string[] matchDirectories; - if (!_ConfigData.EafHosted) - matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) }; - else - matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly); - if ((matchDirectories is null) || matchDirectories.Length != 1) - throw new Exception("Didn't find directory by logistics sequence"); - string fileName = Path.GetFileNameWithoutExtension(reportFullPath); - string sequenceDirectory = string.Concat(matchDirectories[0], @"\", logisticsSequence); - if (!Directory.Exists(sequenceDirectory)) - Directory.CreateDirectory(sequenceDirectory); - foreach (Tuple tuple in tuples) - { - fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); - if (_ConfigData.EafHosted) - File.WriteAllText(fileName, tuple.Item2); - else - { - historicalText = File.ReadAllText(fileName); - if (tuple.Item2 != historicalText) - throw new Exception("File doesn't match historical!"); - } - } - results = matchDirectories; - return results; - } - - public void Shared1811(string to, FileInfo sourceFile) - { - if (_ConfigData.Duplicator is null && _Configuration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < ConfigData.MinFileLength) - { - string directoryName = Path.GetFileName(to); - string jobIdDirectory = Path.GetDirectoryName(to); - CultureInfo cultureInfo = new CultureInfo("en-US"); - Calendar calendar = cultureInfo.Calendar; - DateTime dateTime = DateTime.Now.AddMinutes(-15); - string weekOfYear = calendar.GetWeekOfYear(Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); - string weekDirectory = string.Concat(Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); - string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); - if (!Directory.Exists(destinationDirectory)) - Directory.CreateDirectory(destinationDirectory); - File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); - try - { - string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly); - foreach (string checkDirectory in checkDirectories) - { - if (!checkDirectory.Contains("_")) - continue; - if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) - continue; - if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) - continue; - if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any()) - continue; - if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any()) - continue; - if (new DirectoryInfo(checkDirectory).CreationTime > dateTime) - continue; - Directory.Delete(checkDirectory, recursive: false); - } - } - catch (Exception) { throw; } - } - } - - private void Shared1872(string reportFullPath, Exception exception) - { - if (!string.IsNullOrEmpty(reportFullPath) && !(exception is null)) - { - if (!(_Configuration is null) && _ConfigData.Duplicator.HasValue) - try { File.WriteAllLines(string.Concat(_Configuration.ErrorTargetFileLocation, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".err"), new string[] { Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } catch (Exception) { } - if (!_ConfigData.IsSourceTimer && !_ConfigData.IsDatabaseExportToIPDSF) - { - string fileName = string.Concat(reportFullPath, ".IO"); - if (!(_Configuration is null) && _Configuration.PostProcessingMode == FileConnectorConfiguration.PostProcessingModeEnum.Copy) - try { File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } catch (Exception) { } - } - if (_ConfigData.EquipmentConnection.HasValue && _ConfigData.EquipmentConnection.Value != _ConfigData.EquipmentType) - { - if (!reportFullPath.EndsWith(".pdsf") && !reportFullPath.EndsWith(".ipdsf")) - { - string fileName = string.Concat(reportFullPath, ".IO"); - try { File.WriteAllLines(fileName, new string[] { _Configuration.TargetFileName, Logistics.Sequence.ToString(), exception.Message, string.Empty, string.Empty, exception.StackTrace }); } catch (Exception) { } - } - else - { - List debug = new List { "//Exception:" }; - if (!(Logistics is null) && !(Logistics.Tags is null)) - debug.AddRange(Logistics.Tags); - debug.Add(exception.Message); - debug.Add(exception.StackTrace); - try { File.AppendAllLines(reportFullPath, debug); } catch (Exception) { } - if (!(Logistics is null) && Logistics.DateTimeFromSequence != DateTime.MinValue && Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) - { - try { File.SetLastWriteTime(reportFullPath, Logistics.DateTimeFromSequence); } catch (Exception) { } - } - } - } - } - } - - public void Shared1880(string reportFullPath, string itemFile, List directories, FileInfo sourceFile, bool isErrorFile) - { - string itemDirectory; - directories.Add(Path.GetDirectoryName(sourceFile.FullName)); - itemDirectory = Path.GetDirectoryName(itemFile); - FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum; - if (!isErrorFile) - processingModeEnum = _Configuration.PostProcessingMode.Value; - else - processingModeEnum = _Configuration.ErrorPostProcessingMode.Value; - if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory)) - { - Directory.CreateDirectory(itemDirectory); - FileInfo fileInfo = new FileInfo(reportFullPath); - Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime); - } - if (_ConfigData.EafHosted) - { - 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(); - } - } - } - - public void WaitForThread(Thread thread, List threadExceptions) - { - if (!(thread is null)) - { - System.Threading.ThreadState threadState; - for (short i = 0; i < short.MaxValue; i++) - { - if (thread is null) - break; - else - { - threadState = thread.ThreadState; - if (threadState != System.Threading.ThreadState.Running && threadState != System.Threading.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; - } - } - } - } - - } - -} diff --git a/Adaptation/FileHandlers/IQSSi/FileRead.cs b/Adaptation/FileHandlers/IQSSi/FileRead.cs new file mode 100644 index 0000000..3bc5239 --- /dev/null +++ b/Adaptation/FileHandlers/IQSSi/FileRead.cs @@ -0,0 +1,145 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.IQSSi; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private void CopyFileAndWait(string reportFullPath) + { + long ticks = DateTime.Now.Ticks; + string parentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath))); + string jobIdDirectory = Path.Combine(parentDirectory, _Logistics.JobID); + string jobIdDirectoryFile = Path.Combine(jobIdDirectory, Path.GetFileName(reportFullPath)); + string errFile = string.Concat(jobIdDirectoryFile, ".err"); + if (!Directory.Exists(jobIdDirectory)) + _ = Directory.CreateDirectory(jobIdDirectory); + File.Copy(reportFullPath, jobIdDirectoryFile); + for (int i = 0; i < int.MaxValue; i++) + { + if (File.Exists(errFile)) + throw new Exception(File.ReadAllText(errFile)); + if (!File.Exists(jobIdDirectoryFile)) + break; + if (new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds > _BreakAfterSeconds) + throw new Exception($"Not all files were consumned after {_BreakAfterSeconds} second(s)!"); + } + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + CopyFileAndWait(reportFullPath); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/OpenInsight/FileRead.cs b/Adaptation/FileHandlers/OpenInsight/FileRead.cs new file mode 100644 index 0000000..c8c97d9 --- /dev/null +++ b/Adaptation/FileHandlers/OpenInsight/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.OpenInsight; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs new file mode 100644 index 0000000..663e8ba --- /dev/null +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewer/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs new file mode 100644 index 0000000..642d441 --- /dev/null +++ b/Adaptation/FileHandlers/OpenInsightMetrologyViewerAttachments/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.OpenInsightMetrologyViewerAttachments; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/Processed/FileRead.cs b/Adaptation/FileHandlers/Processed/FileRead.cs new file mode 100644 index 0000000..5bb60ca --- /dev/null +++ b/Adaptation/FileHandlers/Processed/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.Processed; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/FileHandlers/SPaCe/FileRead.cs b/Adaptation/FileHandlers/SPaCe/FileRead.cs new file mode 100644 index 0000000..017d2c6 --- /dev/null +++ b/Adaptation/FileHandlers/SPaCe/FileRead.cs @@ -0,0 +1,123 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Duplicator; +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace Adaptation.FileHandlers.SPaCe; + +public class FileRead : Shared.FileRead, IFileRead +{ + + public FileRead(ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) : + base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted) + { + _MinFileLength = 10; + _NullData = string.Empty; + _Logistics = new Logistics(this); + if (_FileParameter is null) + throw new Exception(cellInstanceConnectionName); + if (_ModelObjectParameterDefinitions is null) + throw new Exception(cellInstanceConnectionName); + if (!_IsDuplicator) + throw new Exception(cellInstanceConnectionName); + } + + void IFileRead.Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath)) + { + FileInfo fileInfo = new(_Logistics.ReportFullPath); + if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime) + File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime); + } + Move(extractResults, exception); + } + + void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null); + + string IFileRead.GetEventDescription() + { + string result = _Description.GetEventDescription(); + return result; + } + + List IFileRead.GetHeaderNames() + { + List results = _Description.GetHeaderNames(); + return results; + } + + string[] IFileRead.Move(Tuple> 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 IFileRead.GetDisplayNamesJsonElement() + { + Dictionary results = _Description.GetDisplayNamesJsonElement(this); + return results; + } + + List IFileRead.GetDescriptions(IFileRead fileRead, List tests, IProcessData processData) + { + List results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData); + return results; + } + + Tuple> IFileRead.GetExtractResult(string reportFullPath, string eventName) + { + Tuple> 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>(results.Item1, Array.Empty(), JsonSerializer.Deserialize("[]"), results.Item4); + if (results.Item3.Length > 0 && _IsEAFHosted) + WritePDSF(this, results.Item3); + UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks); + return results; + } + + Tuple> IFileRead.ReExtract() + { + Tuple> results; + List headerNames = _Description.GetHeaderNames(); + Dictionary keyValuePairs = _Description.GetDisplayNamesJsonElement(this); + results = ReExtract(this, headerNames, keyValuePairs); + return results; + } + + void IFileRead.CheckTests(Test[] tests, bool extra) + { + if (_Description is not Description) + throw new Exception(); + } + + private Tuple> GetExtractResult(string reportFullPath, DateTime dateTime) + { + if (dateTime == DateTime.MinValue) + { } + Tuple> results = new(string.Empty, null, null, new List()); + Tuple pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath); + _Logistics = new Logistics(reportFullPath, pdsf.Item1); + SetFileParameterLotIDToLogisticsMID(); + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/Helpers/ConfigData.Level.cs b/Adaptation/Helpers/ConfigData.Level.cs deleted file mode 100644 index 5798a64..0000000 --- a/Adaptation/Helpers/ConfigData.Level.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Adaptation.Helpers -{ - - public partial class ConfigData - { - public enum Level - { - IsXToIQS, - IsXToOpenInsight, - IsXToAPC, - IsXToSPaCe, - IsXToSPaCeVillach, - IsXToArchive, - IsArchive, - IsDummy - } - - } - -} diff --git a/Adaptation/Helpers/ConfigData.cs b/Adaptation/Helpers/ConfigData.cs deleted file mode 100644 index e88273a..0000000 --- a/Adaptation/Helpers/ConfigData.cs +++ /dev/null @@ -1,711 +0,0 @@ -using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; -using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using Infineon.Monitoring.MonA; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Globalization; -using System.IO; -using System.IO.Compression; -using System.Linq; -using System.Text.Json; -using System.Threading; - -namespace Adaptation.Helpers -{ - - public partial class ConfigData : ConfigDataBase - { - - internal class Reactor - { - public string Name { get; internal set; } - public string FilePrefix { get; internal set; } - } - - internal const object NullData = null; - internal const int MinFileLength = 100; - - public bool EC { get; private set; } - public string ApcPath { get; private set; } - public string EdaPath { get; private set; } - public string IqsFile { get; private set; } - public string IqsPath { get; private set; } - public string TracePath { get; private set; } - public Level? Duplicator { get; private set; } - public string IfxChannel { get; private set; } - public string IfxSubject { get; private set; } - public string IqsTempPath { get; private set; } - public string VillachPath { get; private set; } - public string LogisticPath { get; private set; } - public string ProgressPath { get; private set; } - public string IqsQueryFilter { get; private set; } - public string IfxSubjectPrefix { get; private set; } - public List MappedParts { get; private set; } - public string OpenInsightSiViewer { get; internal set; } - public string ArchiveSourceDirectory { get; private set; } - public string ConnectionStringIrmnSpc { get; private set; } - public string ConnectionStringG4Wafers { get; private set; } - public string IfxConfigurationLocation { get; private set; } - public List TransportSetupMessages { get; private set; } - public string IfxConfigurationLocationLocalCopy { get; private set; } - public static Dictionary> DummyRuns { get; private set; } - - private Timer _Timer; - private int _LastDummyRunIndex; - private readonly Calendar _Calendar; - private readonly string _ReportFullPath; - - public ConfigData(ILogic logic, string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, IList modelObjectParameterDefinitions, string parameterizedModelObjectDefinitionType, bool isEAFHosted) : - base(cellName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, isEAFHosted) - { - _LastDummyRunIndex = -1; - TransportSetupMessages = new List(); - CultureInfo cultureInfo = new CultureInfo("en-US"); - _Calendar = cultureInfo.Calendar; - string firstSourceFileFilter = fileConnectorConfiguration.SourceFileFilter.Split('|')[0]; - IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter == "*Timer.txt"); - if (DummyRuns is null) - DummyRuns = new Dictionary>(); - bool isDuplicator = cellInstanceConnectionName.StartsWith(cellName); - if (!isDuplicator) - Duplicator = null; - else - { - CellNames.Add(cellName, cellName); - MesEntities.Add(cellName, cellName); - int level = (cellInstanceConnectionName.Length - cellInstanceConnectionName.Replace("-", string.Empty).Length); - Duplicator = (Level)level; - } - if (isDuplicator) - ProcessDataDescription = new Duplicator.Description(); - else - ProcessDataDescription = new ProcessData.FileRead.Description(); - if (!isDuplicator) - { - //Verify(fileConnectorConfiguration, cellInstanceConnectionName); - if (!EafHosted) - VerifyProcessDataDescription(logic); - else - WriteExportAliases(logic, cellName, cellInstanceConnectionName); - } - MappedParts = new List(); - System.Net.NetworkInformation.IPGlobalProperties ipGlobalProperties = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties(); - EC = (ipGlobalProperties.DomainName.ToLower().Contains("ec.local")); - bool isMET08PRFUSB4000Villach = (equipmentElementName == string.Concat(EquipmentType.MET08PRFUSB4000, "_Villach")); - if (!modelObjectParameterDefinitions.Any()) - { - CellNames.Add(cellName, "****"); MesEntities.Add(cellName, "****"); - IfxChannel = string.Empty; - IfxSubjectPrefix = string.Empty; - IfxConfigurationLocation = string.Empty; - IfxConfigurationLocationLocalCopy = string.Empty; - IfxSubject = string.Empty; - ArchiveSourceDirectory = string.Empty; - ConnectionStringG4Wafers = string.Empty; - ConnectionStringIrmnSpc = string.Empty; - } - else - { - int index; - string key; - string variable = string.Empty; - Dictionary iqsSection = new Dictionary(); - Dictionary pathSection = new Dictionary(); - Dictionary tibcoSection = new Dictionary(); - Dictionary commonSection = new Dictionary(); - List> reactorTuples = new List>(); - Dictionary openInsightSection = new Dictionary(); - Dictionary connectionStringsSection = new Dictionary(); - Dictionary> reactorSection = new Dictionary>(); - foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in modelObjectParameterDefinitions) - { - if (!modelObjectParameterDefinition.Name.Contains('.')) - continue; - else if (modelObjectParameterDefinition.Name.StartsWith("Description.") && (modelObjectParameterDefinition.Name.EndsWith(".EventName") || modelObjectParameterDefinition.Name.EndsWith(".EquipmentType"))) - continue; - index = modelObjectParameterDefinition.Name.IndexOf("."); - if (index <= -1) - continue; - key = modelObjectParameterDefinition.Name.Substring(0, index); - variable = modelObjectParameterDefinition.Name.Substring(index + 1); - if (key == "COMMON") - commonSection.Add(variable, modelObjectParameterDefinition.Value); - else if (key == "CONNECTION STRINGS") - connectionStringsSection.Add(variable, modelObjectParameterDefinition.Value); - else if (key == "IQS") - iqsSection.Add(variable, modelObjectParameterDefinition.Value); - else if (key == "PATH") - pathSection.Add(variable, modelObjectParameterDefinition.Value); - else if (key == "REACTOR") - reactorTuples.Add(new Tuple(variable, modelObjectParameterDefinition.Value)); - else if (key == "TIBCO") - tibcoSection.Add(variable, modelObjectParameterDefinition.Value); - else if (key == "OpenInsight") - openInsightSection.Add(variable, modelObjectParameterDefinition.Value); - else - throw new Exception(); - } - foreach (Tuple tuple in reactorTuples) - { - if (!tuple.Item1.Contains('.')) - continue; - index = tuple.Item1.IndexOf("."); - if (index <= -1) - continue; - key = tuple.Item1.Substring(0, index); - variable = tuple.Item1.Substring(index + 1); - if (!reactorSection.ContainsKey(key)) - reactorSection.Add(key, new Dictionary() { { "NAME", key } }); - reactorSection[key].Add(variable, tuple.Item2); - } - if (!iqsSection.Any()) - throw new Exception("IQS section is missing from configuration"); - else - { - key = "PATH"; - if (iqsSection.ContainsKey(key)) - IqsPath = iqsSection[key]; - else - throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); - if (string.IsNullOrEmpty(IqsPath)) - throw new Exception(string.Format("IQS key {0} is empty", key)); - key = "FILE"; - if (iqsSection.ContainsKey(key)) - IqsFile = iqsSection[key]; - else - throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); - if (eventName.HasValue && eventName.Value == EventName.FileRead && string.IsNullOrEmpty(IqsFile)) - throw new Exception(string.Format("IQS key {0} is empty", key)); - key = "QUERY"; - if (iqsSection.ContainsKey(key)) - IqsQueryFilter = iqsSection[key]; - else - throw new Exception(string.Concat("Missing IQS Configuration entry for ", key)); - if (eventName.HasValue && eventName.Value == EventName.FileRead && string.IsNullOrEmpty(IqsQueryFilter)) - throw new Exception(string.Format("IQS key {0} is empty", key)); - } - if (!pathSection.Any()) - throw new Exception("Path section is missing from configuration"); - else - { - key = "TRACE"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - TracePath = pathSection[key]; - if (!string.IsNullOrEmpty(TracePath) && !Directory.Exists(TracePath)) - Directory.CreateDirectory(TracePath); - key = "LOGISTIC"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - LogisticPath = pathSection[key]; - if (!string.IsNullOrEmpty(LogisticPath) && !Directory.Exists(LogisticPath)) - Directory.CreateDirectory(LogisticPath); - key = "VILLACH"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - VillachPath = pathSection[key]; - if (!string.IsNullOrEmpty(VillachPath) && !Directory.Exists(VillachPath)) - Directory.CreateDirectory(VillachPath); - key = "IQS"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - IqsTempPath = pathSection[key]; - if (!string.IsNullOrEmpty(IqsTempPath) && !Directory.Exists(IqsTempPath)) - Directory.CreateDirectory(IqsTempPath); - key = "Progress"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - ProgressPath = pathSection[key]; - if (!string.IsNullOrEmpty(ProgressPath) && Directory.Exists(Path.GetPathRoot(ProgressPath)) && !Directory.Exists(ProgressPath)) - Directory.CreateDirectory(ProgressPath); - key = "EDA"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - EdaPath = pathSection[key]; - if (!string.IsNullOrEmpty(EdaPath) && !Directory.Exists(EdaPath)) - Directory.CreateDirectory(EdaPath); - key = "APC"; - if (pathSection.ContainsKey(key) && pathSection[key].StartsWith(@"\\")) - ApcPath = pathSection[key]; - if (!string.IsNullOrEmpty(ApcPath) && !Directory.Exists(ApcPath)) - Directory.CreateDirectory(ApcPath); - } - if (!commonSection.Any()) - throw new Exception("Common section is missing from configuration"); - else - { - if (isMET08PRFUSB4000Villach) - { - key = "MAPPED_PARTS"; - if (!commonSection.ContainsKey(key)) - throw new Exception("Mapped Parts KEY is missing from Equipment Type Configuration"); - else - { - string mappedParts = commonSection[key]; - if (mappedParts.Contains(',')) - MappedParts = mappedParts.Split(',').ToList(); - else - MappedParts = new string[] { mappedParts }.ToList(); - } - if (!MappedParts.Any()) - throw new Exception(string.Format("Common section key {0} is empty", key)); - key = "ARCHIVE_SOURCE_DIRECTORY"; - if (commonSection.ContainsKey(key)) - ArchiveSourceDirectory = commonSection[key]; - } - key = "CELL_NAMES"; - if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) - throw new Exception(); - else - { - string[] segments; - string[] cellNames = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - foreach (string item in cellNames) - { - segments = item.Split(':'); - CellNames.Add(segments[0].Trim(), segments[1].Trim()); - } - } - if (!string.IsNullOrEmpty(cellName) && !CellNames.ContainsKey(cellName)) - throw new Exception(); - key = "MES_ENTITIES"; - if (!commonSection.ContainsKey(key) || !commonSection[key].Contains(';') || !commonSection[key].Contains(':')) throw new Exception(); - else - { - string[] segments; - string[] mesEntity = commonSection[key].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); - foreach (string item in mesEntity) - { - segments = item.Split(':'); - MesEntities.Add(segments[0].Trim(), segments[1].Trim()); - } - } - if (!string.IsNullOrEmpty(cellName) && !MesEntities.ContainsKey(cellName)) - throw new Exception(); - } - if (isMET08PRFUSB4000Villach) - { - if (!tibcoSection.Any()) - throw new Exception("TIBCO section is missing from configuration"); - else - { - key = "IFX_CHANNEL"; - if (tibcoSection.ContainsKey(key)) - IfxChannel = tibcoSection[key]; - else - throw new Exception("IFX_CHANNEL is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(IfxChannel)) - throw new Exception(string.Format("TIBCO section key {0} is empty", key)); - key = "IFX_SUBJECT_PREFIX"; - if (tibcoSection.ContainsKey(key)) - IfxSubjectPrefix = tibcoSection[key]; - else - throw new Exception("IFX_SUBJECT_PREFIX is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(IfxSubjectPrefix)) - throw new Exception(string.Format("TIBCO section key {0} is empty", key)); - key = "IFX_CONFIGURATION_LOCATION"; - if (tibcoSection.ContainsKey(key)) - IfxConfigurationLocation = tibcoSection[key]; - else - throw new Exception("IFX_CONFIGURATION_LOCATION is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(IfxConfigurationLocation)) - throw new Exception(string.Format("TIBCO section key {0} is empty", key)); - key = "IFX_CONFIGURATION_LOCATION_LOCAL_COPY"; - if (tibcoSection.ContainsKey(key)) - IfxConfigurationLocationLocalCopy = tibcoSection[key]; - else - throw new Exception("IFX_CONFIGURATION_LOCATION_LOCAL_COPY is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(IfxConfigurationLocationLocalCopy)) - throw new Exception(string.Format("TIBCO section key {0} is empty", key)); - key = "IFX_SUBJECT"; - if (tibcoSection.ContainsKey(key)) - IfxSubject = tibcoSection[key]; - else - throw new Exception("IFX_SUBJECT KEY is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(IfxSubject)) - throw new Exception(string.Format("TIBCO section key {0} is empty", key)); - } - } - if (IsDatabaseExportToIPDSF || isMET08PRFUSB4000Villach) - { - if (!connectionStringsSection.Any()) - throw new Exception("Connection Strings section is missing from configuration"); - else - { - key = "G4WAFERS"; - if (connectionStringsSection.ContainsKey(key)) - ConnectionStringG4Wafers = connectionStringsSection[key]; - else - throw new Exception("G4WAFERS is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(ConnectionStringG4Wafers)) - throw new Exception(string.Format("Connection String key {0} is empty", key)); - key = "IRMNSPC"; - if (connectionStringsSection.ContainsKey(key)) - ConnectionStringIrmnSpc = connectionStringsSection[key]; - else - throw new Exception("IRMNSPC is missing from Equipment Type Configuration"); - if (string.IsNullOrEmpty(ConnectionStringIrmnSpc)) - throw new Exception(string.Format("IRMNSPC key {0} is empty", key)); - // - Si.SQLDatabase.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc); - Si.SQLDatabase.SetConnectionStringG4Wafers(ConnectionStringG4Wafers); - Si.EpiControlPlan.CPGet.Parameters.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc); - Si.EpiControlPlan.CPGet.Parameters.SetConnectionStringG4Wafers(ConnectionStringG4Wafers); - Si.EpiControlPlan.CPGet.PartHistory.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc); - Si.EpiControlPlan.CPGet.PartHistory.SetConnectionStringG4Wafers(ConnectionStringG4Wafers); - Si.EpiControlPlan.CPGet.PartParameters.SetConnectionStringIrmnSpc(ConnectionStringIrmnSpc); - Si.EpiControlPlan.CPGet.PartParameters.SetConnectionStringG4Wafers(ConnectionStringG4Wafers); - } - } - if (!openInsightSection.Any()) - throw new Exception("OpenInsight section is missing from configuration"); - else - { - key = "SiViewer"; - if (openInsightSection.ContainsKey(key)) - OpenInsightSiViewer = openInsightSection[key]; - if (string.IsNullOrEmpty(OpenInsightSiViewer)) - throw new Exception(string.Format("OpenInsight key {0} is empty", key)); - if (!OpenInsightSiViewer.Contains(":") || !OpenInsightSiViewer.Contains(".")) - throw new Exception(string.Format("OpenInsight key {0} is invalid", key)); - } - if (!MesEntities.Any()) - throw new Exception(); - if (isMET08PRFUSB4000Villach) - { - Si.Transport.Initialize(this); - if (!string.IsNullOrEmpty(fileConnectorConfiguration.SourceFileLocation)) - TransportSetupMessages = Si.Transport.Setup(useSleep: true, setIfxTransport: true, setParameters: true); - else - TransportSetupMessages = Si.Transport.Setup(useSleep: false, setIfxTransport: false, setParameters: false); - } - if (IsSourceTimer || IsDatabaseExportToIPDSF || (Duplicator.HasValue && Duplicator.Value == Level.IsDummy)) - { - if (!Directory.Exists(fileConnectorConfiguration.SourceFileLocation)) - Directory.CreateDirectory(fileConnectorConfiguration.SourceFileLocation); - _ReportFullPath = string.Concat(fileConnectorConfiguration.SourceFileLocation, firstSourceFileFilter.Replace("*", @"\")); - if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process) - Callback(null); - else - { - int milliSeconds; - milliSeconds = (int)((fileConnectorConfiguration.FileScanningIntervalInSeconds * 1000) / 2); - _Timer = new Timer(Callback, null, milliSeconds, Timeout.Infinite); milliSeconds += 2000; - } - } - } - } - - public void CheckProcessDataDescription(Dictionary> results, bool extra) - { - foreach (Test test in results.Keys) - { - if (test == Test) - { - if (!(ProcessDataDescription is ProcessData.FileRead.Description)) - ProcessDataDescription = new ProcessData.FileRead.Description(); - } - else - throw new Exception(); - } - } - - private void CallbackIsDummy(string traceDummyFile, List> tuples, bool fileConnectorConfigurationIncludeSubDirectories, bool includeSubDirectoriesExtra) - { - int fileCount; - string[] files; - string monARessource; - string checkDirectory; - string sourceArchiveFile; - string inProcessDirectory; - const string site = "sjc"; - const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; - MonIn monIn = MonIn.GetInstance(monInURL); - string stateName = string.Concat("Dummy_", _EventName); - foreach (Tuple item in tuples) - { - monARessource = item.Item1; - sourceArchiveFile = item.Item2; - inProcessDirectory = item.Item3; - checkDirectory = item.Item4; - fileCount = item.Item5; - try - { - if (fileCount > 0 || string.IsNullOrEmpty(checkDirectory)) - { - File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() }); - monIn.SendStatus(site, monARessource, stateName, State.Warning); - for (int i = 1; i < 12; i++) - Thread.Sleep(500); - } - else if (inProcessDirectory == checkDirectory) - continue; - if (!EafHosted) - continue; - if (!File.Exists(sourceArchiveFile)) - continue; - if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) - continue; - ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory); - if (fileConnectorConfigurationIncludeSubDirectories && includeSubDirectoriesExtra) - { - if (_EventName == EventName.FileRead) - checkDirectory = string.Concat(checkDirectory, @"\", sequence); - else if (_EventName == EventName.FileReadDaily) - checkDirectory = string.Concat(checkDirectory, @"\Source\", sequence); - else - throw new Exception(); - } - if (fileConnectorConfigurationIncludeSubDirectories) - files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories); - else - files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly); - if (files.Length > 250) - throw new Exception("Safety net!"); - foreach (string file in files) - File.SetLastWriteTime(file, new DateTime(sequence)); - if (!fileConnectorConfigurationIncludeSubDirectories) - { - foreach (string file in files) - File.Move(file, string.Concat(checkDirectory, @"\", Path.GetFileName(file))); - } - else - { - string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories); - foreach (string directory in directories) - Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length))); - foreach (string file in files) - File.Move(file, string.Concat(checkDirectory, file.Substring(inProcessDirectory.Length))); - } - File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() }); - monIn.SendStatus(site, monARessource, stateName, State.Ok); - } - catch (Exception exception) - { - File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace }); - monIn.SendStatus(site, monARessource, stateName, State.Critical); - try - { - Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); - Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); - smtp.Send(emailMessage); - } - catch (Exception) { } - } - } - } - - private void CallbackIsDummy() - { - DateTime dateTime = DateTime.Now; - bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday); - if (check) - { - int fileCount; - string[] files; - string monARessource; - string checkDirectory; - string sourceArchiveFile; - string sourceFileLocation; - string inProcessDirectory; - string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); - string traceDummyDirectory = string.Concat(Path.GetPathRoot(TracePath), @"\TracesDummy\", CellName, @"\Source\", dateTime.ToString("yyyy"), "___Week_", weekOfYear); - if (!Directory.Exists(traceDummyDirectory)) - Directory.CreateDirectory(traceDummyDirectory); - string traceDummyFile = string.Concat(traceDummyDirectory, @"\", dateTime.Ticks, " - ", CellName, ".txt"); - File.AppendAllText(traceDummyFile, string.Empty); - List> tuples = new List>(); - string progressDirectory = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\_ Progress")); - if (progressDirectory != ProgressPath || !Directory.Exists(progressDirectory)) - throw new Exception("Invalid progress path"); - foreach (var keyValuePair in CellNames) - { - monARessource = keyValuePair.Key; - if (!keyValuePair.Value.Contains(@"\")) - continue; - foreach (string sourceFileFilter in FileConnectorConfiguration.SourceFileFilter.Split('|')) - { - if (sourceFileFilter.ToLower().StartsWith(keyValuePair.Value.Replace(@"\", string.Empty))) - sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); - else if (FileConnectorConfiguration.SourceFileLocation.ToLower().EndsWith(keyValuePair.Value)) - sourceFileLocation = Path.GetFullPath(FileConnectorConfiguration.SourceFileLocation); - else - sourceFileLocation = Path.GetFullPath(string.Concat(FileConnectorConfiguration.SourceFileLocation, @"\", keyValuePair.Value)); - sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, @"\", sourceFileFilter)); - if (!File.Exists(sourceArchiveFile)) - continue; - if (!DummyRuns.ContainsKey(monARessource)) - DummyRuns.Add(monARessource, new List()); - tuples.Add(new Tuple(monARessource, sourceFileFilter, sourceFileLocation, sourceArchiveFile, 0)); - } - } - File.AppendAllLines(traceDummyFile, from l in tuples select l.Item4); - if (tuples.Any()) - { - _LastDummyRunIndex += 1; - if (_LastDummyRunIndex >= tuples.Count) - _LastDummyRunIndex = 0; - monARessource = tuples[_LastDummyRunIndex].Item1; - string sourceFileFilter = tuples[_LastDummyRunIndex].Item2; - sourceFileLocation = tuples[_LastDummyRunIndex].Item3; - sourceArchiveFile = tuples[_LastDummyRunIndex].Item4; - //fileCount = tuples[_LastDummyRunIndex].Item5; - tuples.Clear(); - if (long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence)) - { - if (!DummyRuns[monARessource].Contains(sequence)) - DummyRuns[monARessource].Add(sequence); - inProcessDirectory = string.Concat(progressDirectory, @"\Dummy_in process\", sequence); - checkDirectory = inProcessDirectory; - if (!Directory.Exists(checkDirectory)) - Directory.CreateDirectory(checkDirectory); - files = Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories); - fileCount = files.Length; - if (files.Any()) - { - if (files.Length > 250) - throw new Exception("Safety net!"); - try - { - foreach (string file in files) - File.Delete(file); - } - catch (Exception) { } - } - tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); - checkDirectory = sourceFileLocation; - files = Directory.GetFiles(checkDirectory, string.Concat("*", sequence, "*"), SearchOption.TopDirectoryOnly); - fileCount = files.Length; - tuples.Add(new Tuple(monARessource, sourceArchiveFile, inProcessDirectory, checkDirectory, fileCount)); - } - } - if (tuples.Any()) - CallbackIsDummy(traceDummyFile, tuples, FileConnectorConfiguration.IncludeSubDirectories.Value, includeSubDirectoriesExtra: false); - } - } - - private void Callback(object state) - { - try - { - if (Duplicator is null) - { - if (File.Exists(_ReportFullPath)) - File.Delete(_ReportFullPath); - File.WriteAllText(_ReportFullPath, string.Empty); - } - else if (Duplicator.Value == Level.IsDummy) - CallbackIsDummy(); - else - throw new Exception(); - } - catch (Exception exception) - { - try - { - Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); - Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); - smtp.Send(emailMessage); - } - catch (Exception) { } - } - try - { - TimeSpan timeSpan; - if (IsDatabaseExportToIPDSF) - timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks); - else if (IsSourceTimer) - timeSpan = new TimeSpan(DateTime.Now.AddMinutes(15).Ticks - DateTime.Now.Ticks); - else if (Duplicator.HasValue && Duplicator.Value == Level.IsDummy) - timeSpan = new TimeSpan(DateTime.Now.AddSeconds(FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks); - else if (Duplicator.HasValue) - timeSpan = new TimeSpan(DateTime.Now.AddSeconds(30).Ticks - DateTime.Now.Ticks); - else - timeSpan = new TimeSpan(DateTime.Now.AddDays(.5).Ticks - DateTime.Now.Ticks); - if (!(_Timer is null)) - _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite); - else - _Timer = new Timer(Callback, null, (long)timeSpan.TotalMilliseconds, Timeout.Infinite); - } - catch (Exception exception) - { - try - { - Eaf.Core.Smtp.ISmtp smtp = Eaf.Core.Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); - Eaf.Core.Smtp.EmailMessage emailMessage = new Eaf.Core.Smtp.EmailMessage(string.Concat("Exception:", EquipmentElementName), string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace), Eaf.Core.Smtp.MailPriority.High); - smtp.Send(emailMessage); - } - catch (Exception) { } - } - } - - public Tuple> IsManualOIEntry(string reportFullPath) - { - Tuple> results; - string monARessource; - const string site = "sjc"; - string equipment = string.Empty; - string description = string.Empty; - string stateName = "MANUAL_OI_ENTRY"; - string json = File.ReadAllText(reportFullPath); - JsonElement jsonElement = JsonSerializer.Deserialize(json); - results = new Tuple>(string.Empty, jsonElement, new List()); - foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) - { - if (jsonProperty.Name == "Equipment") - equipment = jsonProperty.Value.ToString(); - else if (jsonProperty.Name == "Description") - description = jsonProperty.Value.ToString(); - } - if (string.IsNullOrEmpty(equipment)) - monARessource = CellName; - else - monARessource = equipment; - const string monInURL = "http://moninhttp.sjc.infineon.com/input/text"; - MonIn monIn = MonIn.GetInstance(monInURL); - if (EafHosted) - monIn.SendStatus(site, monARessource, stateName, State.Warning, description); - return results; - } - - private void Archive(string sourceFileLocation, string sourceFileFilter, Calendar calendar, string directoryName, string newDirectoryName, int minFiles) - { - string newDirectroyRoot = sourceFileLocation.Replace(directoryName, newDirectoryName); - if (!Directory.Exists(newDirectroyRoot)) - Directory.CreateDirectory(newDirectroyRoot); - if (Directory.Exists(sourceFileLocation)) - { - string[] files = Directory.GetFiles(sourceFileLocation, sourceFileFilter, SearchOption.TopDirectoryOnly); - if (files.Length > minFiles) - { - string newFile; - string weekOfYear; - DateTime dateTime; - string newDirectroy; - DateTime creationTime; - DateTime lastWriteTime; - for (int i = 1; i < 50; i++) - Thread.Sleep(500); - foreach (var file in files) - { - creationTime = new FileInfo(file).CreationTime; - lastWriteTime = new FileInfo(file).LastWriteTime; - if (creationTime < lastWriteTime) - dateTime = creationTime; - else - dateTime = lastWriteTime; - weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); - newDirectroy = string.Concat(newDirectroyRoot, @"\", dateTime.ToString("yyyy"), "___Week_", weekOfYear); - if (!Directory.Exists(newDirectroy)) - Directory.CreateDirectory(newDirectroy); - newFile = string.Concat(newDirectroy, @"\", Path.GetFileName(file)); - if (File.Exists(newFile)) - File.Delete(newFile); - try { File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file))); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); } - try { Directory.SetLastWriteTime(newDirectroy, dateTime); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); } - } - try { Directory.SetLastWriteTime(sourceFileLocation, DateTime.Now); } catch (Exception e) { Print(string.Concat(e.Message, Environment.NewLine, Environment.NewLine, e.StackTrace)); } - } - } - } - - } - -} diff --git a/Adaptation/Helpers/ProcessData.cs b/Adaptation/Helpers/ProcessData.cs deleted file mode 100644 index 2948828..0000000 --- a/Adaptation/Helpers/ProcessData.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using log4net; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; - -namespace Adaptation.Helpers -{ - - public partial class ProcessData : IProcessData - { - - public class DiffusionLengthDetail - { - - public string Reactor { get; set; } - public string Employee { get; set; } - public string Recipe { get; set; } - public string Slot { get; set; } - public string DiffusionLength { get; set; } - public string DiffusionLengthStandardDeviation { get; set; } - - } - - private readonly ILog _Log; - public List Details { get; private set; } - - public ProcessData(ILogic logic, ConfigData configData, List fileInfoCollection, string lot, string pocketNumber) - { - _Log = LogManager.GetLogger(typeof(ProcessData)); - Details = new List(); - DiffusionLengthDetail diffusionLengthDetail; - var data = ProcessDataStandardFormat.GetProcessDataStandardFormat(logic.Logistics.ReportFullPath); - Dictionary>> item2 = data.Item2; - if (item2.Any()) - { - Dictionary> keyValuePairs = item2.ElementAt(0).Value; - int count = keyValuePairs[Column.Time.ToString()].Count; - if (count > 0) - { - string key; - string carrier; - string[] segments; - string logistics = data.Item1; - key = "CARRIER="; - if (!logistics.Contains(key)) - carrier = string.Empty; - else - { - segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - carrier = segments[1].Split(';')[0]; - } - string mid; - key = "MID="; - if (!logistics.Contains(key)) - mid = string.Empty; - else - { - segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - mid = segments[1].Split(';')[0]; - } - string ppid; - key = "PPID="; - if (!logistics.Contains(key)) - ppid = string.Empty; - else - { - segments = logistics.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - ppid = segments[1].Split(';')[0]; - } - for (int i = 0; i < count; i++) - { - diffusionLengthDetail = new DiffusionLengthDetail - { - Reactor = string.Empty, - Employee = "AUTO", - Recipe = ppid, - Slot = keyValuePairs["SlotNumber"][i], - DiffusionLength = keyValuePairs["WW_SPV_DL_LBEF_AVG"][i], - DiffusionLengthStandardDeviation = keyValuePairs["WW_SPV_DL_LBEF_STD"][i] - }; - if (!string.IsNullOrEmpty(mid)) - diffusionLengthDetail.Reactor = mid.Substring(0, 3); - Details.Add(diffusionLengthDetail); - } - } - } - } - - public Tuple> GetResults(ILogic logic, ConfigDataBase configDataBase, List fileInfoCollection) - { - Tuple> results; - if (!(configDataBase is ConfigData configData)) - throw new Exception(); - List tests = new List(); - List descriptions; - EventName eventName = configData.GetEventNameValue(); - if (eventName == EventName.FileRead && Details.Any()) - { - foreach (var item in Details) - tests.Add(Test); - descriptions = configData.GetDescription(logic, tests, this); - } - else - throw new Exception(); - if (!configData.EafHosted) - new FileRead.Description().GetDescription(logic, configData, tests, this); - if (tests.Count != descriptions.Count) - throw new Exception(); - for (int i = 0; i < tests.Count; i++) - { - if (descriptions[i].Test != (int)tests[i]) - throw new Exception(); - } - string json; - if (descriptions[0] is Duplicator.Description) - { - List duplicatorDescriptions = (from l in descriptions select (Duplicator.Description)l).ToList(); - json = JsonSerializer.Serialize(duplicatorDescriptions, duplicatorDescriptions.GetType()); - } - else if (descriptions[0] is FileRead.Description) - { - List fileReadDescriptions = (from l in descriptions select (FileRead.Description)l).ToList(); - json = JsonSerializer.Serialize(fileReadDescriptions, fileReadDescriptions.GetType()); - } - else - throw new Exception(); - object @object = JsonSerializer.Deserialize(json); - if (!(@object is JsonElement jsonElement)) - throw new Exception(); - results = new Tuple>(logic.Logistics.Logistics1[0], jsonElement, fileInfoCollection); - return results; - } - - public static Dictionary> GetKeyValuePairs(ConfigData configData, JsonElement jsonElement, List processDataDescriptions, bool extra = false) - { - Dictionary> results = configData.GetKeyValuePairs(processDataDescriptions); - configData.CheckProcessDataDescription(results, extra); - return results; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/EpiControlPlan.cs b/Adaptation/Helpers/Si/EpiControlPlan.cs deleted file mode 100644 index cfd198e..0000000 --- a/Adaptation/Helpers/Si/EpiControlPlan.cs +++ /dev/null @@ -1,1237 +0,0 @@ -using System.Collections.Generic; -using System.Data.SqlClient; -using System.Text; - -namespace Adaptation.EpiControlPlan -{ - - - namespace CPGet - { - - public class PartParamListFromHist - { - - public object Part { get; set; } - - public PartParamListFromHist(SqlDataReader sqlReader) - { - Part = sqlReader.GetSqlValue(0); - } - - public static List GetPartParamListFromHist(string connectionString) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" DISTINCT part "). - Append(" FROM ControlPlans.dbo.[Part_Parameter_Hist] "). - Append(" ORDER BY part "); - return GetPartParamListFromHist(connectionString, sql); - } - - private static List GetPartParamListFromHist(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new PartParamListFromHist(sqlReader)); - } - } - } - return results; - } - - } - - public class PartParametersFromHist - { - - public object Part { get; set; } - public object Parameter { get; set; } - public object Lsl { get; set; } - public object Lcl { get; set; } - public object Target { get; set; } - public object Ucl { get; set; } - public object Usl { get; set; } - public object Crit_to_ship { get; set; } - public object Reference_doc { get; set; } - public object Comment { get; set; } - public object Customer_spec { get; set; } - public object Stamp { get; set; } - public object Engineer_signoff { get; set; } - public object Manager_signoff { get; set; } - public object Quality_signoff { get; set; } - - public PartParametersFromHist(SqlDataReader sqlReader) - { - Part = sqlReader.GetSqlValue(0); - Parameter = sqlReader.GetSqlValue(1); - Lsl = sqlReader.GetSqlValue(2); - Lcl = sqlReader.GetSqlValue(3); - Target = sqlReader.GetSqlValue(4); - Ucl = sqlReader.GetSqlValue(5); - Usl = sqlReader.GetSqlValue(6); - Crit_to_ship = sqlReader.GetSqlValue(7); - Reference_doc = sqlReader.GetSqlValue(8); - Comment = sqlReader.GetSqlValue(9); - Customer_spec = sqlReader.GetSqlValue(10); - Stamp = sqlReader.GetSqlValue(11); - Engineer_signoff = sqlReader.GetSqlValue(12); - Manager_signoff = sqlReader.GetSqlValue(13); - Quality_signoff = sqlReader.GetSqlValue(14); - } - - public static List GetPartParametersFromHist(string connectionString, string partNumber) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" part, parameter, lsl, lcl, target, ucl, usl, crit_to_ship, reference_doc, comment, customer_spec, stamp, engineer_signoff, manager_signoff, quality_signoff "). - Append(" FROM ControlPlans.dbo.[Part_Parameter_Hist] "). - Append(" WHERE part= '$partNumber$' "). - Append(" /* WHERE part= '1208B' Example */ "). - Append(" ORDER BY stamp "); - sql.Replace("$partNumber$", partNumber); - return GetPartParametersFromHist(connectionString, sql); - } - - private static List GetPartParametersFromHist(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new PartParametersFromHist(sqlReader)); - } - } - } - return results; - } - - } - - public class PartParameters - { - - public object Part { get; set; } - public object Enum { get; set; } - public object Parameter { get; set; } - public object Lsl { get; set; } - public object Lcl { get; set; } - public object Target { get; set; } - public object Ucl { get; set; } - public object Usl { get; set; } - public object Crit_to_ship { get; set; } - public object Reference_doc { get; set; } - public object Comment { get; set; } - public object Customer_spec { get; set; } - - private static string _ConnectionStringIrmnSpc; - private static string _ConnectionStringG4Wafers; - - public static void SetConnectionStringIrmnSpc(string connectionString) - { - _ConnectionStringIrmnSpc = connectionString; - } - - public static void SetConnectionStringG4Wafers(string connectionString) - { - _ConnectionStringG4Wafers = connectionString; - } - - public PartParameters(SqlDataReader sqlReader) - { - Part = sqlReader.GetSqlValue(0); - Enum = sqlReader.GetSqlValue(1); - Parameter = sqlReader.GetSqlValue(2); - Lsl = sqlReader.GetSqlValue(3); - Lcl = sqlReader.GetSqlValue(4); - Target = sqlReader.GetSqlValue(5); - Ucl = sqlReader.GetSqlValue(6); - Usl = sqlReader.GetSqlValue(7); - Crit_to_ship = sqlReader.GetSqlValue(8); - Reference_doc = sqlReader.GetSqlValue(9); - Comment = sqlReader.GetSqlValue(10); - Customer_spec = sqlReader.GetSqlValue(11); - } - public static List GetPartParameters(string partNumber) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" select "). - Append(" p.part, a.enum, p.parameter, p.lsl, p.lcl, p.target, p.ucl, p.usl, p.crit_to_ship, p.reference_doc, p.comment, p.customer_spec "). - Append(" from ( "). - Append(" select 'Code' enum, 'ControlPlan' control_plan union all "). - Append(" select 'AFM_Pit_Count', 'AFM Pit Count' union all "). - Append(" select 'AFM_Roughness', 'Roughness' union all "). - Append(" select 'Al', 'Al' union all "). - Append(" select 'Al_B_B_', 'Al% B.B.' union all "). - Append(" select 'Al_B_B_WTAVG', 'BB composition' union all "). - Append(" select 'Al_Barrier', 'Al% Barrier' union all "). - Append(" select 'Al_Barrier_WTAVG', 'Al% Barrier WTAVG' union all "). - Append(" select 'Al_SLS', 'Al% SLS' union all "). - Append(" select 'Al_SLS_WTAVG', 'SLS composition' union all "). - Append(" select 'Al_TL1', 'Al% TL1' union all "). - Append(" select 'Al_TL1_WTAVG', 'Al% TL1 WTAVG' union all "). - Append(" select 'Al_TL2_WTAVG', 'Al% TL2 WTAVG' union all "). - Append(" select 'As', 'As' union all "). - Append(" select 'Au', 'Au' union all "). - Append(" select 'B', 'B' union all "). - Append(" select 'Ba', 'Ba' union all "). - Append(" select 'BandEdge_V', 'BandEdge_V' union all "). - Append(" select 'BandEdge_V_XY', 'BandEdge_V_XY' union all "). - Append(" select 'BandEdge_nm', 'BandEdge_nm' union all "). - Append(" select 'Barrier_Composition_RPM_XY', 'Barrier Composition' union all "). - Append(" select 'Bow', 'Bow' union all "). - Append(" select 'BowCenter', 'Bow Center' union all "). - Append(" select 'BowX', 'BowX' union all "). - Append(" select 'BowY', 'BowY' union all "). - Append(" select 'Bow_Calibration', 'Bow Calibration' union all "). - Append(" select 'Bow_Range', 'Bow Range' union all "). - Append(" select 'Breakdown_Voltage', 'BV Center' union all "). - Append(" select 'Breakdown_VoltageMiddle', 'BV Middle' union all "). - Append(" select 'Breakdown_Voltage_Edge', 'BV Edge' union all "). - Append(" select 'CV_C_at_10V', 'CV C at -10V' union all "). - Append(" select 'CV_Nd_Min', 'CV Nd Min' union all "). - Append(" select 'Ca', 'Ca' union all "). - Append(" select 'Candela_102_83nm', '102-83nm' union all "). - Append(" select 'Candela_1_1um', '1.1um' union all "). - Append(" select 'Candela_496nm', '496nm' union all "). - Append(" select 'Candela_600nm', '600nm' union all "). - Append(" select 'Candela_8620_Small', '8620 Small' union all "). - Append(" select 'Candela_Crack_Verification', 'Crack Verification' union all "). - Append(" select 'Candela_Cracking', 'Cracks' union all "). - Append(" select 'Candela_Cracking_Acceptable', 'Cracking Acceptable' union all "). - Append(" select 'Candela_Crater', 'Crater' union all "). - Append(" select 'Candela_Crater_Verification', 'Crater verification' union all "). - Append(" select 'Candela_Haze', 'Haze' union all "). - Append(" select 'Candela_LPD_Large', 'LPD-large' union all "). - Append(" select 'Candela_LPD_Medium', 'LPD-medium' union all "). - Append(" select 'Candela_LPD_Small', 'Light point defect (LPD) -small' union all "). - Append(" select 'Candela_Large_Verification', 'Large Verification' union all "). - Append(" select 'Candela_Medium_Verification', 'Medium Verification' union all "). - Append(" select 'Candela_Pits', 'Pits' union all "). - Append(" select 'Candela_Pits_Verification', 'Pits verification' union all "). - Append(" select 'Candela_SPE', 'SPE' union all "). - Append(" select 'Candela_SPE_Verification', 'SPE verification' union all "). - Append(" select 'Candela_Slip', 'Slip' union all "). - Append(" select 'Candela_Small_Verification', 'Small Verification' union all "). - Append(" select 'Candela_Spirals', 'Spirals' union all "). - Append(" select 'Candela_Total_Defects', 'Candela Total Defects' union all "). - Append(" select 'Candela__1_1um', '>1.1um' union all "). - Append(" select 'Ce', 'Ce' union all "). - Append(" select 'Co', 'Co' union all "). - Append(" select 'Contact_Symmetry', 'Contact Symmetry' union all "). - Append(" select 'Cr', 'Cr' union all "). - Append(" select 'Cu', 'Cu' union all "). - Append(" select 'Date', 'Date' union all "). - Append(" select 'Denton_Crystal_Life', 'Denton_Crystal_Life' union all "). - Append(" select 'Denton_Current_AVG', 'Denton_Current_AVG' union all "). - Append(" select 'Denton_Current_STDEV', 'Denton_Current_STDEV' union all "). - Append(" select 'Denton_Deposition_Power_AVG', 'Denton_Deposition_Power_AVG' union all "). - Append(" select 'Denton_Deposition_Power_STDEV', 'Denton_Deposition_Power_STDEV' union all "). - Append(" select 'Denton_Deposition_Rate_AVG', 'Denton_Deposition_Rate_AVG' union all "). - Append(" select 'Denton_Deposition_Rate_STDEV', 'Denton_Deposition_Rate_STDEV' union all "). - Append(" select 'Denton_Gun_Pocket', 'Denton_Gun_Pocket' union all "). - Append(" select 'Denton_Pumpdown_Time', 'Denton_Pumpdown_Time' union all "). - Append(" select 'Denton_Voltage_AVG', 'Denton_Voltage_AVG' union all "). - Append(" select 'Denton_Voltage_STDEV', 'Denton_Voltage_STDEV' union all "). - Append(" select 'Employee', 'Employee' union all "). - Append(" select 'Epi_Thickness_Mean', 'Epi thickness' union all "). - Append(" select 'Epi_Thickness_Mean_XY', 'Epi Thickness Mean_XY' union all "). - Append(" select 'Epi_Thickness_Std_Dev_', 'Epi thickness uniformity' union all "). - Append(" select 'FWHM_006', 'FWHM 006' union all "). - Append(" select 'FWHM_006_WTAVG', 'FWHM 006 WTAVG' union all "). - Append(" select 'FWHM_105', 'FWHM 105' union all "). - Append(" select 'FWHM_105_WTAVG', 'FWHM 105 WTAVG' union all "). - Append(" select 'Fe', 'Fe' union all "). - Append(" select 'Ga', 'Ga' union all "). - Append(" select 'Ge', 'Ge' union all "). - Append(" select 'Hall_Mobility_verif_sample', 'Hall_Mobility_verif_sample' union all "). - Append(" select 'Hall_Ns_verif_sample', 'Hall_Ns_verif_sample' union all "). - Append(" select 'Hall_Rs', 'RS' union all "). - Append(" select 'Hall_Rs_verif_sample', 'Hall_Rs_verif_sample' union all "). - Append(" select 'Hf', 'Hf' union all "). - Append(" select 'Job', 'Job' union all "). - Append(" select 'K', 'K' union all "). - Append(" select 'LEI_RS_Average_value', 'LEI RS Average value' union all "). - Append(" select 'LEI_RS_Maximum_value', 'LEI RS Maximum value' union all "). - Append(" select 'LEI_RS_Minimum_value', 'LEI RS Minimum value' union all "). - Append(" select 'LEI_RS_STDEV', 'LEI RS STDEV' union all "). - Append(" select 'LEI_RS_STDEV_', 'LEI RS STDEV%' union all "). - Append(" select 'Li', 'Li' union all "). - Append(" select 'Lot', 'Lot' union all "). - Append(" select 'Mg', 'Mg' union all "). - Append(" select 'Mn', 'Mn' union all "). - Append(" select 'Mo', 'Mo' union all "). - Append(" select 'Mobility', 'Mobility' union all "). - Append(" select 'Mobility_Verification', 'Mobility Verification' union all "). - Append(" select 'Na', 'Na' union all "). - Append(" select 'Ni', 'Ni' union all "). - Append(" select 'Ns_Verification', 'Ns Verification' union all "). - Append(" select 'P', 'P' union all "). - Append(" select 'PL_Edge_Wavelength', 'PL Edge Wavelength' union all "). - Append(" select 'PL_Ratio', 'PL Ratio' union all "). - Append(" select 'PR_Barrier_Composition', 'PR Barrier Composition' union all "). - Append(" select 'PR_Peak', 'PR Peak' union all "). - Append(" select 'Part', 'Part' union all "). - Append(" select 'Pb', 'Pb' union all "). - Append(" select 'Process', 'Process' union all "). - Append(" select 'Recipe', 'Recipe' union all "). - Append(" select 'Rs_verif_100kohm', 'Rs_verif_100kohm' union all "). - Append(" select 'Rs_verif_10ohm', 'Rs_verif_10ohm' union all "). - Append(" select 'Rs_verif_1kohm', 'Rs_verif_1kohm' union all "). - Append(" select 'Rs_verification', 'Rs verification' union all "). - Append(" select 'SID', 'SID' union all "). - Append(" select 'SL_Period', 'SL Period' union all "). - Append(" select 'SL_Period_WTAVG', 'SL Period' union all "). - Append(" select 'Sheet_Concentration', 'Sheet Concentration' union all "). - Append(" select 'Sn', 'Sn' union all "). - Append(" select 'Ta', 'Ta' union all "). - Append(" select 'Ti', 'Ti' union all "). - Append(" select 'Time', 'Time' union all "). - Append(" select 'Tool_ID', 'Tool ID' union all "). - Append(" select 'Total_Warp_Calibration', 'Total Warp Calibration' union all "). - Append(" select 'UV_Broken', 'Broken' union all "). - Append(" select 'UV_Chipping', 'Chipping' union all "). - Append(" select 'UV_Cracking_0_3mm_', 'UV Cracking (0-3mm)' union all "). - Append(" select 'UV_Cracking_3_7mm_', 'Cracking (3-7mm)' union all "). - Append(" select 'UV_Cracking_7mm_', 'Cracking (>7mm)' union all "). - Append(" select 'UV_Crazing', 'UV Crazing' union all "). - Append(" select 'UV_Crazing_Acceptable', 'UV Crazing Acceptable' union all "). - Append(" select 'UV_FULL_Characterization_Wafer', 'UV FULL Characterization Wafer' union all "). - Append(" select 'UV_Haze_count_', 'UV Haze (count)' union all "). - Append(" select 'UV_LIGHT_Characterization_Wafer', 'UV LIGHT Characterization Wafer' union all "). - Append(" select 'UV_Non_rotation', 'Non-rotation' union all "). - Append(" select 'UV_Other', 'UV Other' union all "). - Append(" select 'UV_SPE_1mm_count', 'SPE (>1mm) count' union all "). - Append(" select 'UV_SPE_count_', 'UV-SPE (count)' union all "). - Append(" select 'UV_Scratch_count_', 'Scratch (count)' union all "). - Append(" select 'UV_Slip_count_', 'UV Slip (count)' union all "). - Append(" select 'UV_True_Haze', 'UV True Haze' union all "). - Append(" select 'UV_True_Haze_Acceptable', 'UV True Haze Acceptable' union all "). - Append(" select 'Verification_Contact_Symmetry', 'Verification Contact Symmetry' union all "). - Append(" select 'Vp_Pinch_Off_Voltage', 'Vp Pinch Off Voltage' union all "). - Append(" select 'W', 'W' union all "). - Append(" select 'WaferPocket_Candela', 'WaferPocket_Candela' union all "). - Append(" select 'WaferPocket_Warp', 'WaferPocket_Warp' union all "). - Append(" select 'WaferPosition_BV', 'WaferPosition_BV' union all "). - Append(" select 'WaferPosition_CV', 'WaferPosition_CV' union all "). - Append(" select 'WaferPosition_Hall', 'WaferPosition_Hall' union all "). - Append(" select 'WaferPosition_PR', 'WaferPosition_PR' union all "). - Append(" select 'Wafer_ID', 'Wafer ID' union all "). - Append(" select 'Wafer_Region', 'Wafer Region' union all "). - Append(" select 'Wafer_Scribe', 'Wafer Scribe' union all "). - Append(" select 'Warp', 'Warp' union all "). - Append(" select 'XRD_2_Theta_Peak_002', 'XRD 2 Theta Peak 002' union all "). - Append(" select 'XRD_2_Theta_Peak_101', 'XRD 2 Theta Peak 101' union all "). - Append(" select 'XRD_2_Theta_Position', 'XRD 2-Theta Position' union all "). - Append(" select 'XRD_2_Theta_Position_Si_1', 'XRD 2-Theta Position Si 1' union all "). - Append(" select 'XRD_2_Theta_Position_Si_2', 'XRD 2-Theta Position Si 2' union all "). - Append(" select 'XRD_2_Theta_Position_Si_3', 'XRD 2-Theta Position Si 3' union all "). - Append(" select 'XRD_Peak_002_Intensity', 'XRD Peak 002 Intensity' union all "). - Append(" select 'XRD_Peak_101_Intensity', 'XRD Peak 101 Intensity' union all "). - Append(" select 'XRD_Weekly_AL_Center', 'XRD Weekly AL% Center' union all "). - Append(" select 'XRD_Weekly_Back_Barrier_Al_', 'Back Barrier Al%' union all "). - Append(" select 'XRD_Weekly_Barrier_Al_', 'Barrier Al%' union all "). - Append(" select 'XRD_Weekly_FWHM_002', 'XRD Weekly FWHM 002' union all "). - Append(" select 'XRD_Weekly_FWHM_101', 'XRD Weekly FWHM 101' union all "). - Append(" select 'XRD_Weekly_FWHM_105', 'XRD Weekly FWHM 105' union all "). - Append(" select 'XRD_Weekly_Fringe_thick_0_0_', 'XRD Weekly Fringe thick (00)' union all "). - Append(" select 'XRD_Weekly_Fringe_thick_48_48_', 'XRD Weekly Fringe thick (4848)' union all "). - Append(" select 'XRD_Weekly_Super_Lattice_Al_', 'Super Lattice Al%' union all "). - Append(" select 'XRD_Weekly_Super_Lattice_period', 'Super Lattice period' union all "). - Append(" select 'XRD_Weekly_Super_Lattice_tks', 'Super Lattice tks' union all "). - Append(" select 'XRR_Thickness_nm_', 'XRR Thickness (nm)' union all "). - Append(" select 'XRR_Thickness_nm_WTAVG', 'Barrier Thickness XRR' union all "). - Append(" select 'X_Coord', 'X-Coord' union all "). - Append(" select 'Y', 'Y' union all "). - Append(" select 'Y_Coord', 'Y-Coord' union all "). - Append(" select 'YellowBand_Power_mW_', 'YellowBand_Power (mW)' union all "). - Append(" select 'YellowBand_V', 'YellowBand_V' union all "). - Append(" select 'YellowBand_V_XY', 'YellowBand_V_XY' union all "). - Append(" select 'YellowBand_nm', 'YellowBand_nm' union all "). - Append(" select 'Zn', 'Zn' "). - Append(" ) as a "). - Append(" join ControlPlans.dbo.[Part_Parameter] p "). - Append(" on p.parameter = a.control_plan "). - Append(" where p.part= '$partNumber$' "). - Append(" order by p.parameter "); - sql.Replace("$partNumber$", partNumber); - return GetPartParameters(_ConnectionStringIrmnSpc, sql); - } - - private static List GetPartParameters(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new PartParameters(sqlReader)); - } - } - } - return results; - } - - } - - public class Part - { - - public object Generation { get; set; } - public object Tr_status { get; set; } - public object Essential_part_number { get; set; } - public object Part_number_description { get; set; } - public object Irmn_part_number { get; set; } - public object Spec_version { get; set; } - public object Spec_version_effective_date { get; set; } - public object Engr_status { get; set; } - public object Qual_status { get; set; } - public object Prod_status { get; set; } - public object Process_flow { get; set; } - public object Wafer_thickness { get; set; } - public object Wafer_spec { get; set; } - public object Comment { get; set; } - public object Number_wafers { get; set; } - - public Part(SqlDataReader sqlReader) - { - Generation = sqlReader.GetSqlValue(0); - Tr_status = sqlReader.GetSqlValue(1); - Essential_part_number = sqlReader.GetSqlValue(2); - Part_number_description = sqlReader.GetSqlValue(3); - Irmn_part_number = sqlReader.GetSqlValue(4); - Spec_version = sqlReader.GetSqlValue(5); - Spec_version_effective_date = sqlReader.GetSqlValue(6); - Engr_status = sqlReader.GetSqlValue(7); - Qual_status = sqlReader.GetSqlValue(8); - Prod_status = sqlReader.GetSqlValue(9); - Process_flow = sqlReader.GetSqlValue(10); - Wafer_thickness = sqlReader.GetSqlValue(11); - Wafer_spec = sqlReader.GetSqlValue(12); - Comment = sqlReader.GetSqlValue(13); - Number_wafers = sqlReader.GetSqlValue(14); - } - - public static List GetPart(string connectionString, string partNumber) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" generation, tr_status, essential_part_number, part_number_description, irmn_part_number, spec_version, spec_version_effective_date, engr_status, qual_status, prod_status, process_flow, wafer_thickness, wafer_spec, comment, number_wafers "). - Append(" FROM ControlPlans.dbo.[Part] "). - Append(" WHERE part= '$partNumber$' "). - Append(" /* WHERE part= '1208B' Example */ "); - sql.Replace("$partNumber$", partNumber); - return GetPart(connectionString, sql); - } - - private static List GetPart(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new Part(sqlReader)); - } - } - } - return results; - } - - } - - public class Parameters - { - - public object Parameter { get; set; } - public object Iqs_name { get; set; } - public object Scrap_priority { get; set; } - public object Units { get; set; } - public object Grade { get; set; } - public object Skip_if_light { get; set; } - public object Ocap_document { get; set; } - public object Measurement_method { get; set; } - public object Scrap_reason_text { get; set; } - public object Number_wafers { get; set; } - public object Number_decimals { get; set; } - public object Promis_scrap_code { get; set; } - public object Process_number { get; set; } - public object Process_name { get; set; } - public object Characteristic_number { get; set; } - public object Machine_for_mfg { get; set; } - public object Size { get; set; } - public object Frequency { get; set; } - public object Control_method { get; set; } - public object Comment { get; set; } - public object Sort_order { get; set; } - - private static string _ConnectionStringIrmnSpc; - private static string _ConnectionStringG4Wafers; - - public static void SetConnectionStringIrmnSpc(string connectionString) - { - _ConnectionStringIrmnSpc = connectionString; - } - - public static void SetConnectionStringG4Wafers(string connectionString) - { - _ConnectionStringG4Wafers = connectionString; - } - - public Parameters(SqlDataReader sqlReader) - { - Parameter = sqlReader.GetSqlValue(0); - Iqs_name = sqlReader.GetSqlValue(1); - Scrap_priority = sqlReader.GetSqlValue(2); - Units = sqlReader.GetSqlValue(3); - Grade = sqlReader.GetSqlValue(4); - Skip_if_light = sqlReader.GetSqlValue(5); - Ocap_document = sqlReader.GetSqlValue(6); - Measurement_method = sqlReader.GetSqlValue(7); - Scrap_reason_text = sqlReader.GetSqlValue(8); - Number_wafers = sqlReader.GetSqlValue(9); - Number_decimals = sqlReader.GetSqlValue(10); - Promis_scrap_code = sqlReader.GetSqlValue(11); - Process_number = sqlReader.GetSqlValue(12); - Process_name = sqlReader.GetSqlValue(13); - Characteristic_number = sqlReader.GetSqlValue(14); - Machine_for_mfg = sqlReader.GetSqlValue(15); - Size = sqlReader.GetSqlValue(16); - Frequency = sqlReader.GetSqlValue(17); - Control_method = sqlReader.GetSqlValue(18); - Comment = sqlReader.GetSqlValue(19); - Sort_order = sqlReader.GetSqlValue(20); - } - - public static List GetParameters() - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" parameter, iqs_name, scrap_priority, units, grade, skip_if_light, ocap_document, measurement_method, scrap_reason_text, number_wafers, number_decimals, promis_scrap_code, process_number, process_name, characteristic_number, machine_for_mfg, size, frequency, control_method, comment, sort_order "). - Append(" FROM ControlPlans.dbo.[Parameter] "). - Append(" ORDER BY sort_order "); - return GetParameters(_ConnectionStringIrmnSpc, sql); - } - - private static List GetParameters(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new Parameters(sqlReader)); - } - } - } - return results; - } - - } - - public class GradingLogic - { - - public object Part_qual_status { get; set; } - public object Num_crit_oos { get; set; } - public object Result { get; set; } - - public GradingLogic(SqlDataReader sqlReader) - { - Part_qual_status = sqlReader.GetSqlValue(0); - Num_crit_oos = sqlReader.GetSqlValue(1); - Result = sqlReader.GetSqlValue(2); - } - - public static List GetGradingLogic(string connectionString) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" part_qual_status, num_crit_oos, result "). - Append(" FROM ControlPlans.dbo.[Grading_Logic] "). - Append(" ORDER BY part_qual_status, num_crit_oos "); - return GetGradingLogic(connectionString, sql); - } - - private static List GetGradingLogic(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new GradingLogic(sqlReader)); - } - } - } - return results; - } - - } - - public class ParamHistoryList - { - - public object Parameter { get; set; } - - public ParamHistoryList(SqlDataReader sqlReader) - { - Parameter = sqlReader.GetSqlValue(0); - } - - public static List GetParamHistoryList(string connectionString) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" DISTINCT parameter "). - Append(" FROM ControlPlans.dbo.[Parameter_Hist] "). - Append(" ORDER BY parameter "); - return GetParamHistoryList(connectionString, sql); - } - - private static List GetParamHistoryList(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new ParamHistoryList(sqlReader)); - } - } - } - return results; - } - - } - - public class ParamHistory - { - - public object Parameter { get; set; } - public object Iqs_name { get; set; } - public object Scrap_priority { get; set; } - public object Units { get; set; } - public object Grade { get; set; } - public object Skip_if_light { get; set; } - public object Ocap_document { get; set; } - public object Measurement_method { get; set; } - public object Scrap_reason_text { get; set; } - public object Number_wafers { get; set; } - public object Number_decimals { get; set; } - public object Promis_scrap_code { get; set; } - public object Process_number { get; set; } - public object Process_name { get; set; } - public object Characteristic_number { get; set; } - public object Machine_for_mfg { get; set; } - public object Size { get; set; } - public object Frequency { get; set; } - public object Control_method { get; set; } - public object Comment { get; set; } - public object Stamp { get; set; } - public object Engineer_signoff { get; set; } - public object Manager_signoff { get; set; } - public object Sort_order { get; set; } - - public ParamHistory(SqlDataReader sqlReader) - { - Parameter = sqlReader.GetSqlValue(0); - Iqs_name = sqlReader.GetSqlValue(1); - Scrap_priority = sqlReader.GetSqlValue(2); - Units = sqlReader.GetSqlValue(3); - Grade = sqlReader.GetSqlValue(4); - Skip_if_light = sqlReader.GetSqlValue(5); - Ocap_document = sqlReader.GetSqlValue(6); - Measurement_method = sqlReader.GetSqlValue(7); - Scrap_reason_text = sqlReader.GetSqlValue(8); - Number_wafers = sqlReader.GetSqlValue(9); - Number_decimals = sqlReader.GetSqlValue(10); - Promis_scrap_code = sqlReader.GetSqlValue(11); - Process_number = sqlReader.GetSqlValue(12); - Process_name = sqlReader.GetSqlValue(13); - Characteristic_number = sqlReader.GetSqlValue(14); - Machine_for_mfg = sqlReader.GetSqlValue(15); - Size = sqlReader.GetSqlValue(16); - Frequency = sqlReader.GetSqlValue(17); - Control_method = sqlReader.GetSqlValue(18); - Comment = sqlReader.GetSqlValue(19); - Stamp = sqlReader.GetSqlValue(20); - Engineer_signoff = sqlReader.GetSqlValue(21); - Manager_signoff = sqlReader.GetSqlValue(22); - Sort_order = sqlReader.GetSqlValue(23); - } - - public static List GetParamHistory(string connectionString, string paramName) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" parameter, iqs_name, scrap_priority, units, grade, skip_if_light, ocap_document, measurement_method, scrap_reason_text, number_wafers, number_decimals, promis_scrap_code, process_number, process_name, characteristic_number, machine_for_mfg, size, frequency, control_method, comment, stamp, engineer_signoff, manager_signoff, sort_order "). - Append(" FROM ControlPlans.dbo.[Parameter_Hist] "). - Append(" WHERE parameter = '$paramName$' "). - Append(" /* WHERE parameter = '002 FWHM' Example */ "). - Append(" ORDER BY parameter, stamp "); - sql.Replace("$paramName$", paramName); - return GetParamHistory(connectionString, sql); - } - - private static List GetParamHistory(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new ParamHistory(sqlReader)); - } - } - } - return results; - } - - } - - public class PartHistoryList - { - - public object Part { get; set; } - - public PartHistoryList(SqlDataReader sqlReader) - { - Part = sqlReader.GetSqlValue(0); - } - - public static List GetPartHistoryList(string connectionString) - { - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" DISTINCT part "). - Append(" FROM ControlPlans.dbo.[Part_Hist] "). - Append(" ORDER BY part "); - return GetPartHistoryList(connectionString, sql); - } - - private static List GetPartHistoryList(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new PartHistoryList(sqlReader)); - } - } - } - return results; - } - - } - - public class PartHistory - { - - public object Part { get; set; } - public object Generation { get; set; } - public object Tr_status { get; set; } - public object Essential_part_number { get; set; } - public object Part_number_description { get; set; } - public object Irmn_part_number { get; set; } - public object Spec_version { get; set; } - public object Spec_version_effective_date { get; set; } - public object Engr_status { get; set; } - public object Qual_status { get; set; } - public object Prod_status { get; set; } - public object Process_flow { get; set; } - public object Wafer_thickness { get; set; } - public object Wafer_spec { get; set; } - public object Comment { get; set; } - public object Number_wafers { get; set; } - public object Stamp { get; set; } - public object Engineer_signoff { get; set; } - public object Manager_signoff { get; set; } - - private static string _ConnectionStringIrmnSpc; - private static string _ConnectionStringG4Wafers; - - public static void SetConnectionStringIrmnSpc(string connectionString) - { - _ConnectionStringIrmnSpc = connectionString; - } - - public static void SetConnectionStringG4Wafers(string connectionString) - { - _ConnectionStringG4Wafers = connectionString; - } - - public PartHistory(SqlDataReader sqlReader) - { - Part = sqlReader.GetSqlValue(0); - Generation = sqlReader.GetSqlValue(1); - Tr_status = sqlReader.GetSqlValue(2); - Essential_part_number = sqlReader.GetSqlValue(3); - Part_number_description = sqlReader.GetSqlValue(4); - Irmn_part_number = sqlReader.GetSqlValue(5); - Spec_version = sqlReader.GetSqlValue(6); - Spec_version_effective_date = sqlReader.GetSqlValue(7); - Engr_status = sqlReader.GetSqlValue(8); - Qual_status = sqlReader.GetSqlValue(9); - Prod_status = sqlReader.GetSqlValue(10); - Process_flow = sqlReader.GetSqlValue(11); - Wafer_thickness = sqlReader.GetSqlValue(12); - Wafer_spec = sqlReader.GetSqlValue(13); - Comment = sqlReader.GetSqlValue(14); - Number_wafers = sqlReader.GetSqlValue(15); - Stamp = sqlReader.GetSqlValue(16); - Engineer_signoff = sqlReader.GetSqlValue(17); - Manager_signoff = sqlReader.GetSqlValue(18); - } - - public static List GetPartHistory(string partNumber) - { - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" part, generation, tr_status, essential_part_number, part_number_description, irmn_part_number, spec_version, spec_version_effective_date, engr_status, qual_status, prod_status, process_flow, wafer_thickness, wafer_spec, comment, number_wafers, stamp, engineer_signoff, manager_signoff "). - Append(" FROM ControlPlans.dbo.[Part_Hist] "). - Append(" WHERE part= '$partNumber$' "). - Append(" /* WHERE part= '1208B' Example */ "). - Append(" ORDER BY part, stamp "); - sql.Replace("$partNumber$", partNumber); - return GetPartHistory(_ConnectionStringIrmnSpc, sql); - } - - private static List GetPartHistory(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new PartHistory(sqlReader)); - } - } - } - return results; - } - - } - - } - - namespace ProcessSectionELotSummaryReport - { - - public class IqsData084 - { - - public object Test_name { get; set; } - public object Test_no { get; set; } - public object True_pocket { get; set; } - public object F_sgrp { get; set; } - - public IqsData084(SqlDataReader sqlReader) - { - Test_name = sqlReader.GetSqlValue(0); - Test_no = sqlReader.GetSqlValue(1); - True_pocket = sqlReader.GetSqlValue(2); - F_sgrp = sqlReader.GetSqlValue(3); - } - - public static List GetIqsData084(string connectionString, string lotId) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" TEST_DAT.F_NAME AS TEST_NAME, SGRP_EXT.F_TSNO AS TEST_NO, SGRP_EXT.F_VAL AS TRUE_POCKET, SGRP_EXT.F_SGRP "). - Append(" FROM IRMNSPC.dbo.[SGRP_EXT], IRMNSPC.dbo.[TEST_DAT], IRMNSPC.dbo.[SGRP_DSC], IRMNSPC.dbo.[DESC_DAT], IRMNSPC.dbo.[DESC_GRP] "). - Append(" WHERE SGRP_EXT.F_Test = TEST_DAT.F_Test "). - Append(" AND SGRP_EXT.F_SGRP = SGRP_DSC.F_SGRP "). - Append(" AND SGRP_DSC.F_DESC = DESC_DAT.F_DESC "). - Append(" AND DESC_GRP.F_DSGP = DESC_DAT.F_DSGP "). - Append(" AND DESC_GRP.F_NAME IN ('Wafer ID') "). - Append(" AND SGRP_EXT.F_FLAG IN (0) "). - Append(" AND SGRP_EXT.F_LOT IN ( "). - Append(" SELECT F_LOT "). - Append(" FROM IRMNSPC.dbo.[PART_LOT] "). - Append(" WHERE F_NAME = '$LotId$' "). - Append(" /* WHERE F_NAME = '0302435hvfet' Example */ "). - Append(" ) "). - Append(" AND TEST_DAT.F_NAME LIKE 'WaferPocket_%' "); - sql.Replace("$LotId$", lotId); - return GetIqsData084(connectionString, sql); - } - - private static List GetIqsData084(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new IqsData084(sqlReader)); - } - } - } - return results; - } - - } - - public class IqsData112 - { - - public object Test_name { get; set; } - public object F_val { get; set; } - public object F_tsno { get; set; } - public object F_sbno { get; set; } - public object F_sgrp { get; set; } - - public IqsData112(SqlDataReader sqlReader) - { - Test_name = sqlReader.GetSqlValue(0); - F_val = sqlReader.GetSqlValue(1); - F_tsno = sqlReader.GetSqlValue(2); - F_sbno = sqlReader.GetSqlValue(3); - F_sgrp = sqlReader.GetSqlValue(4); - } - - public static List GetIqsData112(string connectionString, string lotId) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" TEST_DAT.F_NAME AS TEST_NAME, SGRP_EXT.F_VAL, SGRP_EXT.F_TSNO, SGRP_EXT.F_SBNO, SGRP_EXT.F_SGRP "). - Append(" FROM IRMNSPC.dbo.[SGRP_EXT], IRMNSPC.dbo.[TEST_DAT], IRMNSPC.dbo.[SGRP_DSC], IRMNSPC.dbo.[DESC_DAT], IRMNSPC.dbo.[DESC_GRP] "). - Append(" WHERE SGRP_EXT.F_Test = TEST_DAT.F_Test "). - Append(" AND SGRP_EXT.F_SGRP = SGRP_DSC.F_SGRP "). - Append(" AND SGRP_DSC.F_DESC = DESC_DAT.F_DESC "). - Append(" AND DESC_GRP.F_DSGP = DESC_DAT.F_DSGP "). - Append(" AND SGRP_EXT.F_FLAG IN (0) "). - Append(" AND DESC_GRP.F_NAME IN ('Wafer ID') "). - Append(" AND SGRP_EXT.F_LOT IN ( "). - Append(" SELECT "). - Append(" F_LOT "). - Append(" FROM IRMNSPC.dbo.[PART_LOT] "). - Append(" WHERE F_NAME = '$LotId$' "). - Append(" /* WHERE F_NAME = '0302435hvfet' Example */ "). - Append(" ) "). - Append(" UNION "). - Append(" SELECT "). - Append(" TEST_DAT.F_NAME AS TEST_NAME, SGRP_EXT.F_VAL, SGRP_EXT.F_TSNO, SGRP_EXT.F_SBNO, SGRP_EXT.F_SGRP "). - Append(" FROM IRMNSPC.dbo.[TEST_DAT], IRMNSPC.dbo.[SGRP_EXT], IRMNSPC.dbo.[PART_LOT] "). - Append(" WHERE TEST_DAT.F_Test = SGRP_EXT.F_Test "). - Append(" AND SGRP_EXT.F_LOT = PART_LOT.F_LOT "). - Append(" AND SGRP_EXT.F_FLAG IN (0) "). - Append(" AND PART_LOT.F_NAME = '$LotId$' "). - Append(" /* AND PART_LOT.F_NAME = '0302435hvfet' Example */ "). - Append(" ORDER BY TEST_DAT.F_NAME, SGRP_EXT.F_TSNO, SGRP_EXT.F_VAL DESC "); - sql.Replace("$LotId$", lotId); - return GetIqsData112(connectionString, sql); - } - - private static List GetIqsData112(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new IqsData112(sqlReader)); - } - } - } - return results; - } - - } - - public class IqsData322 - { - - public object Run_number { get; set; } - public object Part_number { get; set; } - - public IqsData322(SqlDataReader sqlReader) - { - Run_number = sqlReader.GetSqlValue(0); - Part_number = sqlReader.GetSqlValue(1); - } - - public static List GetIqsData322(string connectionString, string lotId) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" [Run Number], [Part Number] "). - Append(" FROM G4Wafers_01.dbo.[Prerun Info] "). - Append(" WHERE [Run Number] = '$LotId$' "). - Append(" /* WHERE [Run Number] = '6903059etch' Example */ "); - sql.Replace("$LotId$", lotId); - return GetIqsData322(connectionString, sql); - } - - private static List GetIqsData322(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new IqsData322(sqlReader)); - } - } - } - return results; - } - - } - - public class IqsData363 - { - - public object Test_name { get; set; } - public object F_val { get; set; } - public object F_name { get; set; } - public object F_tsno { get; set; } - - public IqsData363(SqlDataReader sqlReader) - { - Test_name = sqlReader.GetSqlValue(0); - F_val = sqlReader.GetSqlValue(1); - F_name = sqlReader.GetSqlValue(2); - F_tsno = sqlReader.GetSqlValue(3); - } - - public static List GetIqsData363(string connectionString, string lotId) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" TEST_DAT.F_NAME AS TEST_NAME, SGRP_EXT.F_VAL, DESC_DAT.F_NAME, SGRP_EXT.F_TSNO "). - Append(" FROM IRMNSPC.dbo.[SGRP_EXT], IRMNSPC.dbo.[TEST_DAT], IRMNSPC.dbo.[SGRP_DSC], IRMNSPC.dbo.[DESC_DAT], IRMNSPC.dbo.[DESC_GRP] "). - Append(" WHERE SGRP_EXT.F_Test = TEST_DAT.F_Test "). - Append(" AND SGRP_EXT.F_SGRP = SGRP_DSC.F_SGRP "). - Append(" AND SGRP_DSC.F_DESC = DESC_DAT.F_DESC "). - Append(" AND DESC_GRP.F_DSGP = DESC_DAT.F_DSGP "). - Append(" AND DESC_GRP.F_NAME IN ('Wafer ID') "). - Append(" AND SGRP_EXT.F_LOT IN ( "). - Append(" SELECT F_LOT "). - Append(" FROM IRMNSPC.dbo.[PART_LOT] "). - Append(" WHERE F_NAME = '$LotId$' "). - Append(" /* WHERE F_NAME = '0302435hvfet' Example */ "). - Append(" ) "). - Append(" UNION "). - Append(" SELECT "). - Append(" TEST_DAT.F_NAME AS TEST_NAME, SGRP_EXT.F_VAL, ' ' AS F_NAME, SGRP_EXT.F_TSNO "). - Append(" FROM IRMNSPC.dbo.[TEST_DAT], IRMNSPC.dbo.[SGRP_EXT], IRMNSPC.dbo.[PART_LOT] "). - Append(" WHERE TEST_DAT.F_Test = SGRP_EXT.F_Test "). - Append(" AND SGRP_EXT.F_LOT = PART_LOT.F_LOT "). - Append(" AND PART_LOT.F_NAME = '$LotId$' "). - Append(" /* AND PART_LOT.F_NAME = '0302435hvfet' Example */ "). - Append(" ORDER BY TEST_DAT.F_NAME, SGRP_EXT.F_TSNO, SGRP_EXT.F_VAL DESC "); - sql.Replace("$LotId$", lotId); - return GetIqsData363(connectionString, sql); - } - - private static List GetIqsData363(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new IqsData363(sqlReader)); - } - } - } - return results; - } - - } - - public class IqsData488 - { - - public object Run_number { get; set; } - public object Part_number { get; set; } - - public IqsData488(SqlDataReader sqlReader) - { - Run_number = sqlReader.GetSqlValue(0); - Part_number = sqlReader.GetSqlValue(1); - } - - public static List GetIqsData488(string connectionString, string lotId) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" [Run Number], [Part Number] "). - Append(" FROM G4Wafers_01.dbo.[Prerun Info] "). - Append(" WHERE [Run Number] = '$LotId$' "). - Append(" /* WHERE [Run Number] = '6903059etch' Example */ "); - sql.Replace("$LotId$", lotId); - return GetIqsData488(connectionString, sql); - } - - private static List GetIqsData488(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new IqsData488(sqlReader)); - } - } - } - return results; - } - - } - - } - - namespace SectionELotSummaryReport - { - - public class RecipeInfo - { - - public object Run_number { get; set; } - public object Pocket_number { get; set; } - public object Recipe { get; set; } - public object Wafer_lot { get; set; } - - public RecipeInfo(SqlDataReader sqlReader) - { - Run_number = sqlReader.GetSqlValue(0); - Pocket_number = sqlReader.GetSqlValue(1); - Recipe = sqlReader.GetSqlValue(2); - Wafer_lot = sqlReader.GetSqlValue(3); - } - - public static List GetRecipeInfo(string connectionString, string runNumber, string pocketNumber) - { - StringBuilder sql = new StringBuilder(); - sql.Clear(); - sql.Append(" SELECT "). - Append(" [Run Number], pocket_number, recipe, wafer_lot "). - Append(" FROM G4Wafers_01.dbo.[Prerun Info] "). - Append(" WHERE [Run Number] = '$runNumber$' "). - Append(" /* WHERE [Run Number] = '6903059etch' Example */ "). - Append(" AND pocket_number = '$pocketNumber$' "). - Append(" /* AND pocket_number = '01' Example */ "); - sql.Replace("$runNumber$", runNumber).Replace("$pocketNumber$", pocketNumber); - return GetRecipeInfo(connectionString, sql); - } - - private static List GetRecipeInfo(string connectionString, StringBuilder sql) - { - List results = new List(); - string cmdText = sql.ToString(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(cmdText, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(new RecipeInfo(sqlReader)); - } - } - } - return results; - } - - } - - } - -} diff --git a/Adaptation/Helpers/Si/LDS2559Reply.cs b/Adaptation/Helpers/Si/LDS2559Reply.cs deleted file mode 100644 index 07c645a..0000000 --- a/Adaptation/Helpers/Si/LDS2559Reply.cs +++ /dev/null @@ -1,218 +0,0 @@ -using Infineon.Yoda; -using System; -using System.Collections.Generic; -using System.Linq; -using TIBCO.Rendezvous; - -namespace Adaptation.Si -{ - - public class LDS2559Reply - { - - public enum FieldName - { - ETC, - ETX, - IFX_ECD, - IFX_ETX, - PARAMETER, - ACCEPTED, - EXCLUDE, - HIT, - CALCULATED, - CHANNEL, - CKC, - OOB, - VIOLATION, - MEAN, - OFFLINE, - PARAMETERNAME, - SAMPID_64, - REPLY, - UNACCEPTED, - VIOLATIONS - } - - public class HIT - { - - public object CALCULATED { get; set; } //bool - public object CHANNEL { get; set; } //Int32 - public object CKC { get; set; } //Int32 - public object OOB { get; set; } //bool - public object VIOLATION { get; set; } //Int32 - - public HIT(Message value) - { - MessageField messageField; - for (uint i = 0; i < value.FieldCount; i++) - { - messageField = value.GetFieldByIndex(i); - if (messageField.Name == FieldName.CALCULATED.ToString()) - CALCULATED = messageField.Value; - else if (messageField.Name == FieldName.CHANNEL.ToString()) - CHANNEL = messageField.Value; - else if (messageField.Name == FieldName.CKC.ToString()) - CKC = messageField.Value; - else if (messageField.Name == FieldName.OOB.ToString()) - OOB = messageField.Value; - else if (messageField.Name == FieldName.VIOLATION.ToString()) - VIOLATION = messageField.Value; - else - throw new Exception(); - } - } - - public override string ToString() - { - return string.Concat(CALCULATED, '\t', CHANNEL, '\t', CKC, '\t', OOB, '\t', VIOLATION); - } - - } - - public class PARAMETER - { - - public object ACCEPTED { get; set; } //bool - public object EXCLUDE { get; set; } //Int32 - public List HIT { get; set; } - public object MEAN { get; set; } //double - public object OFFLINE { get; set; } //bool - public object PARAMETERNAME { get; set; } //string - public object SAMPID_64 { get; set; } //Int64 - - public PARAMETER(Message value) - { - HIT hit; - Message message; - HIT = new List(); - object objectFieldValue; - MessageField messageField; - for (uint i = 0; i < value.FieldCount; i++) - { - messageField = value.GetFieldByIndex(i); - if (messageField.Name == FieldName.ACCEPTED.ToString()) - ACCEPTED = messageField.Value; - else if (messageField.Name == FieldName.EXCLUDE.ToString()) - EXCLUDE = messageField.Value; - else if (messageField.Name == FieldName.HIT.ToString()) - { - if (!(messageField.Value is null) && messageField.Value is Message) - { - message = (Message)messageField.Value; - { - for (uint j = 0; j < message.FieldCount; j++) - { - objectFieldValue = message.GetFieldByIndex(j).Value; - if (!(objectFieldValue is null) && objectFieldValue is Message) - { - hit = new HIT((Message)objectFieldValue); - HIT.Add(hit); - } - } - } - } - } - else if (messageField.Name == FieldName.MEAN.ToString()) - MEAN = messageField.Value; - else if (messageField.Name == FieldName.OFFLINE.ToString()) - OFFLINE = messageField.Value; - else if (messageField.Name == FieldName.PARAMETERNAME.ToString()) - PARAMETERNAME = messageField.Value; - else if (messageField.Name == FieldName.SAMPID_64.ToString()) - SAMPID_64 = messageField.Value; - else - throw new Exception(); - } - } - - public override string ToString() - { - string result; - if (!HIT.Any()) - result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "HIT = 0", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64); - else - result = string.Concat(ACCEPTED, '\t', EXCLUDE, '\t', "[Count ", HIT.Count, " - 0 {", HIT[0], "}]", '\t', MEAN, '\t', OFFLINE, '\t', PARAMETERNAME, '\t', SAMPID_64); - return result; - } - - } - - public class DATA - { - - public object ETC { get; set; } //Int32 - public object ETX { get; set; } - public object IFX_ECD { get; set; } //Int32 - public object IFX_ETX { get; set; } //string - public List PARAMETER { get; set; } - public object REPLY { get; set; } //Int32 - public object UNACCEPTED { get; set; } //Int32 - public object VIOLATIONS { get; set; } //Int32 - - public DATA(IfxDoc ifxDoc = null) - { - PARAMETER = new List(); - if (!(ifxDoc is null)) - { - Message message; - PARAMETER parameter; - object objectFieldValue; - MessageField messageField; - for (uint i = 0; i < ifxDoc.msg.FieldCount; i++) - { - messageField = ifxDoc.msg.GetFieldByIndex(i); - if (messageField.Name == FieldName.ETC.ToString()) - ETC = messageField.Value; - else if (messageField.Name == FieldName.ETX.ToString()) - ETX = messageField.Value; - else if (messageField.Name == FieldName.IFX_ECD.ToString()) - IFX_ECD = messageField.Value; - else if (messageField.Name == FieldName.IFX_ETX.ToString()) - IFX_ETX = messageField.Value; - else if (messageField.Name == FieldName.PARAMETER.ToString()) - { - if (!(messageField.Value is null) && messageField.Value is Message) - { - message = (Message)messageField.Value; - { - for (uint j = 0; j < message.FieldCount; j++) - { - objectFieldValue = message.GetFieldByIndex(j).Value; - if (!(objectFieldValue is null) && objectFieldValue is Message) - { - parameter = new PARAMETER((Message)objectFieldValue); - PARAMETER.Add(parameter); - } - } - } - } - } - else if (messageField.Name == FieldName.REPLY.ToString()) - REPLY = messageField.Value; - else if (messageField.Name == FieldName.UNACCEPTED.ToString()) - UNACCEPTED = messageField.Value; - else if (messageField.Name == FieldName.VIOLATIONS.ToString()) - VIOLATIONS = messageField.Value; - else - throw new Exception(); - } - } - } - - public override string ToString() - { - string result; - if (!PARAMETER.Any()) - result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "PARAMETER = 0", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS); - else - result = string.Concat(IFX_ECD, '\t', IFX_ETX, '\t', "[Count ", PARAMETER.Count, " - 0 {", PARAMETER[0], "}]", '\t', REPLY, '\t', UNACCEPTED, '\t', VIOLATIONS); - return result; - } - - } - - } - -} diff --git a/Adaptation/Helpers/Si/LDS2559Send.cs b/Adaptation/Helpers/Si/LDS2559Send.cs deleted file mode 100644 index 213ca6e..0000000 --- a/Adaptation/Helpers/Si/LDS2559Send.cs +++ /dev/null @@ -1,317 +0,0 @@ -using Adaptation.Shared; -using Infineon.Yoda; -using System; -using System.Collections.Generic; - -namespace Adaptation.Si -{ - - public class LDS2559Send - { - - public enum FieldName - { - IFX_SERVICE, - KEYS, - PARAMETER, - SETTINGS, - PARAMETERNAME, - VALUE - } - - public class Settings - { - public string MODE { get; set; } - public int COMTIMEOUT { get; set; } - public string DATE { get; private set; } - public int KEY { get; set; } - public int LDS { get; set; } - public string SENDER { get; set; } - - public Settings(string ifxSubjectPrefix, Logistics logistics) - { - MODE = "FULL"; - COMTIMEOUT = 10; - KEY = 0; - switch (ifxSubjectPrefix) - { - case "VIH_D": LDS = 2599; break; - case "VIH_P": LDS = 2500; break; - default: LDS = -1; break; - } - SENDER = Environment.MachineName; - DATE = logistics.DateTimeFromSequence.ToString("yyyyMMddHHmmss"); - } - - } - - public class Value - { - public DataKeys DataKeys { get; set; } - public string VALUE { get; set; } - - public Value(Logistics logistics) - { - DataKeys = new DataKeys(logistics); - } - - } - - public class Parameter - { - - public ExtractorKeys ExtractorKeys { get; set; } - public DataKeys DataKeys { get; set; } - public string COMMENT { get; set; } - public double? LSL { get; set; } - public string PARAMETERNAME { get; set; } - public double? TSL { get; set; } - public string UNIT { get; set; } - public double? USL { get; set; } - public string VALUE { get; set; } - - public Parameter(Logistics logistics) - { - ExtractorKeys = new ExtractorKeys(logistics); - DataKeys = new DataKeys(logistics); - } - - public Parameter(Logistics logistics, string parameterName, string value) - { - ExtractorKeys = new ExtractorKeys(logistics); - DataKeys = new DataKeys(logistics); - PARAMETERNAME = parameterName; - VALUE = value; - } - - public Parameter(Logistics logistics, ExtendedParameter extendedParameter) - { - ExtractorKeys = new ExtractorKeys(logistics); - DataKeys = new DataKeys(logistics); - PARAMETERNAME = extendedParameter.DiplayName; - LSL = extendedParameter.LSL; - TSL = extendedParameter.TSL; - UNIT = extendedParameter.Unit; - USL = extendedParameter.USL; - VALUE = extendedParameter.Value; - } - - } - - public class DataKeys - { - - public string Employee { get; set; } //1 - public string SID { get; set; } //2 - public string WaferRegion { get; set; } //3 - public string WaferScribe { get; set; } //4 - public string WaferPosition { get; set; } //5 - public string X { get; set; } //6 - public string Y { get; set; } //7 - public string EAFCellInstance { get; set; } //8 - public string EAFReference { get; set; } //9 - public string IQSReference { get; set; } //10 - - public DataKeys(Logistics logistics, IScopeInfo scopeInfo = null, string sID = null) - { - if (scopeInfo is null) - { - SID = null; - EAFReference = null; - IQSReference = null; - EAFCellInstance = null; - } - else - { - if (string.IsNullOrEmpty(sID)) - SID = "-"; - else - SID = sID; - EAFReference = scopeInfo.EquipmentType.ToString(); - if (string.IsNullOrEmpty(scopeInfo.QueryFilter)) - IQSReference = null; - else - IQSReference = scopeInfo.QueryFilter; - if (logistics is null) - EAFCellInstance = null; - else - EAFCellInstance = logistics.JobID; - } - } - - } - - public class ExtractorKeys - { - - public string Lot { get; set; } //1 - public string ToolID { get; set; } //2 - public string Process { get; set; } //3 - public string WaferID { get; set; } //4 - public string Part { get; set; } //5 - public string Recipe { get; set; } //6 - public string ProcessFlow { get; set; } //7 - - public ExtractorKeys(Logistics logistics, IScopeInfo scopeInfo = null) - { - if (scopeInfo is null) - { - ToolID = null; - Lot = null; - Part = null; - } - else - { - ToolID = logistics.MesEntity; - Lot = "-"; - Part = "-"; - } - } - - } - - public class DATA - { - public string IFX_SERVICE { get; set; } - public ExtractorKeys ExtractorKeys { get; set; } - public DataKeys DataKeys { get; set; } - public Parameter Parameter { get; set; } - public Settings Settings { get; set; } - - public DATA(string ifxSubjectPrefix, Logistics logistics, IScopeInfo scopeInfo, string sID) - { - ExtractorKeys = new ExtractorKeys(logistics, scopeInfo); - DataKeys = new DataKeys(logistics, scopeInfo, sID); - Parameter = new Parameter(logistics); - Settings = new Settings(ifxSubjectPrefix, logistics); - } - - internal static IfxDoc GetIfxDoc(string service, string value, DataKeys dataKeys, ExtractorKeys extractorKeys, Settings settings) - { - IfxDoc result = new IfxDoc(); - if (!string.IsNullOrEmpty(service)) - result.Add(string.Concat(FieldName.IFX_SERVICE), service); - if (!(value is null)) - { - if (string.IsNullOrEmpty(value)) - result.Add(string.Concat(FieldName.VALUE), "-"); - else - result.Add(string.Concat(FieldName.VALUE), value); - } - if (!(dataKeys is null)) - { - if (!string.IsNullOrEmpty(dataKeys.EAFCellInstance)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFCellInstance)), dataKeys.EAFCellInstance); - if (!string.IsNullOrEmpty(dataKeys.EAFReference)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.EAFReference)), dataKeys.EAFReference); - if (!string.IsNullOrEmpty(dataKeys.Employee)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Employee)), dataKeys.Employee); - if (!string.IsNullOrEmpty(dataKeys.IQSReference)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.IQSReference)), dataKeys.IQSReference); - if (!string.IsNullOrEmpty(dataKeys.SID)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.SID)), dataKeys.SID); - if (!string.IsNullOrEmpty(dataKeys.WaferPosition)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferPosition)), dataKeys.WaferPosition); - if (!string.IsNullOrEmpty(dataKeys.WaferRegion)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferRegion)), dataKeys.WaferRegion); - if (!string.IsNullOrEmpty(dataKeys.WaferScribe)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.WaferScribe)), dataKeys.WaferScribe); - if (!string.IsNullOrEmpty(dataKeys.X)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.X)), dataKeys.X); - if (!string.IsNullOrEmpty(dataKeys.Y)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.DataKeys.Y)), dataKeys.Y); - } - if (!(extractorKeys is null)) - { - if (!string.IsNullOrEmpty(extractorKeys.Lot)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Lot)), extractorKeys.Lot); - if (!string.IsNullOrEmpty(extractorKeys.Part)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Part)), extractorKeys.Part); - if (!string.IsNullOrEmpty(extractorKeys.Process)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Process)), extractorKeys.Process); - if (!string.IsNullOrEmpty(extractorKeys.ProcessFlow)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ProcessFlow)), extractorKeys.ProcessFlow); - if (!string.IsNullOrEmpty(extractorKeys.Recipe)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.Recipe)), extractorKeys.Recipe); - if (!string.IsNullOrEmpty(extractorKeys.ToolID)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.ToolID)), extractorKeys.ToolID); - if (!string.IsNullOrEmpty(extractorKeys.WaferID)) - result.Add(string.Concat(FieldName.KEYS, "/", nameof(LDS2559Send.ExtractorKeys.WaferID)), extractorKeys.WaferID); - } - if (!(settings is null)) - { - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.MODE)), settings.MODE); - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.COMTIMEOUT)), settings.COMTIMEOUT); - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.DATE)), settings.DATE); - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.KEY)), settings.KEY); - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.LDS)), settings.LDS); - result.Add(string.Concat(FieldName.SETTINGS, "/", nameof(LDS2559Send.Settings.SENDER)), settings.SENDER); - } - return result; - } - - public IfxDoc GetIfxDoc(List parameters) - { - IfxDoc result = GetIfxDoc("EVALUATESPCDATA", value: null, dataKeys: DataKeys, extractorKeys: ExtractorKeys, settings: Settings); - result.Add(string.Concat(FieldName.PARAMETER), parameters.ToArray()); - return result; - } - - } - - public class ParameterCollection - { - public List Collection { get; set; } - - public ParameterCollection() - { - Collection = new List(); - } - - public IfxDoc GetIfxDoc() - { - IfxDoc value; - IfxDoc result = new IfxDoc(); - Parameter parameter; - List values = new List(); - for (int i = 0; i < Collection.Count; i++) - { - parameter = Collection[i]; - if (i == 0) - { - if (parameter.TSL.HasValue & parameter.USL.HasValue && parameter.TSL.Value > parameter.USL.Value) - parameter.USL = parameter.TSL.Value; - if (parameter.TSL.HasValue & parameter.LSL.HasValue && parameter.TSL.Value < parameter.LSL.Value) - parameter.LSL = parameter.TSL.Value; - // - if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value && parameter.USL.Value == 0) - parameter.USL = null; - // - if (parameter.USL.HasValue & parameter.LSL.HasValue && parameter.USL.Value < parameter.LSL.Value) - throw new Exception(); - if (parameter.LSL.HasValue & parameter.USL.HasValue && parameter.LSL.Value > parameter.USL.Value) - throw new Exception(); - // - if (parameter.LSL.HasValue) - result.Add(nameof(Parameter.LSL), parameter.LSL); - if (!string.IsNullOrEmpty(parameter.PARAMETERNAME)) - result.Add(string.Concat(FieldName.PARAMETERNAME), parameter.PARAMETERNAME); - if (parameter.TSL.HasValue) - result.Add(nameof(Parameter.TSL), parameter.TSL.Value); - if (!string.IsNullOrEmpty(parameter.UNIT)) - result.Add(nameof(Parameter.UNIT), parameter.UNIT); - if (parameter.USL.HasValue) - result.Add(nameof(Parameter.USL), parameter.USL.Value); - } - value = DATA.GetIfxDoc(service: string.Empty, value: parameter.VALUE, dataKeys: parameter.DataKeys, extractorKeys: parameter.ExtractorKeys, settings: null); - values.Add(value); - } - result.Add(string.Concat(FieldName.VALUE), values.ToArray()); - return result; - } - - } - - } - -} diff --git a/Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs b/Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs deleted file mode 100644 index 63dcab7..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08ANLYSDIFAAST230.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System.Collections.Generic; -using System.Linq; - -namespace Adaptation.Metrology -{ - - internal class MET08ANLYSDIFAAST230 - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - Dictionary> results = new Dictionary>(); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs b/Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs deleted file mode 100644 index 333bcce..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08DDUPSFS6420.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08DDUPSFS6420 - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs b/Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs deleted file mode 100644 index b6bea17..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08DDUPSP1TBI.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08DDUPSP1TBI - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs b/Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs deleted file mode 100644 index b6bbb4e..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08RESIHGCV.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08RESIHGCV - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs b/Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs deleted file mode 100644 index 6313c30..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08RESIMAPCDE.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08RESIMAPCDE - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs b/Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs deleted file mode 100644 index 789060c..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08THFTIRQS408M.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08THFTIRQS408M - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs b/Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs deleted file mode 100644 index 1a49b32..0000000 --- a/Adaptation/Helpers/Si/Metrology/MET08THFTIRSTRATUS.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Metrology -{ - - internal class MET08THFTIRSTRATUS - { - - internal static Dictionary> GetPreRunInfo(Logistics logistics, EventName eventName) - { - //2019-12-27 - 001 - Dictionary> results; - StringBuilder sql = new StringBuilder(); - sql.Append(" SELECT "). - Append(" wafer_id, [run number], recipe, [part number], date, pocket_number, wafer_lot, [satellite group], ISNULL(( "). - Append(" SELECT max(startstamp) "). - Append(" FROM G4Wafers_01.dbo.ToolTimeInfo "). - Append(" WHERE (lot = @mid OR lot = @midSubstring) "). - Append(" ), date) startstamp "). - Append(" FROM G4Wafers_01.dbo.[prerun info] "). - Append(" WHERE (wafer_id = @mid OR [run number] = @mid) "). - Append(" ORDER by date "); - List> parameters = new List> - { - new Tuple("@midSubstring", string.Concat("'", logistics.MID.Substring(0, logistics.MID.Length - 2), "'")), - new Tuple("@mid", string.Concat("'", logistics.MID, "'")) - }; - results = SQLDatabase.ExecuteReader(sql, parameters, columns: 9, isG4Wafers: true, isIrmnSpc: false); - return results; - } - - internal static List Verify(EventName eventName, List results) - { - //2019-12-28 - 004 - if (results.Any()) - { - string partFromRecipe; - Dictionary> check; - StringBuilder sql = new StringBuilder(); - string lastPartFromRecipe = string.Empty; - List> parameters = new List>(); - for (int i = 0; i < results.Count; i++) - { - partFromRecipe = results[i].Recipe; - if (string.IsNullOrEmpty(lastPartFromRecipe) || partFromRecipe != lastPartFromRecipe) - { - // re-format recipe name by extracting middle part of it - if ((!partFromRecipe.ToUpper().StartsWith("PROD")) && - (!partFromRecipe.ToUpper().StartsWith("MAMD")) && - (!partFromRecipe.ToUpper().StartsWith("QUAL")) && - (!partFromRecipe.ToUpper().StartsWith("ENGR")) && - (!partFromRecipe.ToUpper().StartsWith("ANKO")) && - (!partFromRecipe.ToUpper().StartsWith("U"))) - partFromRecipe = "ENG"; - else if (partFromRecipe.Split('-').Length == 3) // recipe name has 3 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim() + "-" + partFromRecipe.Split('-')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('-').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('-')[0].Trim(); // first part of recipe name - else if (partFromRecipe.Split('_').Length == 3) - partFromRecipe = partFromRecipe.Split('_')[1].Trim(); // middle part of recipe name - else if (partFromRecipe.Split('_').Length == 2) // recipe name has 2 parts - partFromRecipe = partFromRecipe.Split('_')[0].Trim(); // first part of recipe name - if (results[i].PartNumber != partFromRecipe) - results[i].PartNumber = partFromRecipe; - if (partFromRecipe != "ENG") - { - sql.Append(" SELECT "). - Append(" count(*) AS my_count "). - Append(" FROM IRMNSPC.dbo.part_dat "). - Append(" WHERE f_name = @part "); - parameters.Clear(); - parameters.Add(new Tuple("@part", string.Concat("'", partFromRecipe, "'"))); - check = SQLDatabase.ExecuteReader(sql, parameters, columns: 1, isG4Wafers: true, isIrmnSpc: false); - if (check.ElementAt(0).Value[0].ToString() == "0") - { - partFromRecipe = "ENG"; - results[i].PartNumber = partFromRecipe; - } - } - } - lastPartFromRecipe = partFromRecipe; - } - } - return results; - } - - internal static string GetSid(List preRunInfo, bool isMappedPart, IScopeInfo scopeInfo, List tags) - { - string result = string.Empty; - if (preRunInfo.Any()) - { - result = tags[0]; - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/PreRunInfo.cs b/Adaptation/Helpers/Si/PreRunInfo.cs deleted file mode 100644 index 165fe3b..0000000 --- a/Adaptation/Helpers/Si/PreRunInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Adaptation.Shared; -namespace Adaptation.Si -{ - - public class PreRunInfo - { - - public string MID { get; private set; } - public string RunNumber { get; private set; } - public string Recipe { get; private set; } - public string PartNumber { get; internal set; } - public string Date { get; private set; } - public string PocketNumber { get; private set; } - public string WaferLot { get; private set; } - public string SatelliteGroup { get; private set; } - public string StartStamp { get; private set; } - public Logistics Logistics { get; private set; } - - public PreRunInfo(Logistics logistics, object partNumber) - { - MID = logistics.MID; - RunNumber = string.Empty; - Recipe = string.Empty; - PartNumber = partNumber.ToString(); - Date = logistics.DateTimeFromSequence.ToString(); - PocketNumber = "00"; - WaferLot = string.Empty; - SatelliteGroup = string.Empty; - StartStamp = logistics.DateTimeFromSequence.ToString(); - Logistics = logistics; - } - - public PreRunInfo(Logistics logistics, object mID, object runNumber, object recipe, object partNumber, object date, object pocketNumber, object waferLot, object satelliteGroup, object startStamp) - { - MID = mID.ToString(); - RunNumber = runNumber.ToString(); - Recipe = recipe.ToString(); - PartNumber = partNumber.ToString(); - Date = date.ToString(); - PocketNumber = pocketNumber.ToString(); - WaferLot = waferLot.ToString(); - SatelliteGroup = satelliteGroup.ToString(); - StartStamp = startStamp.ToString(); - Logistics = logistics; - } - - public override string ToString() - { - return string.Concat(MID, " - ", RunNumber, " - ", Recipe, " - ", PartNumber, " - ", Date, " - ", PocketNumber, " - ", WaferLot, " - ", SatelliteGroup, " - ", StartStamp); - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Helpers/Si/SQLDatabase.cs b/Adaptation/Helpers/Si/SQLDatabase.cs deleted file mode 100644 index ebe22cc..0000000 --- a/Adaptation/Helpers/Si/SQLDatabase.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data.SqlClient; -using System.Linq; -using System.Text; -using System.Threading; - -namespace Adaptation.Si -{ - - public class SQLDatabase - { - - private static string _ConnectionStringIrmnSpc; - private static string _ConnectionStringG4Wafers; - - public static void SetConnectionStringIrmnSpc(string connectionString) - { - _ConnectionStringIrmnSpc = connectionString; - } - - public static void SetConnectionStringG4Wafers(string connectionString) - { - _ConnectionStringG4Wafers = connectionString; - } - - public static Dictionary> ExecuteReader(StringBuilder rawSql, List> parameters, List> columns, bool isG4Wafers, bool isIrmnSpc) - { - Dictionary> results = new Dictionary>(); - foreach (var item in parameters) - rawSql.Replace(item.Item1, item.Item2); - string sql = rawSql.ToString(); - if (sql.Contains("@")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains("<")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains(">")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains("!")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - foreach (var item in columns) - results.Add(item.Item1, new List()); - string connectionString; - if (isG4Wafers && isIrmnSpc) - throw new Exception(); - else if (isG4Wafers) - connectionString = _ConnectionStringG4Wafers; - else if (isIrmnSpc) - connectionString = _ConnectionStringIrmnSpc; - else - throw new Exception(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - { - foreach (var item in columns) - results[item.Item1].Add(sqlReader.GetSqlValue(item.Item2)); - } - } - } - } - return results; - } - - public static Dictionary> ExecuteReader(StringBuilder rawSql, List> parameters, int columns, bool isG4Wafers, bool isIrmnSpc) - { - Dictionary> results = new Dictionary>(); - foreach (var item in parameters) - rawSql.Replace(item.Item1, item.Item2); - string sql = rawSql.ToString(); - if (sql.Contains("@")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains("{")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains("}")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - if (sql.Contains("!")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - string connectionString; - if (isG4Wafers && isIrmnSpc) - throw new Exception(); - else if (isG4Wafers) - connectionString = _ConnectionStringG4Wafers; - else if (isIrmnSpc) - connectionString = _ConnectionStringIrmnSpc; - else - throw new Exception(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - { - for (int i = 0; i < columns; i++) - { - if (!results.ContainsKey(i)) - results.Add(i, new List()); - results[i].Add(sqlReader.GetSqlValue(i)); - } - } - } - } - } - return results; - } - - private static int? CheckDisableHistory(string sid) - { - int? result = null; - if (sid != "1") - { - object exits; - StringBuilder sql = new StringBuilder(); - sql.Append("SELECT "); - sql.Append("hs.SID [SID] "); - sql.Append("FROM [IRMNSPC].[dbo].[HIST_DISABLE] hs "); - sql.Append("WHERE hs.SID = '").Append(sid).Append("' "); - using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn)) - exits = sqlComm.ExecuteScalar(); - } - if (exits is null) - { - sql.Clear(); - sql.Append("INSERT INTO HIST_DISABLE VALUES ('").Append(sid).Append("' , 0) "); - using (SqlConnection conn = new SqlConnection(_ConnectionStringIrmnSpc)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(sql.ToString(), conn)) - result = sqlComm.ExecuteNonQuery(); - } - } - } - return result; - } - - public static object ExecuteScalar(string sql, bool isMappedPart, double totalSecondsSinceLastWriteTime, Tuple replace, bool selectForSID, bool isG4Wafers, bool isIrmnSpc) - { - object result; - if (sql.Contains("@")) - throw new Exception("Invalid query (a parameter didn't get populated)!"); - List results = new List(); - for (int i = 1; i < 15; i++) - { - string connectionString; - if (isG4Wafers && isIrmnSpc) - throw new Exception(); - else if (isG4Wafers) - connectionString = _ConnectionStringG4Wafers; - else if (isIrmnSpc) - connectionString = _ConnectionStringIrmnSpc; - else - throw new Exception(); - using (SqlConnection conn = new SqlConnection(connectionString)) - { - conn.Open(); - using (SqlCommand sqlComm = new SqlCommand(sql, conn)) - { - using (SqlDataReader sqlReader = sqlComm.ExecuteReader()) - { - while (sqlReader.Read()) - results.Add(sqlReader.GetSqlValue(0)); - } - } - } - if (results.Any()) - break; - if ((i > 10 && !(replace is null)) || (!isMappedPart && totalSecondsSinceLastWriteTime > 1800) || totalSecondsSinceLastWriteTime > 432000 && sql.Contains(replace.Item1)) //30 minutes and 5 days - { - sql = sql.Replace(replace.Item1, replace.Item2); - continue; - } - if (!isMappedPart) - break; - for (int j = 1; j < 60; j++) - Thread.Sleep(500); - } - if (!isMappedPart && !results.Any()) - result = "-"; - else if (isMappedPart && !results.Any()) - throw new Exception("Didn't find a matching record!"); - else if (isMappedPart && results.Count > 1) - throw new Exception("Found more than one matching record!"); - else - { - result = results[0]; - if (selectForSID && results.Count() == 1) - { - int? exits = CheckDisableHistory(result.ToString()); - { } - } - } - return result; - } - - } - -} diff --git a/Adaptation/Helpers/Si/Transport.cs b/Adaptation/Helpers/Si/Transport.cs deleted file mode 100644 index ff01c26..0000000 --- a/Adaptation/Helpers/Si/Transport.cs +++ /dev/null @@ -1,945 +0,0 @@ -using Adaptation.Shared; -using Adaptation.Shared.Metrology; -using Infineon.Yoda; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Xml; - -namespace Adaptation.Si -{ - - internal class Transport - { - - private static object _IfxTransport; - private static ConfigData _ConfigData; - private static Dictionary> _Parameters; - - internal static void Initialize(ConfigData configData) - { - _IfxTransport = null; - _ConfigData = configData; - _Parameters = new Dictionary>(); - } - - internal static List Setup(bool useSleep, bool setIfxTransport, bool setParameters) - { - List results = new List(); - if (useSleep) - { - for (int i = 1; i < 50; i++) - Thread.Sleep(500); - } - if (setIfxTransport) - { - results.Add(string.Concat("IfxTransport Subject: ", _ConfigData.IfxSubject)); - IfxDoc ifxDoc = new IfxDoc(); - ifxDoc.Add(IfxConst.SUBJECT_PREFIX, _ConfigData.IfxSubjectPrefix); - ifxDoc.Add(IfxConst.IFX_CHANNEL, _ConfigData.IfxChannel); - ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION, _ConfigData.IfxConfigurationLocation); - ifxDoc.Add(IfxConst.IFX_CONFIGURATION_LOCATION_LOCAL_COPY, _ConfigData.IfxConfigurationLocationLocalCopy); - results.Add(string.Concat("IfxTransport Config: ", ifxDoc)); - _IfxTransport = new IfxTransport(); - IfxTransport ifxTransport = (IfxTransport)_IfxTransport; - ifxTransport.Create(ifxDoc); - if (useSleep) - { - for (int i = 1; i < 10; i++) - Thread.Sleep(500); - } - results.Add(string.Concat("IfxTransport Current Daemon: ", ifxTransport.CurrentDaemon)); - results.Add(string.Concat("IfxTransport Current Network: ", ifxTransport.CurrentNetwork)); - results.Add(string.Concat("IfxTransport Current Service: ", ifxTransport.CurrentService)); - results.Add(string.Concat("IfxTransport Current PoolName: ", ifxTransport.CurrentPoolName)); - } - if (setParameters) - { - try { _Parameters = GetParameters(); } catch { /* Dev doesn't have this table */ } - } - return results; - } - - private static Dictionary> GetParameters() - { - Dictionary> results = new Dictionary>(); - List parameters = Parameters.GetParameters(); - string iqsName; - foreach (var parameter in parameters) - { - iqsName = string.Concat(parameter.Iqs_name); - if (!results.ContainsKey(iqsName)) - results.Add(iqsName, new List()); - results[iqsName].Add(parameter); - } - return results; - } - - internal static bool IsMappedPart(List parts) - { - List check = (from l in parts where _ConfigData.MappedParts.Contains(l) select l).ToList(); - return check.Any(); - } - - internal static List GetDistinctParts(List preRunInfo) - { - List results = new List(); - foreach (var item in preRunInfo) - results.Add(item.PartNumber); - results = results.Distinct().ToList(); - return results; - } - - internal static Dictionary GetScopeInfoCollections(ILogic logic, ConfigData configData, Dictionary>> rawData, Dictionary> tests) - { - Dictionary results = new Dictionary(); - int min; - int max; - IScopeInfo scopeInfo; - foreach (var element in rawData) - { - min = tests[element.Key].Min(); - max = tests[element.Key].Max() + 1; - scopeInfo = new ScopeInfo(logic, configData, element.Key); - results.Add(element.Key, scopeInfo); - } - return results; - } - - internal static ExtractResult MergeAndMaybeSort(ExtractResult extractResult, List preRunInfo, Dictionary> tests) - { - if (!preRunInfo.Any()) - throw new Exception(); - if (tests.ElementAt(0).Key != Test.AFMRoughness && tests.ElementAt(0).Key != Test.UV) - { - int min; - int max; - List matchingPreRunInfo; - Dictionary> keyValuePairs; - foreach (var testKeyValuePair in tests) - { - min = testKeyValuePair.Value.Min(); - max = testKeyValuePair.Value.Max() + 1; - for (int i = min; i < max; i++) - { - switch (testKeyValuePair.Key) - { - default: - if (preRunInfo.Count != 1) - throw new Exception(); - else - matchingPreRunInfo = preRunInfo; - break; - } - if (matchingPreRunInfo.Count > 1) - throw new Exception(); - for (int g = 1; g < 3; g++) - { - switch (g) - { - case 1: keyValuePairs = extractResult.DatabaseHeaders; break; - case 2: keyValuePairs = extractResult.DatabaseDetails; break; - default: throw new Exception(); - } - foreach (var element in keyValuePairs) - { - if (matchingPreRunInfo.Count == 0) - element.Value[i] = string.Empty; - else - { - switch (element.Key) - { - case Column.SID: break; - //case "MID": element.Value[i] = matchingPreRunInfo[0].MID; break; - case Column.Lot: element.Value[i] = matchingPreRunInfo[0].RunNumber; break; - case Column.Recipe: element.Value[i] = matchingPreRunInfo[0].Recipe; break; - case Column.Part: element.Value[i] = matchingPreRunInfo[0].PartNumber; break; - case Column.Date: element.Value[i] = matchingPreRunInfo[0].Date; break; - case Column.Wafer_ID: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break; - case Column.WaferPocket_Candela: element.Value[i] = matchingPreRunInfo[0].PocketNumber; break; - case Column.Wafer_Scribe: element.Value[i] = matchingPreRunInfo[0].WaferLot; break; - //case "SatelliteGroup": element.Value[i] = matchingPreRunInfo[0].SatelliteGroup; break; - //case "StartStamp": element.Value[i] = matchingPreRunInfo[0].StartStamp; break; - default: throw new Exception(); - } - } - } - } - } - } - } - if (tests.ElementAt(0).Key == Test.CandelaKlarfDC || tests.ElementAt(0).Key == Test.CandelaLaser || tests.ElementAt(0).Key == Test.CandelaPSL || tests.ElementAt(0).Key == Test.CandelaVerify) - { - int min; - int max; - List sortIndeices; - List singleColumnSortedValues; - List singleColumnBeforeSortValues; - Dictionary> valuesCollection; - foreach (var testKeyValuePair in tests) - { - if (testKeyValuePair.Key == Test.CandelaKlarfDC || testKeyValuePair.Key == Test.CandelaLaser || testKeyValuePair.Key == Test.CandelaPSL || testKeyValuePair.Key == Test.CandelaVerify) - { - min = testKeyValuePair.Value.Min(); - max = testKeyValuePair.Value.Max() + 1; - sortIndeices = new List(); - singleColumnBeforeSortValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] select l).ToList(); - singleColumnSortedValues = (from l in extractResult.DatabaseDetails[Column.WaferPocket_Candela] orderby !string.IsNullOrEmpty(l), l select l).ToList(); - for (int i = min; i < max; i++) - sortIndeices.Add(singleColumnBeforeSortValues.IndexOf(singleColumnSortedValues[i])); - valuesCollection = new Dictionary>(); - foreach (var element in extractResult.DatabaseDetails) - { - valuesCollection.Add(element.Key, new List()); - for (int i = min; i < max; i++) - valuesCollection[element.Key].Add(extractResult.DatabaseDetails[element.Key][i]); - element.Value.Clear(); - for (int i = min; i < max; i++) - extractResult.DatabaseDetails[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]); - } - valuesCollection = new Dictionary>(); - foreach (var element in extractResult.Details) - { - valuesCollection.Add(element.Key, new List()); - for (int i = min; i < max; i++) - valuesCollection[element.Key].Add(extractResult.Details[element.Key][i]); - element.Value.Clear(); - for (int i = min; i < max; i++) - extractResult.Details[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]); - } - valuesCollection = new Dictionary>(); - foreach (var element in extractResult.Parameters) - { - valuesCollection.Add(element.Key, new List()); - for (int i = min; i < max; i++) - valuesCollection[element.Key].Add(extractResult.Parameters[element.Key][i]); - element.Value.Clear(); - for (int i = min; i < max; i++) - extractResult.Parameters[element.Key].Add(valuesCollection[element.Key][sortIndeices[i]]); - } - } - } - } - return extractResult; - } - - private static Dictionary> GetPartParameters(string partNumber, bool isMappedPart) - { - Dictionary> results = new Dictionary>(); - List partParameters = PartParameters.GetPartParameters(partNumber); - foreach (var partParameter in partParameters) - { - if (Convert.IsDBNull(partParameter.Enum) || !Enum.TryParse(partParameter.Enum.ToString(), out Column column)) - { - if (isMappedPart && partParameter.Crit_to_ship.ToString() == "CRIT") - throw new Exception(); - else - continue; - } - else - { - if (!results.ContainsKey(column)) - results.Add(column, new List()); - results[column].Add(partParameter); - } - } - return results; - } - - private static List GetPartHistory(string partNumber) - { - List results = PartHistory.GetPartHistory(partNumber); - return results; - } - - private static DataKeys GetDataKeys(Dictionary> columns, Logistics logistics, Dictionary> ignoreIndeices, DataKeys dataKeys, int r, bool forParameter) - { - DataKeys result = dataKeys; - Column key; - if (!forParameter) - { - key = Column.Employee; - if (!columns.ContainsKey(key)) - result.Employee = "AUTO"; - else - result.Employee = columns[key][r]; - } - key = Column.WaferPosition_BV; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferPosition = columns[key][r]; - key = Column.WaferPosition_CV; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferPosition = columns[key][r]; - key = Column.WaferPosition_Hall; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferPosition = columns[key][r]; - key = Column.WaferPosition_PR; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferPosition = columns[key][r]; - // - key = Column.Wafer_Region; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferRegion = columns[key][r]; - // - key = Column.Wafer_Scribe; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferScribe = columns[key][r]; - // - key = Column.X_Coord; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.X = columns[key][r]; - // - key = Column.Y_Coord; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.Y = columns[key][r]; - return result; - } - - private static ExtractorKeys GetExtractorKeys(Dictionary> columns, Logistics logistics, Dictionary> ignoreIndeices, ExtractorKeys extractorKeys, int r, bool forParameter) - { - ExtractorKeys result = extractorKeys; - Column key; - key = Column.Lot; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.Lot = columns[key][r]; - // - key = Column.Part; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.Part = columns[key][r]; - // - key = Column.Process; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.Process = columns[key][r]; - // - key = Column.Recipe; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.Recipe = columns[key][r]; - // - key = Column.Wafer_ID; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferID = columns[key][r]; - key = Column.Denton_Gun_Pocket; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferID = columns[key][r]; - key = Column.WaferPocket_Candela; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferID = columns[key][r]; - key = Column.WaferPocket_Warp; - if (columns.ContainsKey(key) && (!ignoreIndeices.ContainsKey(key) || !ignoreIndeices[key].Contains(r))) - result.WaferID = columns[key][r]; - return result; - } - - private static string GetUnit(string columnDiplayName, string columnDatabaseName) - { - string result; - if (_Parameters.ContainsKey(columnDiplayName) && !(_Parameters[columnDiplayName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDiplayName][0].Units.ToString())) - result = _Parameters[columnDiplayName][0].Units.ToString(); - else if (_Parameters.ContainsKey(columnDatabaseName) && !(_Parameters[columnDatabaseName][0].Units is null) && !string.IsNullOrEmpty(_Parameters[columnDatabaseName][0].Units.ToString())) - result = _Parameters[columnDatabaseName][0].Units.ToString(); - else - result = "xx"; - return result; - } - - private static double? GetLsl(PartParameters partParameters) - { - if (!(partParameters.Lsl is null) && !string.IsNullOrEmpty(partParameters.Lsl.ToString())) - { - double.TryParse(partParameters.Lsl.ToString(), out double lsl); - return lsl; - } - return null; - } - - private static double? GetUsl(PartParameters partParameters) - { - if (!(partParameters.Usl is null) && !string.IsNullOrEmpty(partParameters.Usl.ToString())) - { - double.TryParse(partParameters.Usl.ToString(), out double usl); - return usl; - } - return null; - } - - private static double? GetTsl(PartParameters partParameters) - { - if (!(partParameters.Target is null) && !string.IsNullOrEmpty(partParameters.Target.ToString())) - { - double.TryParse(partParameters.Target.ToString(), out double tsl); - return tsl; - } - return null; - } - - private static Dictionary> GetKeyValuePairs(Logistics logistics, ExtractResult extractResult, string xml2Text) - { - Dictionary> results = new Dictionary>(); - bool documentKeys = false; - bool fieldParameter = false; - bool isFirstParmeter = true; - bool documnetParameter = false; - string elementName = string.Empty; - const string elementField = "Field"; - bool fieldParameterNameKeys = false; - bool fieldParameterNameValue = false; - string attributeNameValue = string.Empty; - const string elementDocument = "Document"; - string parameterAttributeNameValue = string.Empty; - string keyOrSettingAttributeNameValue = string.Empty; - string parameterKeyAttributeNameValue = string.Empty; - const string attributeNameValueParameter = "PARAMETER"; - const string attributeNameValueParameterName = "PARAMETERNAME"; - StringReader stringReader = new StringReader(xml2Text); - XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { IgnoreWhitespace = true }; - XmlReader xmlReader = XmlReader.Create(stringReader, xmlReaderSettings); - while (xmlReader.Read()) - { - switch (xmlReader.NodeType) - { - case XmlNodeType.Element: - elementName = xmlReader.Name; - if (elementName == elementDocument || elementName == elementField) - { - while (xmlReader.HasAttributes && xmlReader.MoveToNextAttribute()) - { - if (xmlReader.Name == "name") - { - attributeNameValue = xmlReader.Value; - if (!documentKeys && attributeNameValue == "KEYS") - documentKeys = true; - else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue != attributeNameValueParameter) - keyOrSettingAttributeNameValue = attributeNameValue; - else if (documentKeys && !fieldParameter && elementName == elementField && attributeNameValue == attributeNameValueParameter) - fieldParameter = true; - else if (documentKeys && fieldParameter && elementName == elementDocument && attributeNameValue == attributeNameValueParameter && !documnetParameter) - documnetParameter = true; - else if (documentKeys && fieldParameter && documnetParameter && elementName == elementField && attributeNameValue == attributeNameValueParameterName && string.IsNullOrEmpty(parameterAttributeNameValue)) - { - xmlReader.Read(); xmlReader.Read(); parameterAttributeNameValue = xmlReader.Value; - } - else if (documentKeys && fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue)) - { - if (elementName == elementDocument && attributeNameValue == attributeNameValueParameter) - { - parameterAttributeNameValue = string.Empty; - if (isFirstParmeter) - isFirstParmeter = false; - if (fieldParameterNameValue) - fieldParameterNameValue = false; - if (fieldParameterNameKeys) - fieldParameterNameKeys = false; - if (!string.IsNullOrEmpty(parameterKeyAttributeNameValue)) - parameterKeyAttributeNameValue = string.Empty; - } - else if (attributeNameValue == "VALUE") - { - if (!fieldParameterNameValue) - fieldParameterNameValue = true; - if (fieldParameterNameKeys) - fieldParameterNameKeys = false; - } - else if (!fieldParameterNameKeys && attributeNameValue == "KEYS") - fieldParameterNameKeys = true; - else if (fieldParameterNameValue && fieldParameterNameKeys) - parameterKeyAttributeNameValue = attributeNameValue; - } - } - } - } - break; - case XmlNodeType.Text: - if (documentKeys && !documnetParameter) - { - if (!results.ContainsKey(keyOrSettingAttributeNameValue)) - results.Add(keyOrSettingAttributeNameValue, new List()); - results[keyOrSettingAttributeNameValue].Add(xmlReader.Value); - } - else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && !fieldParameterNameKeys) - { - if (!results.ContainsKey(parameterAttributeNameValue)) - results.Add(parameterAttributeNameValue, new List()); - results[parameterAttributeNameValue].Add(xmlReader.Value); - } - else if (fieldParameter && documnetParameter && !string.IsNullOrEmpty(parameterAttributeNameValue) && fieldParameterNameValue && fieldParameterNameKeys && isFirstParmeter) - { - if (!results.ContainsKey(parameterKeyAttributeNameValue)) - results.Add(parameterKeyAttributeNameValue, new List()); - results[parameterKeyAttributeNameValue].Add(xmlReader.Value); - } - break; - } - } - return results; - } - - internal static void SaveXmlAsHtml(Logistics logistics, ExtractResult extractResult, ConfigData configData, string xml2Text, string htmlDirectory, string file) - { - StringBuilder html = new StringBuilder(); - html.Clear(); - html.AppendLine(""); - html.AppendLine(""); - html.Append("").Append(configData.GetEquipmentType()).AppendLine(""); - html.AppendLine(""); - html.AppendLine(""); - int count; - string htmlFile; - List counts = new List(); - Array array = Enum.GetValues(typeof(Column)); - List allDataKeyNames = new List(); - List allSettingNames = new List(); - List logisticsColumns = new List(); - List presentSettingNames = new List(); - List allLDSParameterNames = new List(); - List allExtractorKeyNames = new List(); - List parameterOrRowColumns = new List(); - Dictionary> keyValuePairs = GetKeyValuePairs(logistics, extractResult, xml2Text); - foreach (var item in typeof(Settings).GetProperties()) - allSettingNames.Add(item.Name); - foreach (var item in typeof(ExtractorKeys).GetProperties()) - allExtractorKeyNames.Add(item.Name); - foreach (var item in typeof(DataKeys).GetProperties()) - allDataKeyNames.Add(item.Name); - foreach (var item in typeof(Parameter).GetProperties()) - allLDSParameterNames.Add(item.Name); - Dictionary columnNames = new Dictionary(); - foreach (Column column in array) - columnNames.Add(column.GetDiplayName(), column); - foreach (KeyValuePair> element in keyValuePairs) - { - counts.Add(element.Value.Count()); - if (columnNames.ContainsKey(element.Key)) - parameterOrRowColumns.Add(element.Key); - else - { - if (Enum.TryParse(element.Key, out Description.RowColumn rowColumnTry)) - parameterOrRowColumns.Add(rowColumnTry.ToString()); - else - { - if (Enum.TryParse(element.Key, out Description.LogisticsColumn logisticsColumnTry)) - logisticsColumns.Add(logisticsColumnTry.ToString()); - else - { - if (allSettingNames.Contains(element.Key)) - presentSettingNames.Add(element.Key); - else - { - if (allExtractorKeyNames.Contains(element.Key)) - parameterOrRowColumns.Add(element.Key); - else - { - if (allDataKeyNames.Contains(element.Key)) - parameterOrRowColumns.Add(element.Key); - else - { - if (allLDSParameterNames.Contains(element.Key)) - parameterOrRowColumns.Add(element.Key); - else - throw new Exception(); - } - } - } - } - } - } - } - count = counts.Max(); - html.AppendLine(""); - html.AppendLine(""); - foreach (var element in keyValuePairs) - { - if (element.Value.Count() == 0 && parameterOrRowColumns.Contains(element.Key)) - html.Append(""); - } - html.AppendLine(""); - html.AppendLine("
").Append(element.Key).AppendLine("
"); - // - html.AppendLine("
"); - // - html.AppendLine(""); - html.AppendLine(""); - foreach (var item in presentSettingNames) - html.Append(""); - html.AppendLine(""); - html.AppendLine(""); - foreach (var element in keyValuePairs) - { - if (presentSettingNames.Contains(element.Key)) - { - if (string.IsNullOrEmpty(element.Value[0])) - html.AppendLine(""); - else - html.Append(""); - } - } - html.AppendLine(""); - html.AppendLine("
").Append(item).AppendLine("
 ").Append(element.Value[0]).AppendLine("
"); - // - html.AppendLine("
"); - // - html.AppendLine(""); - html.AppendLine(""); - foreach (var item in logisticsColumns) - html.Append(""); - html.AppendLine(""); - for (int i = 0; i < 1; i++) - { - html.AppendLine(""); - foreach (var element in keyValuePairs) - { - if (logisticsColumns.Contains(element.Key)) - { - if (string.IsNullOrEmpty(element.Value[i])) - html.AppendLine(""); - else - html.Append(""); - } - } - } - html.AppendLine(""); - html.AppendLine("
").Append(item).AppendLine("
 ").Append(element.Value[i]).AppendLine("
"); - // - html.AppendLine("
"); - // - html.AppendLine(""); - html.AppendLine(""); - foreach (var item in parameterOrRowColumns) - html.Append(""); - html.AppendLine(""); - for (int i = 0; i < 1; i++) - { - html.AppendLine(""); - foreach (var element in keyValuePairs) - { - if (parameterOrRowColumns.Contains(element.Key)) - { - if (element.Value.Count() > 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i])) - html.Append(""); - else - { - if (!allExtractorKeyNames.Contains(element.Key) && element.Key != "SID") - html.Append(""); - else - html.Append(""); - } - } - } - html.AppendLine(""); - } - html.AppendLine("
").Append(item).AppendLine("
 ").Append(element.Value[i]).AppendLine("").Append(element.Value[i]).AppendLine("
"); - // - html.AppendLine("
"); - // - html.AppendLine(""); - html.AppendLine(""); - foreach (var item in parameterOrRowColumns) - html.Append(""); - html.AppendLine(""); - for (int i = 0; i < count; i++) - { - html.AppendLine(""); - foreach (var element in keyValuePairs) - { - if (parameterOrRowColumns.Contains(element.Key)) - { - if (element.Value.Count() == 1 || element.Value.Count() <= i || string.IsNullOrEmpty(element.Value[i])) - html.Append(""); - else - { - if (!allExtractorKeyNames.Contains(element.Key)) - html.Append(""); - else - html.Append(""); - } - } - } - html.AppendLine(""); - } - html.AppendLine("
").Append(item).AppendLine("
 ").Append(element.Value[i]).AppendLine("").Append(element.Value[i]).AppendLine("
"); - // - html.AppendLine(""); - html.AppendLine(""); - htmlFile = string.Concat(htmlDirectory, @"\", Path.GetFileNameWithoutExtension(file), ".html"); - File.WriteAllText(htmlFile, html.ToString()); - File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence); - try { File.SetLastWriteTime(htmlFile, logistics.DateTimeFromSequence); } catch (Exception) { } - } - - internal static Dictionary GetIfxDocs(Logistics logistics, ExtractResult extractResult, ConfigData configData, string writePath, Dictionary> tests, List distinctParts, Dictionary scopeInfoCollections, bool isMappedPart) - { - Dictionary results = new Dictionary(); - int c; - int min; - int max; - DATA data; - string sid; - string file; - IfxDoc ifxDoc; - string nullData; - string xml2Text; - IScopeInfo scopeInfo; - Parameter parameter; - string testAppendage; - string htmlDirectory; - List partHistory; - List rowCheck = new List(); - if (scopeInfoCollections.Any()) - { - string xmlDirectory = string.Empty; - ExtendedParameter extendedParameter; - List extendedParameters; - Dictionary> ignoreIndeices; - List parameters = new List(); - List parameterCollections = new List(); - string directory = string.Concat(writePath, @"\", configData.GetEquipmentType(), @"\Target"); - Dictionary> toolHeadersAndDatabaseHeadersCollection = extractResult.GetToolHeadersAndDatabaseHeadersCollection(); - Dictionary> toolDetailsAndDatabaseDetailsCollection = extractResult.GetToolDetailsAndDatabaseDetailsCollection(); - if (logistics.NullData is null) - nullData = string.Empty; - else - nullData = logistics.NullData.ToString(); - if (!distinctParts.Any()) - partHistory = new List(); - else - { - if (distinctParts.Count != 1) - throw new Exception(); - partHistory = GetPartHistory(distinctParts[0]); - } - if (!string.IsNullOrEmpty(writePath)) - { - xmlDirectory = string.Concat(directory, @"\xml"); - if (!Directory.Exists(xmlDirectory)) - Directory.CreateDirectory(xmlDirectory); - } - foreach (var testKeyValuePair in tests) - { - if (isMappedPart && !partHistory.Any()) - throw new Exception(); - min = testKeyValuePair.Value.Min(); - max = testKeyValuePair.Value.Max() + 1; - scopeInfo = scopeInfoCollections[testKeyValuePair.Key]; - ignoreIndeices = extractResult.IgnoreIndeices[testKeyValuePair.Key]; - data = new DATA(_ConfigData.IfxSubjectPrefix, logistics, scopeInfo, extractResult.DatabaseHeaders[Column.SID][min]); - if (toolHeadersAndDatabaseHeadersCollection.Any()) - { - data.DataKeys = GetDataKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.DataKeys, r: min, forParameter: false); - data.ExtractorKeys = GetExtractorKeys(toolHeadersAndDatabaseHeadersCollection, logistics, ignoreIndeices, data.ExtractorKeys, r: min, forParameter: false); - } - if (partHistory.Any()) - { - if (!(partHistory[0].Process_flow is null) && !string.IsNullOrEmpty(partHistory[0].Process_flow.ToString())) - data.ExtractorKeys.ProcessFlow = partHistory[0].Process_flow.ToString(); - } - c = 0; - parameterCollections.Clear(); - foreach (KeyValuePair> element in extractResult.Parameters) - { - rowCheck.Clear(); - for (int r = min; r < max; r++) - { - if (ignoreIndeices[element.Key].Contains(r)) - rowCheck.Add(r); - } - if (rowCheck.Count != (max - min)) - { - extendedParameters = extractResult.ExtendedParameters[element.Key]; - parameterCollections.Add(new ParameterCollection()); - for (int r = min; r < max; r++) - { - if (!ignoreIndeices[element.Key].Contains(r)) - { - extendedParameter = extendedParameters[r]; - if (!extendedParameter.Ignore.Value && extendedParameter.CriticalToShip.HasValue && extendedParameter.CriticalToShip.Value) - { - parameter = new Parameter(logistics, extendedParameter); - if (toolDetailsAndDatabaseDetailsCollection.Any()) - { - parameter.DataKeys = GetDataKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.DataKeys, r, forParameter: true); - parameter.ExtractorKeys = GetExtractorKeys(toolDetailsAndDatabaseDetailsCollection, logistics, ignoreIndeices, parameter.ExtractorKeys, r, forParameter: true); - } - parameterCollections[c].Collection.Add(parameter); - } - } - } - c += 1; - } - } - if (parameterCollections.Any()) - parameterCollections = (from l in parameterCollections where l.Collection.Any() select l).ToList(); - if (parameterCollections.Any()) - { - parameters.Clear(); - foreach (var item in parameterCollections) - parameters.Add(item.GetIfxDoc()); - ifxDoc = data.GetIfxDoc(parameters); - if (ifxDoc.GetFieldCount() == 0) - throw new Exception(); - else - { - xml2Text = ifxDoc.GetAsXml2(); - if (!(logistics.NullData is null) && !string.IsNullOrEmpty(nullData) && xml2Text.Contains(nullData)) - throw new Exception(); - if (xml2Text.Contains("-") && !(rowCheck is null)) - throw new Exception(); - if (!string.IsNullOrEmpty(writePath)) - { - //testAppendage = string.Concat(" - ", (int)element.Key); - testAppendage = string.Concat(" - ", scopeInfo.FileNameWithoutExtension); - file = string.Concat(xmlDirectory, @"\", logistics.JobID, "_", logistics.Sequence, testAppendage, ".xml"); - ifxDoc.Save(file, IfxConst.IfxDocFileType.Xml2, Overwrite: true); - if (logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) - { - try { File.SetLastWriteTime(file, logistics.DateTimeFromSequence); } catch (Exception) { } - } - htmlDirectory = string.Concat(directory, @"\html"); - if (!Directory.Exists(htmlDirectory)) - Directory.CreateDirectory(htmlDirectory); - SaveXmlAsHtml(logistics, extractResult, configData, xml2Text, htmlDirectory, file); - } - sid = extractResult.DatabaseHeaders[Column.SID][min]; - if (!isMappedPart && results.ContainsKey(sid)) - { - sid = string.Concat(sid, " ", DateTime.Now.Ticks.ToString()); - Thread.Sleep(100); - } - results.Add(sid, ifxDoc); - } - } - } - } - return results; - } - - internal static List SendIfxDocs(ILogic logic, ConfigData configData, bool isMappedPart, Dictionary ifxDocs) - { - List results = new List(); - IfxDoc reply; - string replyString; - LDS2559Reply.DATA lds2559Data; - if (_IfxTransport is null) - { - bool setParameters = !_Parameters.Any(); - List messages = Setup(useSleep: false, setIfxTransport: true, setParameters: setParameters); - foreach (string message in messages) - { - System.Diagnostics.Debug.Print(message); - } - } - if (_IfxTransport is null) - throw new Exception(); - else - { - IfxTransport ifxTransport = (IfxTransport)_IfxTransport; - if (isMappedPart && !(configData.EquipmentConnection is null)) - { - DateTime dateTime = new DateTime(2019, 08, 25); - if (!(logic.Logistics is null) && logic.Logistics.DateTimeFromSequence >= dateTime) - { - foreach (var element in ifxDocs) - { - if (element.Value.GetFieldCount() == 0) - throw new Exception(); - else - element.Value.Save(string.Concat(@"\\MESSV02ECC1.EC.LOCAL\EC_EAFLog\Production\IFXDocs\", configData.GetEquipmentType(), @"\", element.Key.Replace("*", string.Empty), ".xml"), IfxConst.IfxDocFileType.Xml2, Overwrite: true); - } - } - } - foreach (var element in ifxDocs) - { - if (element.Value.GetFieldCount() == 0) - throw new Exception(); - else - { - element.Value.SendSubject = string.Concat(ifxTransport.SubjectPrefix, ".", _ConfigData.IfxSubject); - if (ifxTransport.SubjectPrefix.StartsWith("MES_")) - { - ifxTransport.Publish(element.Value, false, 60); - lds2559Data = null; - } - else - { - if (!isMappedPart) - lds2559Data = null; - else - { - IfxEnvelope ifxEnvelope = ifxTransport.SendRequest(element.Value, false, 60, IfxConst.IfxMessageType.Yoda); - if (ifxEnvelope is null) - throw new Exception("SendRequest timeout occurred"); - else - { - reply = ifxEnvelope.ExtractDocument(); - replyString = reply.ToString(); - try { lds2559Data = new LDS2559Reply.DATA(reply); } catch (Exception) { lds2559Data = null; } - } - } - } - } - results.Add(lds2559Data); - } - } - return results; - } - - internal static string EvaluateSendResults(ILogic logic, ConfigData configData, List distinctParts, bool isMappedPart, List transportSendResults) - { - StringBuilder result = new StringBuilder(); - string mID; - if (logic is null || logic.Logistics is null || logic.Logistics.MID is null) - mID = string.Empty; - else - mID = logic.Logistics.MID; - string part; - if (!distinctParts.Any()) - part = string.Empty; - else - { - if (!isMappedPart) - part = distinctParts[0]; - else - part = string.Concat(distinctParts[0], " (Mapped) "); - } - if (!transportSendResults.Any()) - throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Nothing was sent!")); - foreach (var item in transportSendResults) - { - if (item is null) - result.AppendLine(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " null")); - else - { - if (item.UNACCEPTED is null || (!(item.ETC is null) && item.ETC.ToString() == "-1")) - throw new Exception(string.Concat(configData.GetEquipmentType(), " - ", mID, " - ", part, " Invalid data")); - else - { - double.TryParse(item.UNACCEPTED.ToString(), out double unaccepted); - if (unaccepted > 0) - throw new Exception("Unaccepted record present"); - else - result.AppendLine(string.Concat("Reply: ", item, Environment.NewLine, Environment.NewLine)); - } - } - } - return result.ToString(); - } - - } - -} diff --git a/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs index b6cb4b8..5a62594 100644 --- a/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs +++ b/Adaptation/Ifx/Eaf/Common/Configuration/ConnectionSetting.cs @@ -1,13 +1,17 @@ -namespace Adaptation.Ifx.Eaf.Common.Configuration -{ - [System.Runtime.Serialization.DataContractAttribute] - public class ConnectionSetting - { - public ConnectionSetting(string name, string value) { } +namespace Adaptation.Ifx.Eaf.Common.Configuration; + +[System.Runtime.Serialization.DataContract] +public class ConnectionSetting +{ + +#pragma warning disable CA2254 +#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; } - [System.Runtime.Serialization.DataMemberAttribute] - public string Name { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string Value { get; set; } - } } \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs index 4726692..1e5d6eb 100644 --- a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/File.cs @@ -1,19 +1,23 @@ using System; using System.Collections.Generic; -namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component; + +public class File { - public class File - { - public File(string filePath) { throw new NotImplementedException(); } - public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); } - public string Path { get; } - public DateTime TimeFound { get; } - public bool IsErrorFile { get; } - public Dictionary ContentParameters { get; } +#pragma warning disable CA2254 +#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 ContentParameters { get; } + + public File UpdateContentParameters(Dictionary contentParameters) => throw new NotImplementedException(); + public File UpdateParsingStatus(bool isErrorFile) => throw new NotImplementedException(); - public File UpdateContentParameters(Dictionary contentParameters) { throw new NotImplementedException(); } - public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); } - } } \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs index 561725e..5ab689e 100644 --- a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Component/FilePathGenerator.cs @@ -2,34 +2,39 @@ using System; using System.Collections.Generic; -namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component; + +public class FilePathGenerator { - public class FilePathGenerator - { - public const char PLACEHOLDER_IDENTIFIER = '%'; - public const char PLACEHOLDER_SEPARATOR = ':'; - public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; - public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName"; - public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension"; - public const string PLACEHOLDER_DATE_TIME = "DateTime"; - public const string PLACEHOLDER_SUB_FOLDER = "SubFolder"; - public const string PLACEHOLDER_CELL_NAME = "CellName"; - public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) { throw new NotImplementedException(); } - public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) { throw new NotImplementedException(); } - public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) { throw new NotImplementedException(); } +#pragma warning disable CA1822 +#pragma warning disable CA2254 +#pragma warning disable IDE0060 - protected string SubFolderPath { get; } - protected FileConnectorConfiguration Configuration { get; } - protected File File { get; } - protected bool IsErrorFile { get; } - protected string DefaultPlaceHolderValue { get; } + public const char PLACEHOLDER_IDENTIFIER = '%'; + public const char PLACEHOLDER_SEPARATOR = ':'; + public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; + public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName"; + public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension"; + public const string PLACEHOLDER_DATE_TIME = "DateTime"; + public const string PLACEHOLDER_SUB_FOLDER = "SubFolder"; + public const string PLACEHOLDER_CELL_NAME = "CellName"; + + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) => throw new NotImplementedException(); + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) => throw new NotImplementedException(); + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) => throw new NotImplementedException(); + + protected string SubFolderPath { get; } + protected FileConnectorConfiguration Configuration { get; } + protected File File { get; } + protected bool IsErrorFile { get; } + protected string DefaultPlaceHolderValue { get; } + + public string GetFullTargetPath() => throw new NotImplementedException(); + public virtual string GetTargetFileName() => throw new NotImplementedException(); + public string GetTargetFolder(bool throwExceptionIfNotExist = true) => throw new NotImplementedException(); + protected virtual string GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException(); + protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException(); + protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException(); - public string GetFullTargetPath() { throw new NotImplementedException(); } - public virtual string GetTargetFileName() { throw new NotImplementedException(); } - public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); } - protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); } - protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); } - protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); } - } } \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs index 5eafd1c..05fe1cc 100644 --- a/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/Configuration/FileConnectorConfiguration.cs @@ -2,134 +2,133 @@ using System; using System.Collections.Generic; -namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; + +[System.Runtime.Serialization.DataContract] +public class FileConnectorConfiguration { - [System.Runtime.Serialization.DataContractAttribute] - public class FileConnectorConfiguration + public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360; + public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15; + + [System.Runtime.Serialization.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 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 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 { - public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360; - public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15; - - [System.Runtime.Serialization.DataMemberAttribute] - public virtual bool? TriggerOnChanged { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? PostProcessingRetries { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual bool? CopySourceFolderStructure { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string AlternateTargetFolder { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public long? FileHandleTimeout { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public bool? DeleteEmptySourceSubFolders { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public long? IdleEventWaitTimeInSeconds { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string FileAgeThreshold { get; set; } - public bool? FolderAgeCheckIndividualSubFolders { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual ZipModeEnum? ZipMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public FileAgeFilterEnum? FileAgeFilterMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string ZipTargetFileName { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string ZipErrorTargetFileName { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public long? ZipFileSubFolderLevel { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string DefaultPlaceHolderValue { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public bool? UseZip64Mode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public List ConnectionSettings { get; set; } - public string SourceDirectoryCloaking { get; set; } - public string FolderAgeThreshold { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? FileScanningIntervalInSeconds { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual bool? TriggerOnCreated { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? ZipFileTime { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string SourceFileLocation { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string SourceFileFilter { get; set; } - public List SourceFileFilters { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual bool? IncludeSubDirectories { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual FileScanningOptionEnum? FileScanningOption { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string TargetFileLocation { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string ErrorTargetFileLocation { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string TargetFileName { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? FileHandleWaitTime { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public IfFileExistEnum? IfFileExistAction { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public long? ConnectionRetryInterval { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public PreProcessingModeEnum? PreProcessingMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public PostProcessingModeEnum? PostProcessingMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public virtual long? ZipFileAmount { get; set; } - [System.Runtime.Serialization.DataMemberAttribute] - public string ErrorTargetFileName { get; set; } - - public void Initialize() { throw new NotImplementedException(); } - - public enum PostProcessingModeEnum - { - None = 0, - Move = 1, - Copy = 2, - Rename = 3, - Zip = 4, - Delete = 5, - MoveFolder = 6, - CopyFolder = 7, - DeleteFolder = 8 - } - public enum PreProcessingModeEnum - { - None = 0, - Process = 1 - } - public enum IfFileExistEnum - { - Overwrite = 0, - LeaveFiles = 1, - Delete = 2 - } - public enum IfPostProcessingFailsEnum - { - LeaveFiles = 0, - Delete = 1 - } - public enum FileScanningOptionEnum - { - FileWatcher = 0, - TimeBased = 1 - } - public enum ZipModeEnum - { - ZipByAmountOrTime = 0, - ZipByFileName = 1, - ZipBySubFolderName = 2 - } - public enum FileAgeFilterEnum - { - IgnoreNewer = 0, - IgnoreOlder = 1 - } + None = 0, + Move = 1, + Copy = 2, + Rename = 3, + Zip = 4, + Delete = 5, + MoveFolder = 6, + CopyFolder = 7, + DeleteFolder = 8 + } + public enum PreProcessingModeEnum + { + None = 0, + Process = 1 + } + public enum IfFileExistEnum + { + Overwrite = 0, + LeaveFiles = 1, + Delete = 2 + } + public enum IfPostProcessingFailsEnum + { + LeaveFiles = 0, + Delete = 1 + } + public enum FileScanningOptionEnum + { + FileWatcher = 0, + TimeBased = 1 + } + public enum ZipModeEnum + { + ZipByAmountOrTime = 0, + ZipByFileName = 1, + ZipBySubFolderName = 2 + } + public enum FileAgeFilterEnum + { + IgnoreNewer = 0, + IgnoreOlder = 1 } } \ No newline at end of file diff --git a/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs index 84e0f19..9d9aa53 100644 --- a/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs +++ b/Adaptation/Ifx/Eaf/EquipmentConnector/File/SelfDescription/FileConnectorParameterTypeDefinitionProvider.cs @@ -2,13 +2,18 @@ using System; using System.Collections.Generic; -namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription -{ - public class FileConnectorParameterTypeDefinitionProvider - { - public FileConnectorParameterTypeDefinitionProvider() { } +namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription; - public IEnumerable GetAllParameterTypeDefinition() { return null; } - public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; } - } -} +public class FileConnectorParameterTypeDefinitionProvider +{ + +#pragma warning disable CA1822 +#pragma warning disable CA2254 +#pragma warning disable IDE0060 + + public FileConnectorParameterTypeDefinitionProvider() { } + + public IEnumerable GetAllParameterTypeDefinition() => null; + public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null; + +} \ No newline at end of file diff --git a/Adaptation/MET08ANLYSDIFAAST230.Tests.csproj b/Adaptation/MET08ANLYSDIFAAST230.Tests.csproj new file mode 100644 index 0000000..93e2826 --- /dev/null +++ b/Adaptation/MET08ANLYSDIFAAST230.Tests.csproj @@ -0,0 +1,92 @@ + + + SAK + SAK + SAK + SAK + + + enable + 10.0 + disable + win-x64 + net6.0 + false + + + trx + ../../../../MET08ANLYSDIFAAST230/05_TestResults/TestResults + + + true + true + true + + + Windows + + + OSX + + + Linux + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NU1701 + NU1701 + NU1701 + + + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + NU1701 + + + + Always + + + Always + + + \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs index c4e64f0..e32df4c 100644 --- a/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs +++ b/Adaptation/PeerGroup/GCL/Annotations/NotNullAttribute.cs @@ -1,10 +1,9 @@ using System; -namespace Adaptation.PeerGroup.GCL.Annotations +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 { - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)] - public sealed class NotNullAttribute : Attribute - { - public NotNullAttribute() { } - } + public NotNullAttribute() { } } \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs index 82138e2..af1ea65 100644 --- a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsConnectionMode.cs @@ -1,8 +1,7 @@ -namespace Adaptation.PeerGroup.GCL.SecsDriver +namespace Adaptation.PeerGroup.GCL.SecsDriver; + +public enum HsmsConnectionMode { - public enum HsmsConnectionMode - { - Active = 0, - Passive = 1 - } + Active = 0, + Passive = 1 } \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs index b52c7a3..eecd8b7 100644 --- a/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs +++ b/Adaptation/PeerGroup/GCL/SecsDriver/HsmsSessionMode.cs @@ -1,8 +1,7 @@ -namespace Adaptation.PeerGroup.GCL.SecsDriver +namespace Adaptation.PeerGroup.GCL.SecsDriver; + +public enum HsmsSessionMode { - public enum HsmsSessionMode - { - MultiSession = 0, - SingleSession = 1 - } + MultiSession = 0, + SingleSession = 1 } \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs index 81181f0..5e68d64 100644 --- a/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SecsTransportType.cs @@ -1,8 +1,7 @@ -namespace Adaptation.PeerGroup.GCL.SecsDriver +namespace Adaptation.PeerGroup.GCL.SecsDriver; + +public enum SecsTransportType { - public enum SecsTransportType - { - HSMS = 0, - Serial = 1 - } + HSMS = 0, + Serial = 1 } \ No newline at end of file diff --git a/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs index 4511319..a5bd2c3 100644 --- a/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs +++ b/Adaptation/PeerGroup/GCL/SecsDriver/SerialBaudRate.cs @@ -1,16 +1,15 @@ -namespace Adaptation.PeerGroup.GCL.SecsDriver +namespace Adaptation.PeerGroup.GCL.SecsDriver; + +public enum SerialBaudRate { - public enum SerialBaudRate - { - Baud9600 = 0, - Baud19200 = 1, - Baud4800 = 2, - Baud2400 = 3, - Baud1200 = 4, - Baud300 = 5, - Baud150 = 6, - Baud38400 = 7, - Baud57600 = 8, - Baud115200 = 9 - } + Baud9600 = 0, + Baud19200 = 1, + Baud4800 = 2, + Baud2400 = 3, + Baud1200 = 4, + Baud300 = 5, + Baud150 = 6, + Baud38400 = 7, + Baud57600 = 8, + Baud115200 = 9 } \ No newline at end of file diff --git a/Adaptation/Shared/CellInstance.cs b/Adaptation/Shared/CellInstance.cs deleted file mode 100644 index 5f28270..0000000 --- a/Adaptation/Shared/CellInstance.cs +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Adaptation/Shared/Deposition/DEP08EGANAIXG5H.cs b/Adaptation/Shared/Deposition/DEP08EGANAIXG5H.cs deleted file mode 100644 index e094385..0000000 --- a/Adaptation/Shared/Deposition/DEP08EGANAIXG5H.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Adaptation.Shared.Deposition -{ - - public class DEP08EGANAIXG5 - { - - public enum Test - { - GRATXTCenter = Deposition.Test.GRATXTCenter, - GRATXTEdge = Deposition.Test.GRATXTEdge, - GRAXMLCenter = Deposition.Test.GRAXMLCenter, - GRAXMLEdgeN = Deposition.Test.GRAXMLEdgeN, - Health = Deposition.Test.Health, - Temps = Deposition.Test.Temps, - ToolTime = Deposition.Test.ToolTime - } - - } - -} diff --git a/Adaptation/Shared/Deposition/Test.cs b/Adaptation/Shared/Deposition/Test.cs deleted file mode 100644 index 2bfa2fd..0000000 --- a/Adaptation/Shared/Deposition/Test.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Adaptation.Shared.Deposition -{ - - public enum Test - { - AFMRoughness = -1, - GRATXTCenter = 0, - GRATXTEdge = 1, - GRAXMLCenter = 2, - GRAXMLEdgeN = 3, - Health = 4, - Temps = 5, - ToolTime = 6 - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Description.cs b/Adaptation/Shared/Description.cs deleted file mode 100644 index 23f3701..0000000 --- a/Adaptation/Shared/Description.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Adaptation.Eaf.Core; -using Adaptation.Eaf.EquipmentCore.Control; -using Adaptation.Eaf.EquipmentCore.DataCollection.Reporting; -using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription; -using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes; -using Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription; -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace Adaptation.Shared -{ - - public class Description - { - - public enum RowColumn - { - Test = 1000, - Count, - Index - } - - public enum LogisticsColumn - { - EventName = 2000, - NullData, - JobID, - Sequence, - MesEntity, - ReportFullPath, - ProcessJobID, - MID - } - - public enum Param - { - String = 0, - Integer = 2, - Double = 3, - Boolean = 4, - StructuredType = 5 - } - - internal const string FileFound = "FileFound"; - - - public List EquipmentParameters { get; private set; } - public List ParameterTypeDefinitions { get; private set; } - - private readonly bool _UseCyclical; - private readonly List _HeaderNames; - private readonly Dictionary _KeyIndexPairs; - private readonly ParameterTypeDefinition _StructuredType; - private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider; - - public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl) - { - _KeyIndexPairs = new Dictionary(); - _HeaderNames = configDataBase.GetHeaderNames(logic); - _UseCyclical = configDataBase.UseCyclicalForDescription; - _StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List()); - _FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider(); - EquipmentParameters = new List(); - ParameterTypeDefinitions = new List { _StructuredType }; - Dictionary>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false); - List results = GetParameterValues(equipmentControl, keyValuePairsCollection); - } - - private List GetParameterValues(IEquipmentControl equipmentControl, Dictionary>> keyValuePairsCollection) - { - List results = new List(); - Enum param; - object value; - Enum[] @params; - string description; - List list; - EquipmentParameter equipmentParameter; - ParameterTypeDefinition parameterTypeDefinition; - bool addToEquipmentParameters = !EquipmentParameters.Any(); - foreach (KeyValuePair>> keyValuePair in keyValuePairsCollection) - { - if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key)) - continue; - @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); - if (@params.Length != 1) - throw new Exception(); - if (keyValuePair.Value[0].Item2 != keyValuePair.Key) - throw new Exception(); - param = @params[0]; - if (!addToEquipmentParameters) - equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]]; - else - { - description = keyValuePair.Value[0].Item3; - _KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count()); - if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key))) - parameterTypeDefinition = _StructuredType; - else - parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString()); - equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description); - EquipmentParameters.Add(equipmentParameter); - } - if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key)) - value = keyValuePair.Value[0].Item4; - else - { - list = new List(); - for (int i = 0; i < keyValuePair.Value.Count; i++) - list.Add(new object[] { i, keyValuePair.Value[i].Item4 }); - value = list; - } - if (equipmentControl is null || !(param is Param.StructuredType)) - results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now)); - else - results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value)); - } - return results; - } - - public List GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary keyValuePairs = null) - { - List results = new List(); - if (_UseCyclical && (i is null || i.Value > 0)) - throw new Exception(); - if (jsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - Enum param; - Tuple tuple; - JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); - Dictionary>> keyValuePairsCollection = new Dictionary>>(); - for (int r = i.Value; r < jsonElements.Length; r++) - { - foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject()) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) - { - param = Param.StructuredType; - //jValue = jObject.Value("Item1"); - throw new NotImplementedException("Item1"); - } - else - { - switch (jsonProperty.Value.ValueKind) - { - case JsonValueKind.String: param = Param.String; break; - case JsonValueKind.Number: param = Param.Double; break; - case JsonValueKind.True: - case JsonValueKind.False: param = Param.Boolean; break; - case JsonValueKind.Null: param = Param.String; break; - default: param = Param.StructuredType; break; - } - } - tuple = new Tuple(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString()); - if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name)) - keyValuePairsCollection.Add(jsonProperty.Name, new List>()); - keyValuePairsCollection[jsonProperty.Name].Add(tuple); - } - if (!_UseCyclical) - break; - } - results = GetParameterValues(equipmentControl, keyValuePairsCollection); - return results; - } - - public static string GetCellName() - { - string result; - if (Backbone.Instance?.CellName is null) - result = string.Empty; - else - result = Backbone.Instance.CellName; - if (result.Contains("-IO")) - result = result.Replace("-IO", string.Empty); - return result; - } - - } - -} diff --git a/Adaptation/Shared/Duplicator/Description.cs b/Adaptation/Shared/Duplicator/Description.cs new file mode 100644 index 0000000..abbb7a4 --- /dev/null +++ b/Adaptation/Shared/Duplicator/Description.cs @@ -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 IDescription.GetNames(IFileRead fileRead, Logistics logistics) + { + List results = new(); + IDescription description = GetDefault(fileRead, logistics); + string json = JsonSerializer.Serialize(description, description.GetType()); + object @object = JsonSerializer.Deserialize(json); + if (@object is not JsonElement jsonElement) + throw new Exception(); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + results.Add(jsonProperty.Name); + return results; + } + + List IDescription.GetDetailNames() + { + List results = new(); + return results; + } + + List IDescription.GetHeaderNames() + { + List results = new(); + return results; + } + + IDescription IDescription.GetDisplayNames() + { + Description result = GetDisplayNames(); + return result; + } + + List IDescription.GetParameterNames() + { + List results = new(); + return results; + } + + JsonProperty[] IDescription.GetDefault(IFileRead fileRead, Logistics logistics) + { + JsonProperty[] results; + IDescription description = GetDefault(fileRead, logistics); + string json = JsonSerializer.Serialize(description, description.GetType()); + object @object = JsonSerializer.Deserialize(json); + results = ((JsonElement)@object).EnumerateObject().ToArray(); + return results; + } + + List IDescription.GetPairedParameterNames() + { + List results = new(); + return results; + } + + List IDescription.GetIgnoreParameterNames(Test test) + { + List results = new(); + return results; + } + + IDescription IDescription.GetDefaultDescription(IFileRead fileRead, Logistics logistics) + { + Description result = GetDefault(fileRead, logistics); + return result; + } + + Dictionary IDescription.GetDisplayNamesJsonElement(IFileRead fileRead) + { + Dictionary results = new(); + IDescription description = GetDisplayNames(); + string json = JsonSerializer.Serialize(description, description.GetType()); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) + { + if (!results.ContainsKey(jsonProperty.Name)) + results.Add(jsonProperty.Name, string.Empty); + if (jsonProperty.Value is JsonElement jsonPropertyValue) + results[jsonProperty.Name] = jsonPropertyValue.ToString(); + } + return results; + } + + List IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData) + { + List results = new(); + return results; + } + + private 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; + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/EquipmentType.cs b/Adaptation/Shared/EquipmentType.cs deleted file mode 100644 index b00b414..0000000 --- a/Adaptation/Shared/EquipmentType.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace Adaptation.Shared -{ - - public enum EquipmentType - { - FileEquipment, - SemiEquipment, - // - DEP08EGANAIXG5, - // - MET08ANLYSDIFAAST230_Semi, - MET08DDUPSFS6420, - MET08DDUPSP1TBI, - MET08RESIHGCV, - MET08RESIMAPCDE, - MET08THFTIRQS408M, - MET08THFTIRSTRATUS, - // - MET08AFMD3100, - MET08BVHGPROBE, - MET08CVHGPROBE802B150, - MET08CVHGPROBE802B150_Monthly, - MET08CVHGPROBE802B150_Weekly, - MET08DDINCAN8620, - MET08DDINCAN8620_Daily, - MET08EBEAMINTEGRITY26, - MET08HALLHL5580, - MET08HALLHL5580_Monthly, - MET08HALLHL5580_Weekly, - MET08MESMICROSCOPE, - MET08NDFRESIMAP151C, - MET08NDFRESIMAP151C_Verification, - MET08PLMAPRPM, - MET08PLMAPRPM_Daily, - MET08PLMAPRPM_Verification, - MET08PLMPPLATO, - MET08PRFUSB4000, - MET08PRFUSB4000_Daily, - MET08PRFUSB4000_Monthly, - MET08PRFUSB4000_Weekly, - MET08PRFUSB4000_Verification, - MET08PRFUSB4000_Villach, - MET08UVH44GS100M, - MET08VPDSUBCON, - MET08WGEOMX203641Q, - MET08WGEOMX203641Q_Verification, - MET08XRDXPERTPROMRDXL, - MET08XRDXPERTPROMRDXL_Monthly, - MET08XRDXPERTPROMRDXL_Weekly, - METBRXRAYJV7300L - } - -} diff --git a/Adaptation/Shared/ExtendedParameter.cs b/Adaptation/Shared/ExtendedParameter.cs deleted file mode 100644 index 487c98e..0000000 --- a/Adaptation/Shared/ExtendedParameter.cs +++ /dev/null @@ -1,178 +0,0 @@ -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; - -namespace Adaptation.Shared -{ - - public class ExtendedParameter - { - - public string DiplayName { get; set; } - public string ControlPlanName { get; set; } - public bool? CriticalToShip { get; set; } - public string Unit { get; set; } - public double? LSL { get; set; } - public double? TSL { get; set; } - public double? USL { get; set; } - public string Value { get; set; } - public bool? Ignore { get; set; } - - //public class ExtractorKeys - public string Lot { get; set; } //1 - public string ToolID { get; set; } //2 - public string Process { get; set; } //3 - public string WaferID { get; set; } //4 - public string Part { get; set; } //5 - public string Recipe { get; set; } //6 - public string ProcessFlow { get; set; } //7 - - //public class DataKeys - public string Employee { get; set; } //1 - public string SID { get; set; } //2 - public string WaferRegion { get; set; } //3 - public string WaferScribe { get; set; } //4 - public string WaferPosition { get; set; } //5 - public string X { get; set; } //6 - public string Y { get; set; } //7 - public string EAFCellInstance { get; set; } //8 - public string EAFReference { get; set; } //9 - public string IQSReference { get; set; } //10 - - public ExtendedParameter(Logistics logistics, string diplayName, string controlPlanName) - { - DiplayName = diplayName; - ControlPlanName = controlPlanName; - CriticalToShip = null; - Unit = string.Empty; - LSL = null; - TSL = null; - USL = null; - Ignore = null; - Value = string.Empty; - //public class ExtractorKeys - Lot = string.Empty; //1 - ToolID = string.Empty; //2 - Process = string.Empty; //3 - WaferID = string.Empty; //4 - Part = string.Empty; //5 - Recipe = string.Empty; //6 - ProcessFlow = string.Empty; //7 - //public class DataKeys - Employee = string.Empty; //1 - SID = string.Empty; //2 - WaferRegion = string.Empty; //3 - WaferScribe = string.Empty; //4 - WaferPosition = string.Empty; //5 - X = string.Empty; //6 - Y = string.Empty; //7 - EAFCellInstance = string.Empty; //8 - EAFReference = string.Empty; //9 - IQSReference = string.Empty; //10 - // - Lot = "-"; - SID = "-"; - Part = "-"; - if (!(logistics is null)) - { - ToolID = logistics.MesEntity; - EAFCellInstance = logistics.JobID; - } - } - - public override string ToString() - { - return Value; - } - - internal void Set(EquipmentType equipmentConnection, string queryFilter, Dictionary allColumnCollection) - { - Column key; - EAFReference = equipmentConnection.ToString(); - if (string.IsNullOrEmpty(queryFilter)) - IQSReference = null; - else - IQSReference = queryFilter; - // - key = Column.SID; - if (!allColumnCollection.ContainsKey(key)) - SID = "-"; - else - SID = allColumnCollection[key]; - key = Column.Employee; - if (!allColumnCollection.ContainsKey(key)) - Employee = "AUTO"; - else - Employee = allColumnCollection[key]; - // - key = Column.Lot; - if (allColumnCollection.ContainsKey(key)) - Lot = allColumnCollection[key]; - // - key = Column.Part; - if (allColumnCollection.ContainsKey(key)) - Part = allColumnCollection[key]; - // - key = Column.Process; - if (allColumnCollection.ContainsKey(key)) - Process = allColumnCollection[key]; - // - key = Column.Recipe; - if (allColumnCollection.ContainsKey(key)) - Recipe = allColumnCollection[key]; - // - key = Column.Wafer_ID; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.Denton_Gun_Pocket; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.WaferPocket_Candela; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.WaferPocket_Warp; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - // - key = Column.Wafer_ID; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.Denton_Gun_Pocket; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.WaferPocket_Candela; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - key = Column.WaferPocket_Warp; - if (allColumnCollection.ContainsKey(key)) - WaferID = allColumnCollection[key]; - // - key = Column.Wafer_Region; - if (allColumnCollection.ContainsKey(key)) - WaferRegion = allColumnCollection[key]; - key = Column.Wafer_Scribe; - if (allColumnCollection.ContainsKey(key)) - WaferScribe = allColumnCollection[key]; - key = Column.WaferPosition_BV; - if (allColumnCollection.ContainsKey(key)) - WaferPosition = allColumnCollection[key]; - key = Column.WaferPosition_CV; - if (allColumnCollection.ContainsKey(key)) - WaferPosition = allColumnCollection[key]; - key = Column.WaferPosition_Hall; - if (allColumnCollection.ContainsKey(key)) - WaferPosition = allColumnCollection[key]; - key = Column.WaferPosition_PR; - if (allColumnCollection.ContainsKey(key)) - WaferPosition = allColumnCollection[key]; - key = Column.X_Coord; - if (allColumnCollection.ContainsKey(key)) - X = allColumnCollection[key]; - key = Column.Y_Coord; - if (allColumnCollection.ContainsKey(key)) - Y = allColumnCollection[key]; - } - - } - -} diff --git a/Adaptation/Shared/ExtractResult.cs b/Adaptation/Shared/ExtractResult.cs deleted file mode 100644 index db50320..0000000 --- a/Adaptation/Shared/ExtractResult.cs +++ /dev/null @@ -1,613 +0,0 @@ -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Adaptation.Shared -{ - - public class ExtractResult - { - - public object ProcessData { get; internal set; } - public long LastTicksDuration { get; private set; } - public long BreakAfterSeconds { get; private set; } - public Enum[] EnumColumns { get; protected set; } - public List SourceFiles { get; private set; } - public Column[] PairedColumns { get; protected set; } - public Dictionary> Headers { get; protected set; } - public Dictionary> Details { get; protected set; } - public Dictionary> Parameters { get; protected set; } - public Dictionary> ExtendedParameters { get; protected set; } - public Dictionary> DatabaseHeaders { get; protected set; } - public Dictionary> DatabaseDetails { get; protected set; } - public Dictionary> RowColumns { get; protected set; } - public Dictionary>> IgnoreIndeices { get; protected set; } - public Dictionary> LogisticsColumns { get; protected set; } - - public ExtractResult(ExtractResult extractResult, long breakAfterSeconds, Enum[] enumColumns, Column[] pairedColumns) - { - if (enumColumns is null) - enumColumns = new Enum[] { }; - if (pairedColumns is null) - pairedColumns = new Column[] { }; - ProcessData = null; - EnumColumns = enumColumns; - PairedColumns = pairedColumns; - SourceFiles = new List(); - if (!(extractResult is null) && !(extractResult.SourceFiles is null)) - SourceFiles.AddRange(extractResult.SourceFiles); - BreakAfterSeconds = breakAfterSeconds; - List headers = new List(); - List details = new List(); - List parameters = new List(); - List databaseHeaders = new List(); - List databaseDetails = new List(); - UpdateLastTicksDuration(breakAfterSeconds * 10000000); - Common(headers, details, parameters, databaseHeaders, databaseDetails); - } - - private void Common(List headers, List details, List parameters, List databaseHeaders, List databaseDetails) - { - Headers = new Dictionary>(); - Details = new Dictionary>(); - Parameters = new Dictionary>(); - ExtendedParameters = new Dictionary>(); - DatabaseHeaders = new Dictionary>(); - DatabaseDetails = new Dictionary>(); - IgnoreIndeices = new Dictionary>>(); - LogisticsColumns = new Dictionary>(); - foreach (Enum item in headers) - Headers.Add(item, new List()); - foreach (Enum item in details) - Details.Add(item, new List()); - foreach (Enum item in parameters) - Parameters.Add(item, new List()); - foreach (Enum item in parameters) - ExtendedParameters.Add(item, new List()); - foreach (Enum item in databaseHeaders) - DatabaseHeaders.Add(item, new List()); - foreach (Enum item in databaseDetails) - DatabaseDetails.Add(item, new List()); - Array array; - array = Enum.GetValues(typeof(Description.RowColumn)); - RowColumns = new Dictionary>(); - foreach (Description.RowColumn item in array) - RowColumns.Add(item, new List()); - array = Enum.GetValues(typeof(Description.LogisticsColumn)); - foreach (Description.LogisticsColumn item in array) - LogisticsColumns.Add(item, new List()); - } - - internal void Reset() - { - ProcessData = null; - SourceFiles.Clear(); - List headers = new List(); - List details = new List(); - List parameters = new List(); - List databaseHeaders = new List(); - List databaseDetails = new List(); - foreach (KeyValuePair> item in Headers) - headers.Add(item.Key); - foreach (KeyValuePair> item in Details) - details.Add(item.Key); - foreach (KeyValuePair> item in Parameters) - parameters.Add(item.Key); - foreach (KeyValuePair> item in DatabaseHeaders) - databaseHeaders.Add(item.Key); - foreach (KeyValuePair> item in DatabaseDetails) - databaseDetails.Add(item.Key); - Common(headers, details, parameters, databaseHeaders, databaseDetails); - } - - public ExtractResult ShallowCopy() - { - return (ExtractResult)this.MemberwiseClone(); - } - - internal void HeadersAddRange(Enum column) - { - Headers.Add(column, new List()); - } - - internal void HeadersAddRange(params Enum[] columns) - { - foreach (Enum item in columns) - Headers.Add(item, new List()); - } - - internal void HeadersAddRange(List columns) - { - foreach (Enum item in columns) - Headers.Add(item, new List()); - } - - internal void DetailsAddRange(Enum column) - { - Details.Add(column, new List()); - } - - internal void DetailsAddRange(params Enum[] columns) - { - foreach (Enum item in columns) - Details.Add(item, new List()); - } - - internal void DetailsAddRange(List columns) - { - foreach (Enum item in columns) - Details.Add(item, new List()); - } - - internal void ParametersAddRange(Enum column) - { - Parameters.Add(column, new List()); - } - - internal void ParametersAddRange(params Enum[] columns) - { - foreach (Enum item in columns) - Parameters.Add(item, new List()); - } - - internal void ParametersAddRange(List columns) - { - foreach (Enum item in columns) - Parameters.Add(item, new List()); - } - - internal void DatabaseHeadersAddRange(Enum column) - { - DatabaseHeaders.Add(column, new List()); - } - - internal void DatabaseHeadersAddRange(params Enum[] columns) - { - foreach (Enum item in columns) - DatabaseHeaders.Add(item, new List()); - } - - internal void DatabaseHeadersAddRange(List columns) - { - foreach (Enum item in columns) - DatabaseHeaders.Add(item, new List()); - } - - internal void DatabaseDetailsAddRange(Enum column) - { - DatabaseDetails.Add(column, new List()); - } - - internal void DatabaseDetailsAddRange(params Enum[] columns) - { - foreach (Enum item in columns) - DatabaseDetails.Add(item, new List()); - } - - internal void DatabaseDetailsAddRange(List columns) - { - foreach (Enum item in columns) - DatabaseDetails.Add(item, new List()); - } - - internal int GetCount() - { - int result; - List counts = new List - { - RowColumns[Description.RowColumn.Test].Count() - }; - foreach (KeyValuePair> item in Headers) - counts.Add(item.Value.Count()); - foreach (KeyValuePair> item in Details) - counts.Add(item.Value.Count()); - foreach (KeyValuePair> item in Parameters) - counts.Add(item.Value.Count()); - foreach (KeyValuePair> item in DatabaseHeaders) - counts.Add(item.Value.Count()); - foreach (KeyValuePair> item in DatabaseDetails) - counts.Add(item.Value.Count()); - result = counts.Max(); - if (counts.Distinct().Count() != 1) - throw new Exception(); - return result; - } - - private Dictionary> Merge(List>> keyValuePairs) - { - Dictionary> results = new Dictionary>(); - foreach (KeyValuePair> element in keyValuePairs) - results.Add(element.Key, element.Value); - return results; - } - - private List>> GetAllColumnKeyValuePairs() - { - List>> results = new List>>(); - foreach (KeyValuePair> item in Headers) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in Details) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in Parameters) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in DatabaseHeaders) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in DatabaseDetails) - results.Add(new KeyValuePair>(item.Key, item.Value)); - return results; - } - - internal Dictionary> GetAllColumnCollection() - { - Dictionary> results; - if (!EnumColumns.Any()) - { - List>> keyValuePairs = GetAllColumnKeyValuePairs(); - results = Merge(keyValuePairs); - } - else - { - results = new Dictionary>(); - foreach (Enum item in EnumColumns) - results.Add(item, new List()); - foreach (Column item in PairedColumns) - results.Add(item, new List()); - foreach (KeyValuePair> item in Headers) - results[item.Key].AddRange(item.Value); - foreach (KeyValuePair> item in Details) - results[item.Key].AddRange(item.Value); - foreach (KeyValuePair> item in Parameters) - results[item.Key].AddRange(item.Value); - foreach (KeyValuePair> item in DatabaseHeaders) - results[item.Key].AddRange(item.Value); - foreach (KeyValuePair> item in DatabaseDetails) - results[item.Key].AddRange(item.Value); - int count = GetCount(); - foreach (KeyValuePair> keyValuePair in results) - { - for (int i = keyValuePair.Value.Count; i < count; i++) - results[keyValuePair.Key].Add(string.Empty); - } - } - return results; - } - - private Dictionary Merge(List> keyValuePairs) - { - Dictionary results = new Dictionary(); - foreach (KeyValuePair element in keyValuePairs) - results.Add(element.Key, element.Value); - return results; - } - - private List> GetAllColumnKeyValuePairs(int? i) - { - List> results = new List>(); - if (i.HasValue) - { - foreach (KeyValuePair> item in Headers) - results.Add(new KeyValuePair(item.Key, item.Value[i.Value])); - foreach (KeyValuePair> item in Details) - results.Add(new KeyValuePair(item.Key, item.Value[i.Value])); - foreach (KeyValuePair> item in Parameters) - results.Add(new KeyValuePair(item.Key, item.Value[i.Value])); - foreach (KeyValuePair> item in DatabaseHeaders) - results.Add(new KeyValuePair(item.Key, item.Value[i.Value])); - foreach (KeyValuePair> item in DatabaseDetails) - results.Add(new KeyValuePair(item.Key, item.Value[i.Value])); - } - return results; - } - - internal Dictionary GetAllColumnCollection(int? i) - { - Dictionary results; - List> keyValuePairs = GetAllColumnKeyValuePairs(i); - results = Merge(keyValuePairs); - return results; - } - - private List>> GetToolHeadersAndDatabaseHeadersColumnKeyValuePairs() - { - List>> results = new List>>(); - foreach (KeyValuePair> item in Headers) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in DatabaseHeaders) - results.Add(new KeyValuePair>(item.Key, item.Value)); - return results; - } - - internal Dictionary> GetToolHeadersAndDatabaseHeadersCollection() - { - Dictionary> results; - List>> keyValuePairs = GetToolHeadersAndDatabaseHeadersColumnKeyValuePairs(); - results = Merge(keyValuePairs); - return results; - } - - private List>> GetToolDetailsAndDatabaseDetailsColumnKeyValuePairs() - { - List>> results = new List>>(); - foreach (KeyValuePair> item in Details) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in Parameters) - results.Add(new KeyValuePair>(item.Key, item.Value)); - foreach (KeyValuePair> item in DatabaseDetails) - results.Add(new KeyValuePair>(item.Key, item.Value)); - return results; - } - - internal Dictionary> GetToolDetailsAndDatabaseDetailsCollection() - { - Dictionary> results; - List>> keyValuePairs = GetToolDetailsAndDatabaseDetailsColumnKeyValuePairs(); - results = Merge(keyValuePairs); - return results; - } - - internal Dictionary> GetTests() - { - Dictionary> results = new Dictionary>(); - Test test; - for (int i = 0; i < RowColumns[Description.RowColumn.Test].Count; i++) - { - test = (Test)RowColumns[Description.RowColumn.Test][i]; - if (!results.ContainsKey(test)) - results.Add(test, new List()); - results[test].Add(i); - } - return results; - } - - internal void FillIn(string nullData, int count, Enum[] currentColumns) - { - foreach (Enum column in Headers.Keys) - { - for (int i = Headers[column].Count(); i < count; i++) - Headers[column].Add(nullData); - } - foreach (Enum column in Details.Keys) - { - for (int i = Details[column].Count(); i < count; i++) - Details[column].Add(nullData); - } - if (!(currentColumns is null)) - { - foreach (Enum column in currentColumns) - { - for (int i = Parameters[column].Count(); i < count; i++) - Parameters[column].Add(nullData); - } - } - foreach (Enum column in Parameters.Keys) - { - for (int i = Parameters[column].Count(); i < count; i++) - Parameters[column].Add(string.Empty); - } - foreach (Enum column in DatabaseHeaders.Keys) - { - for (int i = DatabaseHeaders[column].Count(); i < count; i++) - DatabaseHeaders[column].Add(string.Empty); - } - foreach (Enum column in DatabaseDetails.Keys) - { - for (int i = DatabaseDetails[column].Count(); i < count; i++) - DatabaseDetails[column].Add(string.Empty); - } - if (RowColumns[Description.RowColumn.Count].Count() != RowColumns[Description.RowColumn.Test].Count()) - { - count = RowColumns[Description.RowColumn.Test].Count(); - RowColumns[Description.RowColumn.Count].Clear(); - for (int i = 0; i < count; i++) - RowColumns[Description.RowColumn.Count].Add(count); - } - } - - internal void SetCollections(Logistics logistics, Dictionary>> rawData) - { - Array array; - Column? column; - bool recordStartPresent = false; - Description.RowColumn? rowColumn; - Description.LogisticsColumn? logisticsColumn; - array = Enum.GetValues(typeof(Description.RowColumn)); - Dictionary headers = new Dictionary(); - Dictionary details = new Dictionary(); - Dictionary parameters = new Dictionary(); - Dictionary databaseHeaders = new Dictionary(); - Dictionary databaseDetails = new Dictionary(); - Dictionary> rowColumns = new Dictionary>(); - foreach (KeyValuePair> item in Headers) - headers.Add(item.Key.ToString(), item.Key); - foreach (KeyValuePair> item in Details) - details.Add(item.Key.ToString(), item.Key); - foreach (KeyValuePair> item in Parameters) - parameters.Add(item.Key.ToString(), item.Key); - foreach (KeyValuePair> item in DatabaseHeaders) - databaseHeaders.Add(item.Key.ToString(), item.Key); - foreach (KeyValuePair> item in DatabaseDetails) - databaseDetails.Add(item.Key.ToString(), item.Key); - foreach (Description.RowColumn item in array) - rowColumns.Add(item, new List()); - foreach (KeyValuePair>> element in rawData) - { - foreach (KeyValuePair> item in element.Value) - { - column = null; - rowColumn = null; - logisticsColumn = null; - if (item.Key == "Time") - continue; - else if (item.Key == "A_LOGISTICS") - continue; - else if (item.Key == "B_LOGISTICS") - continue; - else if (item.Key == "EventId") - continue; - else if (item.Key == ProcessDataStandardFormat.RecordStart) - { - recordStartPresent = true; - continue; - } - if (Enum.TryParse(item.Key, out Column columnTry)) - column = columnTry; - else - { - if (Enum.TryParse(item.Key, out Description.LogisticsColumn logisticsColumnTry)) - logisticsColumn = logisticsColumnTry; - else - { - if (Enum.TryParse(item.Key, out Description.RowColumn rowColumnTry)) - rowColumn = rowColumnTry; - } - } - if (rowColumn.HasValue) - rowColumns[rowColumn.Value].AddRange(item.Value); - else if (logisticsColumn.HasValue) - LogisticsColumns[logisticsColumn.Value].AddRange(item.Value); - else if (column.HasValue) - { - if (Headers.ContainsKey(column.Value)) - Headers[column.Value].AddRange(item.Value); - else if (Details.ContainsKey(column.Value)) - Details[column.Value].AddRange(item.Value); - else if (Parameters.ContainsKey(column.Value)) - Parameters[column.Value].AddRange(item.Value); - else if (DatabaseHeaders.ContainsKey(column.Value)) - DatabaseHeaders[column.Value].AddRange(item.Value); - else if (DatabaseDetails.ContainsKey(column.Value)) - DatabaseDetails[column.Value].AddRange(item.Value); - else - { - if (!recordStartPresent) - throw new Exception(); - } - } - else - { - if (headers.ContainsKey(item.Key)) - Headers[headers[item.Key]].AddRange(item.Value); - else if (details.ContainsKey(item.Key)) - Details[details[item.Key]].AddRange(item.Value); - else if (parameters.ContainsKey(item.Key)) - Parameters[parameters[item.Key]].AddRange(item.Value); - else if (databaseHeaders.ContainsKey(item.Key)) - DatabaseHeaders[databaseHeaders[item.Key]].AddRange(item.Value); - else if (databaseDetails.ContainsKey(item.Key)) - DatabaseDetails[databaseDetails[item.Key]].AddRange(item.Value); - else - { - if (!recordStartPresent) - throw new Exception(); - } - } - } - } - foreach (KeyValuePair> element in rowColumns) - { - for (int i = 0; i < element.Value.Count(); i++) - { - int.TryParse(element.Value[i], out int rowColumnTry); - RowColumns[element.Key].Add(rowColumnTry); - } - } - array = Enum.GetValues(typeof(Description.RowColumn)); - foreach (Description.RowColumn item in array) - { - if (!RowColumns.ContainsKey(item)) - throw new Exception(); - } - array = Enum.GetValues(typeof(Description.LogisticsColumn)); - foreach (Description.LogisticsColumn item in array) - { - if (!LogisticsColumns.ContainsKey(item)) - throw new Exception(); - } - int count = rowColumns[Description.RowColumn.Test].Count(); - foreach (KeyValuePair> element in DatabaseHeaders) - { - for (int i = element.Value.Count(); i < count; i++) - element.Value.Add(string.Empty); - } - foreach (KeyValuePair> element in DatabaseDetails) - { - for (int i = element.Value.Count(); i < count; i++) - element.Value.Add(string.Empty); - } - string nullData; - if (logistics.NullData is null) - nullData = string.Empty; - else - nullData = logistics.NullData.ToString(); - Dictionary> keyValuePairs; - foreach (Test key in rawData.Keys) - { - IgnoreIndeices.Add(key, new Dictionary>()); - for (int g = 1; g < 4; g++) - { - switch (g) - { - case 1: keyValuePairs = Details; break; - case 2: keyValuePairs = Parameters; break; - case 3: keyValuePairs = DatabaseDetails; break; - default: throw new Exception(); - } - foreach (KeyValuePair> element in keyValuePairs) - { - IgnoreIndeices[key].Add(element.Key, new List()); - if (!element.Value.Any()) - { - for (int i = 0; i < RowColumns[Description.RowColumn.Test].Count(); i++) - { - IgnoreIndeices[key][element.Key].Add(i); - element.Value.Add(string.Empty); - } - } - else - { - for (int i = 0; i < element.Value.Count(); i++) - { - if (RowColumns[Description.RowColumn.Test][i] == (int)key) - { - if (string.IsNullOrEmpty(element.Value[i])) - IgnoreIndeices[key][element.Key].Add(i); - else if (!(logistics.NullData is null) && element.Value[i] == nullData) - IgnoreIndeices[key][element.Key].Add(i); - } - } - } - } - } - } - if (recordStartPresent) - FillIn(string.Empty, RowColumns[Description.RowColumn.Test].Count(), currentColumns: null); - GetCount(); - } - - internal void UpdateLastTicksDuration(long ticksDuration) - { - if (ticksDuration < 50000000) - ticksDuration = 50000000; - LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); - } - - internal void AutoAdd(Enum key, string value) - { - if (Headers.ContainsKey(key)) - Headers[key].Add(value); - else if (Details.ContainsKey(key)) - Details[key].Add(value); - else if (Parameters.ContainsKey(key)) - Parameters[key].Add(value); - else if (DatabaseHeaders.ContainsKey(key)) - DatabaseHeaders[key].Add(value); - else if (DatabaseDetails.ContainsKey(key)) - DatabaseDetails[key].Add(value); - else - throw new Exception(); - } - - } - -} diff --git a/Adaptation/Shared/FileRead.cs b/Adaptation/Shared/FileRead.cs new file mode 100644 index 0000000..6127ed5 --- /dev/null +++ b/Adaptation/Shared/FileRead.cs @@ -0,0 +1,815 @@ +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared.Methods; +using log4net; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading; + +namespace Adaptation.Shared; + +public class FileRead : Properties.IFileRead +{ + + protected string _NullData; + protected readonly ILog _Log; + protected long _MinFileLength; + protected Logistics _Logistics; + protected readonly ISMTP _SMTP; + protected readonly int _Hyphens; + protected readonly bool _IsEvent; + protected string _ReportFullPath; + protected long _LastTicksDuration; + protected readonly bool _IsEAFHosted; + protected readonly string _EventName; + protected readonly string _MesEntity; + protected readonly string _TracePath; + protected readonly bool _IsDuplicator; + protected readonly Calendar _Calendar; + protected readonly bool _IsSourceTimer; + protected readonly string _VillachPath; + protected readonly string _ProgressPath; + protected readonly string _EquipmentType; + protected readonly long _BreakAfterSeconds; + protected readonly string _ExceptionSubject; + protected readonly string _CellInstanceName; + protected readonly string _EventNameFileRead; + protected readonly IDescription _Description; + protected readonly bool _UseCyclicalForDescription; + protected readonly string _CellInstanceConnectionName; + protected readonly string _CellInstanceConnectionNameBase; + protected readonly Dictionary> _DummyRuns; + protected readonly Dictionary _FileParameter; + protected readonly string _ParameterizedModelObjectDefinitionType; + protected readonly FileConnectorConfiguration _FileConnectorConfiguration; + protected readonly IList _ModelObjectParameterDefinitions; + + bool Properties.IFileRead.IsEvent => _IsEvent; + string Properties.IFileRead.NullData => _NullData; + string Properties.IFileRead.EventName => _EventName; + string Properties.IFileRead.MesEntity => _MesEntity; + bool Properties.IFileRead.IsEAFHosted => _IsEAFHosted; + string Properties.IFileRead.EquipmentType => _EquipmentType; + string Properties.IFileRead.ReportFullPath => _ReportFullPath; + string Properties.IFileRead.CellInstanceName => _CellInstanceName; + string Properties.IFileRead.ExceptionSubject => _ExceptionSubject; + bool Properties.IFileRead.UseCyclicalForDescription => _UseCyclicalForDescription; + string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName; + string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType; + + public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, Dictionary> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) + { + _SMTP = smtp; + _IsEvent = isEvent; + _DummyRuns = dummyRuns; + _LastTicksDuration = 0; + _IsEAFHosted = isEAFHosted; + _Description = description; + _FileParameter = fileParameter; + _ReportFullPath = string.Empty; + _CellInstanceName = cellInstanceName; + _Calendar = new CultureInfo("en-US").Calendar; + _Log = LogManager.GetLogger(typeof(FileRead)); + _UseCyclicalForDescription = useCyclicalForDescription; + _CellInstanceConnectionName = cellInstanceConnectionName; + _ModelObjectParameterDefinitions = modelObjectParameters; + _FileConnectorConfiguration = fileConnectorConfiguration; + _ParameterizedModelObjectDefinitionType = parameterizedModelObjectDefinitionType; + _IsSourceTimer = fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt"); + string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty); + _Hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length; + _ExceptionSubject = string.Concat("Exception:", _CellInstanceConnectionName, _FileConnectorConfiguration?.SourceDirectoryCloaking); + string suffix; + string[] segments = _ParameterizedModelObjectDefinitionType.Split('.'); + string @namespace = segments[0]; + string eventNameFileRead = "FileRead"; + string eventName = segments[segments.Length - 1]; + bool isDuplicator = segments[0] == cellInstanceName; + _IsDuplicator = isDuplicator; + _CellInstanceConnectionNameBase = cellInstanceConnectionNameBase; + if (eventName == eventNameFileRead) + suffix = string.Empty; + else + suffix = string.Concat('_', eventName.Split(new string[] { eventNameFileRead }, StringSplitOptions.RemoveEmptyEntries)[1]); + string parameterizedModelObjectDefinitionTypeAppended = string.Concat(@namespace, suffix); + if (!isEAFHosted) + { + // if (string.IsNullOrEmpty(equipmentTypeName) || equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended) + // throw new Exception(cellInstanceConnectionName); + // if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent) + // throw new Exception(cellInstanceConnectionName); + // if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent) + // throw new Exception(cellInstanceConnectionName); + // if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent) + // throw new Exception(cellInstanceConnectionName); + // if (!string.IsNullOrEmpty(equipmentDictionaryName) && isEvent) + // throw new Exception(cellInstanceConnectionName); + } + ModelObjectParameterDefinition[] paths = GetProperties(cellInstanceConnectionName, modelObjectParameters, "Path."); + if (paths.Length < 4) + throw new Exception(cellInstanceConnectionName); + if (isDuplicator) + _MesEntity = string.Empty; + else + _MesEntity = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, string.Concat("CellInstance.", cellInstanceName, ".Alias")); + _TracePath = (from l in paths where l.Name.EndsWith("Trace") select l.Value).FirstOrDefault(); + _VillachPath = (from l in paths where l.Name.EndsWith("Villach") select l.Value).FirstOrDefault(); + _ProgressPath = (from l in paths where l.Name.EndsWith("Progress") select l.Value).FirstOrDefault(); + _EventName = eventName; + _EventNameFileRead = eventNameFileRead; + _EquipmentType = parameterizedModelObjectDefinitionTypeAppended; + long breakAfterSeconds; + if (_FileConnectorConfiguration is null) + breakAfterSeconds = 360; + else + { + if (_FileConnectorConfiguration.FileScanningOption == FileConnectorConfiguration.FileScanningOptionEnum.TimeBased) + breakAfterSeconds = 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 modelObjectParameters, string propertyName) + { + string result; + List results = (from l in modelObjectParameters where l.Name == propertyName select l.Value).ToList(); + if (results.Count != 1) + throw new Exception(cellInstanceConnectionName); + result = results[0]; + return result; + } + + protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList modelObjectParameters, string propertyNamePrefix) + { + ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray(); + if (!results.Any()) + throw new Exception(cellInstanceConnectionName); + return results; + } + + protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix) + { + ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray(); + if (!results.Any()) + throw new Exception(cellInstanceConnectionName); + return results; + } + + protected void UpdateLastTicksDuration(long ticksDuration) + { + if (ticksDuration < 50000000) + ticksDuration = 50000000; + _LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); + } + + protected void WaitForThread(Thread thread, List threadExceptions) + { + if (thread is not null) + { + ThreadState threadState; + for (short i = 0; i < short.MaxValue; i++) + { + if (thread is null) + break; + else + { + threadState = thread.ThreadState; + if (threadState is not ThreadState.Running and not ThreadState.WaitSleepJoin) + break; + } + Thread.Sleep(500); + } + lock (threadExceptions) + { + if (threadExceptions.Any()) + { + foreach (Exception item in threadExceptions) + _Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace)); + Exception exception = threadExceptions[0]; + threadExceptions.Clear(); + throw exception; + } + } + } + } + + protected void CreateProgressDirectory(string[] exceptionLines) + { + string progressDirectory; + StringBuilder stringBuilder = new(); + if (_Hyphens == 0) + progressDirectory = Path.Combine(_ProgressPath, _CellInstanceConnectionName); + else + { + _ = stringBuilder.Clear(); + for (int i = 0; i < _Hyphens; i++) + { + if (i > 0 && (i % 2) == 0) + _ = stringBuilder.Append(' '); + _ = stringBuilder.Append('-'); + } + progressDirectory = string.Concat(_ProgressPath, @"\", (_Hyphens + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim(); + } + DateTime dateTime = DateTime.Now; + string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence); + if (!Directory.Exists(progressDirectory)) + _ = Directory.CreateDirectory(progressDirectory); + if (exceptionLines is not null) + { + string fileName = string.Concat(progressDirectory, @"\readme.txt"); + try + { File.WriteAllLines(fileName, exceptionLines); } + catch (Exception) { } + } + } + + protected string[] Move(Tuple> 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(); + else + { + results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace }; + Shared0449(to, results); + } + if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any()) + { + string itemFile; + List directories = new(); + foreach (FileInfo sourceFile in extractResults.Item4) + { + if (sourceFile.FullName != _Logistics.ReportFullPath) + { + itemFile = sourceFile.FullName.Replace(from, to); + Shared1880(itemFile, directories, sourceFile, isErrorFile); + } + else if (!isErrorFile && _Logistics is not null) + Shared1811(to, sourceFile); + } + Shared0231(directories); + } + return results; + } + + protected static IEnumerable GetDirectoriesRecursively(string path, string directoryNameSegment = null) + { + Queue queue = new(); + queue.Enqueue(path); + while (queue.Count > 0) + { + path = queue.Dequeue(); + foreach (string subDirectory in Directory.GetDirectories(path)) + { + queue.Enqueue(subDirectory); + if (string.IsNullOrEmpty(directoryNameSegment) || Path.GetFileName(subDirectory).Contains(directoryNameSegment)) + yield return subDirectory; + } + } + } + + protected string GetProcessedDirectory(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory) + { + string result = duplicateDirectory; + string logisticsSequence = logistics.Sequence.ToString(); + string[] matchDirectories; + if (!_IsEAFHosted) + matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(logistics.ReportFullPath)) }; + else + matchDirectories = new string[] { GetDirectoriesRecursively(Path.GetDirectoryName(progressPath), logisticsSequence).FirstOrDefault() }; + if (matchDirectories.Length == 0 || string.IsNullOrEmpty(matchDirectories[0])) + matchDirectories = Directory.GetDirectories(duplicateDirectory, string.Concat('*', logisticsSequence, '*'), SearchOption.AllDirectories); + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + if (!matchDirectories[0].Contains("_processed")) + { + result = string.Concat(matchDirectories[0].Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), dateTime.Ticks - logistics.Sequence, "_processed"); + Directory.Move(matchDirectories[0], result); + result = string.Concat(result, @"\", logistics.Sequence); + if (!Directory.Exists(result)) + _ = Directory.CreateDirectory(result); + } + return result; + } + + protected string WriteScopeInfo(string progressPath, Logistics logistics, DateTime dateTime, string duplicateDirectory, List> tuples) + { + string result = GetProcessedDirectory(progressPath, logistics, dateTime, duplicateDirectory); + string tupleFile; + string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); + string duplicateFile = string.Concat(result, @"\", fileName, ".pdsf"); + foreach (Tuple tuple in tuples) + { + if (tuple.Item1.FileName.StartsWith(@"\")) + tupleFile = tuple.Item1.FileName; + else + tupleFile = string.Concat(result, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + File.WriteAllText(tupleFile, tuple.Item2); + } + File.Copy(logistics.ReportFullPath, duplicateFile, overwrite: true); + return result; + } + + protected 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> tuples) + { + bool check; + long preWait; + string tupleFile; + List duplicateFiles = new(); + StringBuilder stringBuilder = new(); + List consumedFileIndices = new(); + bool moreThanAnHour = _BreakAfterSeconds > 3600; + long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks; + if (moreThanAnHour) + preWait = dateTime.AddSeconds(30).Ticks; + else + preWait = dateTime.AddTicks(_LastTicksDuration).Ticks; + if (!tuples.Any()) + duplicateFiles.Add(duplicateFile); + string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath); + string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath)); + foreach (Tuple tuple in tuples) + { + if (tuple.Item1.FileName.StartsWith(@"\")) + tupleFile = tuple.Item1.FileName; + else if (!tuple.Item1.FileName.Contains('%')) + tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + else + tupleFile = GetTupleFile(logistics, tuple.Item1, duplicateDirectory); + duplicateFiles.Add(tupleFile); + File.WriteAllText(tupleFile, tuple.Item2); + } + for (short i = 0; i < short.MaxValue; i++) + { + if (DateTime.Now.Ticks > preWait) + break; + Thread.Sleep(500); + } + if (!moreThanAnHour) + { + for (short z = 0; z < short.MaxValue; z++) + { + try + { + check = string.IsNullOrEmpty(successDirectory) || File.Exists(successFile); + if (check) + { + consumedFileIndices.Clear(); + for (int i = 0; i < duplicateFiles.Count; i++) + { + if (!File.Exists(duplicateFiles[i])) + consumedFileIndices.Add(i); + } + if (consumedFileIndices.Count == duplicateFiles.Count) + break; + } + } + catch (Exception) { } + if (DateTime.Now.Ticks > breakAfter) + { + for (int i = 0; i < duplicateFiles.Count; i++) + { + if (File.Exists(duplicateFiles[i])) + { + try + { File.Delete(duplicateFiles[i]); } + catch (Exception) { } + _ = stringBuilder.Append('<').Append(duplicateFiles[i]).Append("> "); + } + } + throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder)); + } + Thread.Sleep(500); + } + } + } + + protected void SetFileParameter(string key, string value) + { + if (_FileConnectorConfiguration is null || _FileConnectorConfiguration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.TargetFileName.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileName.Contains(string.Concat("%", key, "%"))) + { + if (_FileParameter.ContainsKey(key)) + _FileParameter[key] = value; + else + _FileParameter.Add(key, value); + } + } + + protected void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true) + { + string key; + if (!includeLogisticsSequence) + key = "LotID"; + else + key = "LotIDWithLogisticsSequence"; + string value = string.Concat(_Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence); + SetFileParameter(key, value); + } + + protected void SetFileParameterLotID(string value, bool includeLogisticsSequence = true) + { + string key; + if (!includeLogisticsSequence) + key = "LotID"; + else + { + key = "LotIDWithLogisticsSequence"; + value = string.Concat(value, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence); + } + SetFileParameter(key, value); + } + + protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements) + { + string directory; + if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType) + directory = Path.Combine(_VillachPath, _EquipmentType, "Target"); + else + directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName); + if (!Directory.Exists(directory)) + _ = Directory.CreateDirectory(directory); + string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf")); + string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty); + File.WriteAllText(file, lines); + if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600) + { + try + { File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); } + catch (Exception) { } + } + } + + protected void Move(Tuple> extractResults, Exception exception) + { + bool isErrorFile = exception is not null; + if (!isErrorFile && _IsDuplicator) + { + if (_IsEAFHosted && !string.IsNullOrEmpty(_ProgressPath)) + CreateProgressDirectory(exceptionLines: null); + } + if (!_IsEAFHosted) + { + string to; + if (!_FileConnectorConfiguration.TargetFileLocation.EndsWith(Path.DirectorySeparatorChar.ToString())) + to = _FileConnectorConfiguration.TargetFileLocation; + else + to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation); + foreach (KeyValuePair keyValuePair in _FileParameter) + to = to.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value); + if (to.Contains('%')) + _Log.Debug("Can't debug without EAF Hosting"); + else + _ = Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null); + } + } + + protected void TriggerEvents(Tuple> extractResults, List headerNames, Dictionary keyValuePairs) + { + object value; + string description; + List list; + for (int i = 0; i < extractResults.Item3.Length; i++) + { + _Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); + foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject()) + { + if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name)) + description = string.Empty; + else + description = keyValuePairs[jsonProperty.Name].Split('|')[0]; + if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name)) + value = jsonProperty.Value.ToString(); + else + { + list = new List(); + for (int z = 0; z < extractResults.Item3.Length; z++) + list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() }); + value = list; + } + } + if (_UseCyclicalForDescription) + break; + } + } + + protected Tuple> ReExtract(IFileRead fileRead, List headerNames, Dictionary keyValuePairs) + { + Tuple> results; + if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation)) + results = null; + else + { + string[] segments; + string[] matches = null; + foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters) + { + segments = subSourceFileFilter.Split('\\'); + if (_FileConnectorConfiguration.IncludeSubDirectories.Value) + matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories); + else + matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly); + if (matches.Any()) + break; + } + if (matches is null || !matches.Any()) + results = null; + else + { + _ReportFullPath = matches[0]; + results = fileRead.GetExtractResult(_ReportFullPath, _EventName); + if (!_IsEAFHosted) + TriggerEvents(results, headerNames, keyValuePairs); + } + } + return results; + } + + protected static Dictionary> GetKeyValuePairs(List descriptions) + { + Dictionary> results = new(); + Test testKey; + for (int i = 0; i < descriptions.Count; i++) + { + testKey = (Test)descriptions[i].Test; + if (!results.ContainsKey(testKey)) + results.Add(testKey, new List()); + results[testKey].Add(descriptions[i]); + } + return results; + } + + protected static List GetDuplicatorDescriptions(JsonElement[] jsonElements) + { + List results = new(); + Duplicator.Description description; + JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; + foreach (JsonElement jsonElement in jsonElements) + { + if (jsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + description = JsonSerializer.Deserialize(jsonElement.ToString(), jsonSerializerOptions); + results.Add(description); + } + return results; + } + + protected static Tuple>> GetTuple(IFileRead fileRead, IEnumerable descriptions, bool extra = false) + { + Tuple>> result; + Dictionary> keyValuePairs = GetKeyValuePairs(descriptions.ToList()); + Test[] tests = (from l in keyValuePairs select l.Key).ToArray(); + fileRead.CheckTests(tests, extra); + result = new Tuple>>(tests, keyValuePairs); + return result; + } + + protected void Shared0449(string to, string[] exceptionLines) + { + if (_IsDuplicator) + CreateProgressDirectory(exceptionLines: null); + else + { + string fileName = string.Concat(to, @"\readme.txt"); + try + { + if (!Directory.Exists(to)) + _ = Directory.CreateDirectory(to); + File.WriteAllLines(fileName, exceptionLines); + } + catch (Exception ex) { _Log.Error(ex.Message); } + } + } + + protected void Shared1880(string itemFile, List directories, FileInfo sourceFile, bool isErrorFile) + { + string itemDirectory; + directories.Add(Path.GetDirectoryName(sourceFile.FullName)); + itemDirectory = Path.GetDirectoryName(itemFile); + FileConnectorConfiguration.PostProcessingModeEnum processingModeEnum; + if (!isErrorFile) + processingModeEnum = _FileConnectorConfiguration.PostProcessingMode.Value; + else + processingModeEnum = _FileConnectorConfiguration.ErrorPostProcessingMode.Value; + if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory)) + { + _ = Directory.CreateDirectory(itemDirectory); + FileInfo fileInfo = new(_Logistics.ReportFullPath); + Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime); + } + if (_IsEAFHosted) + { + switch (processingModeEnum) + { + case FileConnectorConfiguration.PostProcessingModeEnum.Move: + File.Move(sourceFile.FullName, itemFile); + break; + case FileConnectorConfiguration.PostProcessingModeEnum.Copy: + File.Copy(sourceFile.FullName, itemFile); + break; + case FileConnectorConfiguration.PostProcessingModeEnum.Delete: + File.Delete(sourceFile.FullName); + break; + default: + throw new Exception(); + } + } + } + + protected void Shared1811(string to, FileInfo sourceFile) + { + if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength) + { + string directoryName = Path.GetFileName(to); + string jobIdDirectory = Path.GetDirectoryName(to); + DateTime dateTime = DateTime.Now.AddMinutes(-15); + string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); + string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd")); + string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); + if (!Directory.Exists(destinationDirectory)) + _ = Directory.CreateDirectory(destinationDirectory); + File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); + try + { + string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly); + foreach (string checkDirectory in checkDirectories) + { + if (!checkDirectory.Contains('_')) + continue; + if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) + continue; + if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) + continue; + if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any()) + continue; + if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any()) + continue; + if (new DirectoryInfo(checkDirectory).CreationTime > dateTime) + continue; + Directory.Delete(checkDirectory, recursive: false); + } + } + catch (Exception) { throw; } + } + } + + protected void Shared0231(List directories) + { + if (_FileConnectorConfiguration.PostProcessingMode != FileConnectorConfiguration.PostProcessingModeEnum.Copy) + { + foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct()) + { + if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any()) + Directory.Delete(directory); + } + } + } + + protected void Shared0413(DateTime dateTime, bool isDummyRun, string successDirectory, string duplicateDirectory, List> tuples, string duplicateFile) + { + if (!isDummyRun && _IsEAFHosted) + WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, successDirectory, duplicateDirectory, duplicateFile, tuples); + else + { + long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.ConnectionRetryInterval.Value).Ticks; + for (short i = 0; i < short.MaxValue; i++) + { + if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter) + break; + Thread.Sleep(500); + } + } + } + + protected static void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory) + { + if (destinationDirectory == duplicateDirectory) + throw new Exception("Check Target File Folder for %LotIDWithLogisticsSequence%_in process on CI (not Duplicator)"); + if (destinationDirectory.EndsWith(logisticsSequence)) + destinationDirectory = Path.GetDirectoryName(destinationDirectory); + string[] deleteFiles = Directory.GetFiles(destinationDirectory, "*", SearchOption.AllDirectories); + if (deleteFiles.Length > 250) + throw new Exception("Safety net!"); + foreach (string file in deleteFiles) + File.Delete(file); + Directory.Delete(destinationDirectory, recursive: true); + File.Delete(reportFullPath); + } + + protected string[] Shared1567(string reportFullPath, List> tuples) + { + string[] results; + string historicalText; + string logisticsSequence = _Logistics.Sequence.ToString(); + string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID); + if (!Directory.Exists(jobIdDirectory)) + _ = Directory.CreateDirectory(jobIdDirectory); + string[] matchDirectories; + if (!_IsEAFHosted) + matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) }; + else + matchDirectories = Directory.GetDirectories(jobIdDirectory, string.Concat(_Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly); + if ((matchDirectories is null) || matchDirectories.Length != 1) + throw new Exception("Didn't find directory by logistics sequence"); + string fileName = Path.GetFileNameWithoutExtension(reportFullPath); + string sequenceDirectory = string.Concat(matchDirectories[0], @"\", logisticsSequence); + if (!Directory.Exists(sequenceDirectory)) + _ = Directory.CreateDirectory(sequenceDirectory); + foreach (Tuple tuple in tuples) + { + fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc"); + if (_IsEAFHosted) + File.WriteAllText(fileName, tuple.Item2); + else + { + if (File.Exists(fileName)) + { + historicalText = File.ReadAllText(fileName); + if (tuple.Item2 != historicalText) + throw new Exception("File doesn't match historical!"); + } + } + } + results = matchDirectories; + return results; + } + + protected void Shared1277(string reportFullPath, string destinationDirectory, string logisticsSequence, string jobIdDirectory, string json) + { + string ecCharacterizationSi = Path.GetDirectoryName(Path.GetDirectoryName(jobIdDirectory)); + string destinationJobIdDirectory = string.Concat(ecCharacterizationSi, @"\Processed\", _Logistics.JobID); + if (!Directory.Exists(destinationJobIdDirectory)) + _ = Directory.CreateDirectory(destinationJobIdDirectory); + destinationJobIdDirectory = string.Concat(destinationJobIdDirectory, @"\", Path.GetFileName(destinationDirectory).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), DateTime.Now.Ticks - _Logistics.Sequence); + string sequenceDirectory = string.Concat(destinationJobIdDirectory, @"\", logisticsSequence); + string jsonFileName = string.Concat(sequenceDirectory, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".json"); + Directory.Move(destinationDirectory, destinationJobIdDirectory); + if (!Directory.Exists(sequenceDirectory)) + _ = Directory.CreateDirectory(sequenceDirectory); + File.Copy(reportFullPath, string.Concat(sequenceDirectory, @"\", Path.GetFileName(reportFullPath)), overwrite: true); + File.WriteAllText(jsonFileName, json); + } + +} + +// 2022-05-13 -> Shared - FileRead \ No newline at end of file diff --git a/Adaptation/Shared/IProcessData.cs b/Adaptation/Shared/IProcessData.cs deleted file mode 100644 index aceab69..0000000 --- a/Adaptation/Shared/IProcessData.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.Json; - -namespace Adaptation.Shared -{ - public interface IProcessData - { - - Tuple> GetResults(ILogic logic, ConfigDataBase configData, List fileInfoCollection); - - } - -} diff --git a/Adaptation/Shared/IProcessDataDescription.cs b/Adaptation/Shared/IProcessDataDescription.cs deleted file mode 100644 index eb9e2c2..0000000 --- a/Adaptation/Shared/IProcessDataDescription.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Adaptation.Shared.Metrology; -using System.Collections.Generic; - -namespace Adaptation.Shared -{ - - public interface IProcessDataDescription - { - - int Test { get; set; } - int Count { get; set; } - int Index { get; set; } - IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase); - IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase); - List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData); - List GetDetailNames(ILogic logic, ConfigDataBase configDataBase); - List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase); - List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test); - List GetNames(ILogic logic, ConfigDataBase configDataBase); - List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase); - List GetParameterNames(ILogic logic, ConfigDataBase configDataBase); - string GetEventDescription(); - - } - -} diff --git a/Adaptation/Shared/IQSRecord.cs b/Adaptation/Shared/IQSRecord.cs deleted file mode 100644 index 1ab5cbf..0000000 --- a/Adaptation/Shared/IQSRecord.cs +++ /dev/null @@ -1,239 +0,0 @@ -using Adaptation.Shared.Metrology; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Adaptation.Shared -{ - - internal class IQSRecord - { - - public string SID { get; protected set; } - public string Part { get; protected set; } - public string Process { get; protected set; } - public string Lot { get; protected set; } - public string SampleSize { get; protected set; } - public string ParameterName { get; protected set; } - public string TestNumber { get; protected set; } - public string ParameterValue { get; protected set; } - public string WaferID { get; protected set; } - public string WaferScribe { get; protected set; } - public string Pocket { get; protected set; } - public string EpiThicknessMean { get; protected set; } - public string WaferRegion { get; protected set; } - public string ToolID { get; protected set; } - public string EmployeeID { get; protected set; } - public string EmployeeName { get; protected set; } - public string Date { get; protected set; } - public Column Column { get; protected set; } - - public IQSRecord(object sID, object part, object process, object lot, object sampleSize, object parameterName, object testNumber, object parameterValue, object waferID, object waferScribe, object pocket, object epiThicknessMean, object waferRegion, object toolID, object employeeID, object employeeName, object date, Dictionary keyValuePairs) - { - if (sID is null) - SID = string.Empty; - else - SID = sID.ToString(); - if (part is null) - Part = string.Empty; - else - Part = part.ToString(); - if (process is null) - Process = string.Empty; - else - Process = process.ToString(); - if (lot is null) - Lot = string.Empty; - else - Lot = lot.ToString(); - if (sampleSize is null) - SampleSize = string.Empty; - else - SampleSize = sampleSize.ToString(); - if (parameterName is null) - ParameterName = string.Empty; - else - ParameterName = parameterName.ToString(); - if (testNumber is null) - TestNumber = string.Empty; - else - TestNumber = testNumber.ToString(); - if (parameterValue is null) - ParameterValue = string.Empty; - else - ParameterValue = parameterValue.ToString(); - if (waferID is null) - WaferID = string.Empty; - else - WaferID = waferID.ToString(); - if (waferScribe is null) - WaferScribe = string.Empty; - else - WaferScribe = waferScribe.ToString(); - if (pocket is null) - Pocket = string.Empty; - else - Pocket = pocket.ToString(); - if (epiThicknessMean is null) - EpiThicknessMean = string.Empty; - else - EpiThicknessMean = epiThicknessMean.ToString(); - if (waferRegion is null) - WaferRegion = string.Empty; - else - WaferRegion = waferRegion.ToString(); - if (toolID is null) - ToolID = string.Empty; - else - ToolID = toolID.ToString(); - if (employeeID is null) - EmployeeID = string.Empty; - else - EmployeeID = employeeID.ToString(); - if (employeeName is null) - EmployeeName = string.Empty; - else - EmployeeName = employeeName.ToString(); - if (date is null) - Date = string.Empty; - else - Date = date.ToString(); - if (parameterName is null || !keyValuePairs.ContainsKey(parameterName.ToString())) - Column = Column.AFM_Roughness; - else - Column = keyValuePairs[parameterName.ToString()]; - } - - private static string GetBaseTableJoins() - { - StringBuilder result = new StringBuilder(); - result.Append(" from [irmnspc].[dbo].sgrp_ext se "). - Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test "). - Append(" join [irmnspc].[dbo].part_dat pd on se.f_part = pd.f_part "). - Append(" join [irmnspc].[dbo].part_lot pl on se.f_lot = pl.f_lot "). - Append(" join [irmnspc].[dbo].prcs_dat pr on se.f_prcs = pr.f_prcs "). - Append(" join [irmnspc].[dbo].empl_inf em on se.f_empl = em.f_empl "); - return result.ToString(); - } - - internal static StringBuilder GetIqsRecordsSinceSql() - { - StringBuilder result = new StringBuilder(); - result.Append(" select "). - Append(" se.f_sgrp [sid], concat(se.f_sgrp, ', ', td.f_name, ', ', pd.f_name, ', ', pl.f_name, ', ', pr.f_name, ', ', em.f_name, ', ', se.f_sgtm) [csv] "). - Append(GetBaseTableJoins()). - Append(" where se.f_sgrp >= 1543459064 "). - Append(" and se.f_sgrp > ( @lastSID - 20 ) "). - Append(" /* and dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) >= '2019-08-25 00:00:00.000' */ "). - Append(" and td.f_name = @key "). - Append(" group by se.f_sgrp, td.f_name, pd.f_name, pl.f_name, pr.f_name, em.f_name, se.f_sgtm "). - Append(" order by se.f_sgrp, pd.f_name, td.f_name "); - return result; - } - - internal static StringBuilder GetIqsRecordsSql() - { - StringBuilder result = new StringBuilder(); - result.Append(" select "). - Append(" ta.id [SID], "). - Append(" ta.ms [Part], "). - Append(" ta.pr [Process], "). - Append(" ta.lt [Lot], "). - Append(" ta.sz [Sample Size], "). - Append(" ta.pn [Parameter Name], "). - Append(" ta.tn [Test Number], "). - Append(" ta.pv [Parameter Value], "). - Append(" tb.v1337859646 [Wafer ID], "). - Append(" tb.v1337859592 [Wafer Scribe], "). - Append(" tb.v1342510661 [Pocket], "). - Append(" tb.v1340294286 [Epi Thickness Mean], "). - Append(" tb.v1345566180 [Wafer Region], "). - Append(" tb.v1363881711 [Tool ID], "). - Append(" ta.em [Employee ID], "). - Append(" ta.en [Employee Name], "). - Append(" ta.dt [Date] "). - Append(" from ( "). - Append(" select "). - Append(" se.f_sgrp id, "). - Append(" se.f_sgsz sz, "). - Append(" concat(se.f_tsno, '.', se.f_sbno) tn, "). - Append(" se.f_val pv, "). - Append(" se.f_empl em, "). - Append(" dateadd(hh, -7, (dateadd(ss, convert(bigint, se.f_sgtm), '19700101'))) dt, "). - Append(" td.f_name pn, "). - Append(" pd.f_name as ms, "). - Append(" pl.f_name lt, "). - Append(" pr.f_name pr, "). - Append(" em.f_name en "). - Append(GetBaseTableJoins()). - Append(" where se.f_sgrp = @sid "). - Append(" ) as ta "). - Append(" join ( "). - Append(" select "). - Append(" se.f_sgrp id, "). - Append(" max(case when dd.f_dsgp = 1337859646 then dd.f_name end) as v1337859646, "). - Append(" max(case when dd.f_dsgp = 1337859592 then dd.f_name end) as v1337859592, "). - Append(" max(case when dd.f_dsgp = 1342510661 then dd.f_name end) as v1342510661, "). - Append(" max(case when dd.f_dsgp = 1340294286 then dd.f_name end) as v1340294286, "). - Append(" max(case when dd.f_dsgp = 1345566180 then dd.f_name end) as v1345566180, "). - Append(" max(case when dd.f_dsgp = 1363881711 then dd.f_name end) as v1363881711 "). - Append(" from [irmnspc].[dbo].sgrp_ext se "). - Append(" join [irmnspc].[dbo].test_dat td on se.f_test = td.f_test "). - Append(" join [irmnspc].[dbo].sgrp_dsc sd on se.f_sgrp = sd.f_sgrp "). - Append(" join [irmnspc].[dbo].desc_dat dd on sd.f_desc = dd.f_desc "). - Append(" and isnull(dd.f_name, '') <> '' "). - Append(" where se.f_sgrp = @sid "). - Append(" and dd.f_dsgp in (1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) "). - Append(" group by se.f_sgrp "). - Append(" ) tb on ta.id = tb.id "). - Append(" order by ta.id desc, ta.ms, ta.pr, ta.lt, ta.sz, ta.tn, ta.dt, ta.pn "); - return result; - } - - internal static List GetIqsRecords(Dictionary> rawData, int count) - { - List results = new List(); - IQSRecord iqsRecord; - List c0 = rawData[0]; - List c1 = rawData[1]; - List c2 = rawData[2]; - List c3 = rawData[3]; - List c4 = rawData[4]; - List c5 = rawData[5]; - List c6 = rawData[6]; - List c7 = rawData[7]; - List c8 = rawData[8]; - List c9 = rawData[9]; - List cA = rawData[10]; - List cB = rawData[11]; - List cC = rawData[12]; - List cD = rawData[13]; - List cE = rawData[14]; - List cF = rawData[15]; - List cG = rawData[16]; - if (c0.Any()) - { - Array array = Enum.GetValues(typeof(Column)); - Dictionary keyValuePairs = new Dictionary(); - foreach (Column column in array) - keyValuePairs.Add(column.GetDiplayName(), column); - for (int i = 0; i < c0.Count; i++) - { - iqsRecord = new IQSRecord(c0[i], c1[i], c2[i], c3[i], c4[i], c5[i], c6[i], c7[i], c8[i], c9[i], cA[i], cB[i], cC[i], cD[i], cE[i], cF[i], cG[i], keyValuePairs); - results.Add(iqsRecord); - } - } - return results; - } - - public override string ToString() - { - //(1337859646 /* Wafer ID */, 1337859592 /* Wafer Scribe */, 1342510661 /* Pocket */, 1340294286 /* Epi Thickness Mean */, 1345566180 /* Wafer Region */, 1363881711 /* Tool ID */) "). - //return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, WaferID, WaferScribe, Pocket, EpiThicknessMean, WaferRegion, ToolID, EmployeeID, EmployeeName, Date); - return string.Concat(SID, Part, Process, Lot, SampleSize, TestNumber, EmployeeID, EmployeeName, Date); - } - - } - -} diff --git a/Adaptation/Shared/IScopeInfo.cs b/Adaptation/Shared/IScopeInfo.cs deleted file mode 100644 index d47a954..0000000 --- a/Adaptation/Shared/IScopeInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Adaptation.Shared -{ - - 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; } - EquipmentType EquipmentType { get; } - - } - -} diff --git a/Adaptation/Shared/IsEnvironment.cs b/Adaptation/Shared/IsEnvironment.cs deleted file mode 100644 index c24b236..0000000 --- a/Adaptation/Shared/IsEnvironment.cs +++ /dev/null @@ -1,171 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace Shared -{ - - public class IsEnvironment - { - - public enum Name - { - LinuxDevelopment, - LinuxProduction, - LinuxStaging, - OSXDevelopment, - OSXProduction, - OSXStaging, - WindowsDevelopment, - WindowsProduction, - WindowsStaging - } - - public bool DebuggerWasAttachedDuringConstructor { get; private set; } - public bool Development { get; private set; } - public bool Linux { get; private set; } - public bool OSX { get; private set; } - public bool Production { get; private set; } - public bool Staging { get; private set; } - public bool Windows { get; private set; } - public string Profile { get; private set; } - public string AppSettingsFileName { get; private set; } - public string ASPNetCoreEnvironment { get; private set; } - - public IsEnvironment(string testCategory) - { - if (testCategory.EndsWith(".json")) - { - Production = testCategory == "appsettings.json"; - Staging = testCategory.EndsWith(nameof(Staging)); - OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - Development = testCategory.EndsWith(nameof(Development)); - Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; - Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - } - else - { - DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; - OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX)); - ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux)); - Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging)); - Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows)); - Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production)); - Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development)); - } - Profile = GetProfile(); - AppSettingsFileName = GetAppSettingsFileName(processesCount: null); - } - - public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction) - { - Staging = isStaging; - Production = isProduction; - Development = isDevelopment; - OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; - Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - Profile = GetProfile(); - AppSettingsFileName = GetAppSettingsFileName(processesCount: null); - } - - public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction) - { - OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX); - Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux); - DebuggerWasAttachedDuringConstructor = Debugger.IsAttached; - Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); - if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction) - throw new Exception(); - else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction) - Production = true; - else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment) - Development = true; - else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction) - throw new Exception(); - else - { - Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging)); - Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production)); - Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development)); - } - Profile = GetProfile(); - AppSettingsFileName = GetAppSettingsFileName(processesCount); - } - - private string GetProfile() - { - string result; - if (Windows && Production) - result = nameof(Production); - else if (Windows && Staging) - result = nameof(Staging); - else if (Windows && Development) - result = nameof(Development); - else if (Linux && Production) - result = nameof(Name.LinuxProduction); - else if (Linux && Staging) - result = nameof(Name.LinuxStaging); - else if (Linux && Development) - result = nameof(Name.LinuxDevelopment); - else if (OSX && Production) - result = nameof(Name.OSXProduction); - else if (OSX && Staging) - result = nameof(Name.OSXStaging); - else if (OSX && Development) - result = nameof(Name.OSXDevelopment); - else - throw new Exception(); - return result; - } - - private string GetAppSettingsFileName(int? processesCount) - { - string result; - if (Production) - { - if (processesCount is null) - result = "appsettings.json"; - else - result = $"appsettings.{processesCount}.json"; - } - else - { - string environment; - if (Staging) - environment = nameof(Staging); - else if (Development) - environment = nameof(Development); - else - throw new Exception(); - if (processesCount is null) - result = $"appsettings.{environment}.json"; - else - result = $"appsettings.{environment}.{processesCount}.json"; - } - return result; - } - - public static string GetEnvironmentName(IsEnvironment isEnvironment) - { - string result; - if (isEnvironment.Windows) - result = nameof(IsEnvironment.Windows); - else if (isEnvironment.Linux) - result = nameof(IsEnvironment.Linux); - else if (isEnvironment.OSX) - result = nameof(IsEnvironment.OSX); - else - throw new Exception(); - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Logistics.cs b/Adaptation/Shared/Logistics.cs index 76427d5..c441b3f 100644 --- a/Adaptation/Shared/Logistics.cs +++ b/Adaptation/Shared/Logistics.cs @@ -1,242 +1,208 @@ -using System; +using Adaptation.Shared.Methods; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -namespace Adaptation.Shared +namespace Adaptation.Shared; + +public class Logistics : ILogistics { - public class Logistics + public object NullData { get; private set; } + public string JobID { get; private set; } //CellName + public long Sequence { get; private set; } //Ticks + public DateTime DateTimeFromSequence { get; private set; } + public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; } + public string MesEntity { get; private set; } //SPC + public string ReportFullPath { get; private set; } //Extract file + public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics) + public string MID { get; set; } //Lot & Pocket || Lot + public List Tags { get; set; } + public List Logistics1 { get; set; } + public List Logistics2 { get; set; } + + public Logistics(IFileRead fileRead) { + DateTime dateTime = DateTime.Now; + NullData = null; + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + JobID = fileRead.CellInstanceName; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + MesEntity = DefaultMesEntity(dateTime); + ReportFullPath = string.Empty; + ProcessJobID = nameof(ProcessJobID); + MID = nameof(MID); + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } - public object NullData { get; private set; } - public string JobID { get; private set; } //CellName - public long Sequence { get; private set; } //Ticks - public DateTime DateTimeFromSequence { get; private set; } - public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; } - public string MesEntity { get; private set; } //SPC - public string ReportFullPath { get; private set; } //Extract file - public string ProcessJobID { get; internal set; } //Reactor (duplicate but I want it in the logistics) - public string MID { get; internal set; } //Lot & Pocket || Lot - public List Tags { get; internal set; } - public List Logistics1 { get; internal set; } - public List Logistics2 { get; internal set; } - - public Logistics() + public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null) + { + if (string.IsNullOrEmpty(fileRead.CellInstanceName)) + throw new Exception(); + if (string.IsNullOrEmpty(fileRead.MesEntity)) + throw new Exception(); + NullData = fileRead.NullData; + FileInfo fileInfo = new(reportFullPath); + DateTime dateTime = fileInfo.LastWriteTime; + if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value) + dateTime = dateTime.AddTicks(-1); + JobID = fileRead.CellInstanceName; + Sequence = dateTime.Ticks; + DateTimeFromSequence = dateTime; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + MesEntity = fileRead.MesEntity; + ReportFullPath = fileInfo.FullName; + ProcessJobID = nameof(ProcessJobID); + string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName); + if (useSplitForMID) + { + if (fileNameWithoutExtension.IndexOf(".") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim(); + if (fileNameWithoutExtension.IndexOf("_") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim(); + if (fileNameWithoutExtension.IndexOf("-") > -1) + fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim(); + } + MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } + + public Logistics(string reportFullPath, string logistics) + { + string key; + DateTime dateTime; + string[] segments; + Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); + if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) { - DateTime dateTime = DateTime.Now; NullData = null; - JobID = Description.GetCellName(); + JobID = "null"; + dateTime = new FileInfo(reportFullPath).LastWriteTime; Sequence = dateTime.Ticks; DateTimeFromSequence = dateTime; TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; MesEntity = DefaultMesEntity(dateTime); - ReportFullPath = string.Empty; - ProcessJobID = nameof(ProcessJobID); - MID = nameof(MID); + ReportFullPath = reportFullPath; + ProcessJobID = "R##"; + MID = "null"; Tags = new List(); Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); Logistics2 = new List(); } - - public Logistics(object nullData, Dictionary cellNames, Dictionary mesEntities, FileInfo fileInfo, bool useSplitForMID, int? fileInfoLength = null) + else { - NullData = nullData; - string mesEntity = string.Empty; - string jobID = Description.GetCellName(); - DateTime dateTime = fileInfo.LastWriteTime; - if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value) - dateTime = dateTime.AddTicks(-1); - if (string.IsNullOrEmpty(jobID)) + string logistics1Line1 = Logistics1[0]; + key = "NULL_DATA="; + if (!logistics1Line1.Contains(key)) + NullData = null; + else { - if (cellNames.Count == 1) - jobID = cellNames.ElementAt(0).Key; - else - { - foreach (var element in cellNames) - { - if (fileInfo.FullName.IndexOf(element.Key, StringComparison.OrdinalIgnoreCase) > -1 || fileInfo.FullName.IndexOf(element.Value, StringComparison.OrdinalIgnoreCase) > -1) - { - jobID = element.Key; - break; - } - } - } + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + NullData = segments[1].Split(';')[0]; + } + key = "JOBID="; + if (!logistics1Line1.Contains(key)) + JobID = "null"; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + JobID = segments[1].Split(';')[0]; + } + key = "SEQUENCE="; + if (!logistics1Line1.Contains(key)) + dateTime = new FileInfo(reportFullPath).LastWriteTime; + else + { + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks) + dateTime = new FileInfo(reportFullPath).LastWriteTime; + else + dateTime = new DateTime(sequence); } - if (string.IsNullOrEmpty(jobID)) - throw new Exception(); - if (mesEntities.ContainsKey(jobID)) - mesEntity = mesEntities[jobID]; - else if (mesEntities.Count == 1) - mesEntity = mesEntities.ElementAt(0).Value; - // - if (string.IsNullOrEmpty(mesEntity)) - throw new Exception(); - JobID = jobID; Sequence = dateTime.Ticks; DateTimeFromSequence = dateTime; TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - MesEntity = mesEntity; - ReportFullPath = fileInfo.FullName; - ProcessJobID = nameof(ProcessJobID); - string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName); - if (useSplitForMID) + DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime; + if (TotalSecondsSinceLastWriteTimeFromSequence > 600) { - 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(); + if (lastWriteTime != dateTime) + try + { File.SetLastWriteTime(reportFullPath, dateTime); } + catch (Exception) { } } - MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); - } - - public Logistics(string reportFullPath, string logistics) - { - string key; - DateTime dateTime; - string[] segments; - Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); - if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) - { - NullData = null; - JobID = "null"; - dateTime = new FileInfo(reportFullPath).LastWriteTime; - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; + key = "MES_ENTITY="; + if (!logistics1Line1.Contains(key)) MesEntity = DefaultMesEntity(dateTime); - ReportFullPath = reportFullPath; - ProcessJobID = "R##"; - MID = "null"; - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); - } else { - string logistics1Line1 = Logistics1[0]; - key = "NULL_DATA="; - if (!logistics1Line1.Contains(key)) - NullData = null; - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - NullData = segments[1].Split(';')[0]; - } - key = "JOBID="; - if (!logistics1Line1.Contains(key)) - JobID = "null"; - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - JobID = segments[1].Split(';')[0]; - } - key = "SEQUENCE="; - if (!logistics1Line1.Contains(key)) - dateTime = new FileInfo(reportFullPath).LastWriteTime; - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks) - dateTime = new FileInfo(reportFullPath).LastWriteTime; - else - dateTime = new DateTime(sequence); - } - Sequence = dateTime.Ticks; - DateTimeFromSequence = dateTime; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; - DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime; - if (TotalSecondsSinceLastWriteTimeFromSequence > 600) - { - if (lastWriteTime != dateTime) - try { File.SetLastWriteTime(reportFullPath, dateTime); } catch (Exception) { } - } - key = "MES_ENTITY="; - if (!logistics1Line1.Contains(key)) - MesEntity = DefaultMesEntity(dateTime); - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - MesEntity = segments[1].Split(';')[0]; - } - ReportFullPath = reportFullPath; - key = "PROCESS_JOBID="; - if (!logistics1Line1.Contains(key)) - ProcessJobID = "R##"; - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - ProcessJobID = segments[1].Split(';')[0]; - } - key = "MID="; - if (!logistics1Line1.Contains(key)) - MID = "null"; - else - { - segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); - MID = segments[1].Split(';')[0]; - } + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MesEntity = segments[1].Split(';')[0]; } - Logistics2 logistics2; - Tags = new List(); - Logistics2 = new List(); - for (int i = 1; i < Logistics1.Count(); i++) + ReportFullPath = reportFullPath; + key = "PROCESS_JOBID="; + if (!logistics1Line1.Contains(key)) + ProcessJobID = "R##"; + else { - if (Logistics1[i].StartsWith("LOGISTICS_2")) - { - logistics2 = new Logistics2(Logistics1[i]); - Logistics2.Add(logistics2); - } + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + ProcessJobID = segments[1].Split(';')[0]; } - for (int i = Logistics1.Count() - 1; i > -1; i--) + key = "MID="; + if (!logistics1Line1.Contains(key)) + MID = "null"; + else { - if (Logistics1[i].StartsWith("LOGISTICS_2")) - Logistics1.RemoveAt(i); + segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MID = segments[1].Split(';')[0]; } } - - public Logistics ShallowCopy() + Logistics2 logistics2; + Tags = new List(); + Logistics2 = new List(); + for (int i = 1; i < Logistics1.Count; i++) { - return (Logistics)this.MemberwiseClone(); + if (Logistics1[i].StartsWith("LOGISTICS_2")) + { + logistics2 = new Logistics2(Logistics1[i]); + Logistics2.Add(logistics2); + } } - - private string DefaultMesEntity(DateTime dateTime) + for (int i = Logistics1.Count - 1; i > -1; i--) { - return string.Concat(dateTime.Ticks, "_MES_ENTITY"); - } - - internal string GetLotViaMostCommonMethod() - { - return MID.Substring(0, MID.Length - 2); - } - - internal string GetPocketNumberViaMostCommonMethod() - { - return MID.Substring(MID.Length - 2); - } - - internal void Update(string dateTime, string processJobID, string mid) - { - if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted)) - dateTimeCasted = DateTime.Now; - NullData = null; - //JobID = Description.GetCellName(); - Sequence = dateTimeCasted.Ticks; - DateTimeFromSequence = dateTimeCasted; - TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds; - //MesEntity = DefaultMesEntity(dateTime); - //ReportFullPath = string.Empty; - ProcessJobID = processJobID; - MID = mid; - Tags = new List(); - Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); - Logistics2 = new List(); + if (Logistics1[i].StartsWith("LOGISTICS_2")) + Logistics1.RemoveAt(i); } } + public Logistics ShallowCopy() => (Logistics)MemberwiseClone(); + + private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY"); + + internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2); + + internal string GetPocketNumberViaMostCommonMethod() => MID.Substring(MID.Length - 2); + + internal void Update(string dateTime, string processJobID, string mid) + { + if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted)) + dateTimeCasted = DateTime.Now; + NullData = null; + //JobID = Description.GetCellName(); + Sequence = dateTimeCasted.Ticks; + DateTimeFromSequence = dateTimeCasted; + TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds; + //MesEntity = DefaultMesEntity(dateTime); + //ReportFullPath = string.Empty; + ProcessJobID = processJobID; + MID = mid; + Tags = new List(); + Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); + Logistics2 = new List(); + } } \ No newline at end of file diff --git a/Adaptation/Shared/Logistics2.cs b/Adaptation/Shared/Logistics2.cs index 0f0f2f2..a067258 100644 --- a/Adaptation/Shared/Logistics2.cs +++ b/Adaptation/Shared/Logistics2.cs @@ -1,80 +1,78 @@ using System; -namespace Adaptation.Shared +namespace Adaptation.Shared; + +public class Logistics2 : Methods.ILogistics2 { - public class Logistics2 + + 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) { - - 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 { - 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]; - } + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + MID = segments[1].Split(';')[0]; + } + key = "MID="; + if (!logistics2.Contains(key)) + RunNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + RunNumber = segments[1].Split(';')[0]; + } + key = "INFO="; + if (!logistics2.Contains(key)) + SatelliteGroup = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + SatelliteGroup = segments[1].Split(';')[0]; + } + key = "PRODUCT="; + if (!logistics2.Contains(key)) + PartNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + PartNumber = segments[1].Split(';')[0]; + } + key = "CHAMBER="; + if (!logistics2.Contains(key)) + PocketNumber = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + PocketNumber = segments[1].Split(';')[0]; + } + key = "WAFER_ID="; + if (!logistics2.Contains(key)) + WaferLot = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + WaferLot = segments[1].Split(';')[0]; + } + key = "PPID="; + if (!logistics2.Contains(key)) + Recipe = "null"; + else + { + segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); + Recipe = segments[1].Split(';')[0]; } - } } \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IDescription.cs b/Adaptation/Shared/Methods/IDescription.cs new file mode 100644 index 0000000..30dc635 --- /dev/null +++ b/Adaptation/Shared/Methods/IDescription.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Text.Json; + +namespace Adaptation.Shared.Methods; + +public interface IDescription +{ + + string GetEventDescription(); + List GetDetailNames(); + List GetHeaderNames(); + IDescription GetDisplayNames(); + List GetParameterNames(); + List GetPairedParameterNames(); + List GetIgnoreParameterNames(Test test); + List GetNames(IFileRead fileRead, Logistics logistics); + JsonProperty[] GetDefault(IFileRead fileRead, Logistics logistics); + Dictionary GetDisplayNamesJsonElement(IFileRead fileRead); + IDescription GetDefaultDescription(IFileRead fileRead, Logistics logistics); + List GetDescriptions(IFileRead fileRead, Logistics logistics, List tests, IProcessData iProcessData); + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IFileRead.cs b/Adaptation/Shared/Methods/IFileRead.cs new file mode 100644 index 0000000..4d383c3 --- /dev/null +++ b/Adaptation/Shared/Methods/IFileRead.cs @@ -0,0 +1,23 @@ +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 GetHeaderNames(); + void CheckTests(Test[] tests, bool extra); + Dictionary GetDisplayNamesJsonElement(); + Tuple> ReExtract(); + List GetDescriptions(IFileRead fileRead, List tests, IProcessData processData); + void Move(Tuple> extractResults, Exception exception = null); + Tuple> GetExtractResult(string reportFullPath, string eventName); + string[] Move(Tuple> extractResults, string to, string from, string resolvedFileLocation, Exception exception); + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ILogistics.cs b/Adaptation/Shared/Methods/ILogistics.cs new file mode 100644 index 0000000..ea9ca27 --- /dev/null +++ b/Adaptation/Shared/Methods/ILogistics.cs @@ -0,0 +1,5 @@ +namespace Adaptation.Shared.Methods; + +public interface ILogistics : Properties.ILogistics +{ +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ILogistics2.cs b/Adaptation/Shared/Methods/ILogistics2.cs new file mode 100644 index 0000000..35b9e57 --- /dev/null +++ b/Adaptation/Shared/Methods/ILogistics2.cs @@ -0,0 +1,5 @@ +namespace Adaptation.Shared.Methods; + +public interface ILogistics2 : Properties.ILogistics2 +{ +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/IProcessData.cs b/Adaptation/Shared/Methods/IProcessData.cs new file mode 100644 index 0000000..e3fdeab --- /dev/null +++ b/Adaptation/Shared/Methods/IProcessData.cs @@ -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 reactors); + Tuple> GetResults(IFileRead fileRead, Logistics logistics, List fileInfoCollection); + +} \ No newline at end of file diff --git a/Adaptation/Shared/Methods/ISMTP.cs b/Adaptation/Shared/Methods/ISMTP.cs new file mode 100644 index 0000000..378da64 --- /dev/null +++ b/Adaptation/Shared/Methods/ISMTP.cs @@ -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); +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/Column.cs b/Adaptation/Shared/Metrology/Column.cs deleted file mode 100644 index 9257e04..0000000 --- a/Adaptation/Shared/Metrology/Column.cs +++ /dev/null @@ -1,803 +0,0 @@ -using System; - -namespace Adaptation.Shared.Metrology -{ - - public static class ColumnGet - { - - public static string GetDiplayName(this Column column) - { - string results; - switch (column) - { - //case Column._8in_Total_Warp_Verification: results = "8in Total Warp Verification"; break; - //case Column.AFM_Monthly_Y: results = "AFM-Monthly Y"; break; - //case Column.AFM_Monthly: results = "AFM_Monthly"; break; - case Column.AFM_Pit_Count: results = "AFM Pit Count"; break; - case Column.AFM_Roughness: results = "AFM Roughness"; break; - //case Column.Adder_Bin_1: results = "Adder Bin 1"; break; - //case Column.Adder_Bin_2: results = "Adder Bin 2"; break; - //case Column.Adder_Bin_3: results = "Adder Bin 3"; break; - //case Column.Adder_Bin_4: results = "Adder Bin 4"; break; - //case Column.Adder_Bin_5: results = "Adder Bin 5"; break; - //case Column.Adder_Bin_6: results = "Adder Bin 6"; break; - //case Column.Adder_Bin_9: results = "Adder Bin 9"; break; - case Column.Al_B_B_WTAVG: results = "Al% B.B. WTAVG"; break; - case Column.Al_B_B_: results = "Al% B.B."; break; - case Column.Al_Barrier_WTAVG: results = "Al% Barrier WTAVG"; break; - case Column.Al_Barrier: results = "Al% Barrier"; break; - case Column.Al_SLS_WTAVG: results = "Al% SLS WTAVG"; break; - case Column.Al_SLS: results = "Al% SLS"; break; - case Column.Al_TL1_WTAVG: results = "Al% TL1 WTAVG"; break; - case Column.Al_TL1: results = "Al% TL1"; break; - case Column.Al_TL2_WTAVG: results = "Al% TL2 WTAVG"; break; - //case Column.BV_Resistance: results = "BV Resistance"; break; //BV Monthly Verification - case Column.BandEdge_V: results = "BandEdge_V"; break; - case Column.BandEdge_V_XY: results = "BandEdge_V_XY"; break; - case Column.BandEdge_nm: results = "BandEdge_nm"; break; - case Column.Barrier_Composition_RPM_XY: results = "Barrier_Composition_RPM_XY"; break; - case Column.Bow_Calibration: results = "Bow Calibration"; break; - case Column.Bow_Range: results = "Bow Range"; break; - case Column.Bow: results = "Bow"; break; - case Column.BowCenter: results = "BowCenter"; break; - case Column.BowX: results = "BowX"; break; - case Column.BowY: results = "BowY"; break; - case Column.Breakdown_Voltage_Edge: results = "Breakdown Voltage - Edge"; break; - case Column.Breakdown_VoltageMiddle: results = "Breakdown Voltage - Middle"; break; - case Column.Breakdown_Voltage: results = "Breakdown Voltage"; break; - case Column.CV_C_at_10V: results = "CV C at -10V"; break; - case Column.CV_Nd_Min: results = "CV Nd Min"; break; - //case Column.Candela_Large_LPD_Quarterly: results = "Candela Large LPD Quarterly"; break; - //case Column.Candela_Medium_LPD_Quarterly: results = "Candela Medium LPD Quarterly"; break; - //case Column.Candela_Small_LPD_Quarterly: results = "Candela Small LPD Quarterly"; break; - //case Column.Candela_Total_Quarterly: results = "Candela Total Quarterly"; break; - case Column.Candela_102_83nm: results = "102-83nm"; break; - case Column.Candela_1_1um: results = "1.1um"; break; - case Column.Candela_496nm: results = "496nm"; break; - case Column.Candela_600nm: results = "600nm"; break; - case Column.Candela_8620_Small: results = "Candela 8620 Small"; break; - case Column.Candela_Crack_Verification: results = "Crack Verification"; break; - case Column.Candela_Cracking: results = "Candela Cracking"; break; - case Column.Candela_Cracking_Acceptable: results = "Candela Cracking Acceptable"; break; - case Column.Candela_Crater: results = "Candela Crater"; break; - case Column.Candela_Crater_Verification: results = "Crater verification"; break; - case Column.Candela_Haze: results = "Candela Haze"; break; - case Column.Candela_LPD_Large: results = "Candela LPD Large"; break; - case Column.Candela_LPD_Medium: results = "Candela LPD Medium"; break; - case Column.Candela_LPD_Small: results = "Candela LPD Small"; break; - case Column.Candela_Large_Verification: results = "Large Verification"; break; - case Column.Candela_Medium_Verification: results = "Medium Verification"; break; - case Column.Candela_Pits: results = "Candela Pits"; break; - case Column.Candela_Pits_Verification: results = "Pits verification"; break; - case Column.Candela_SPE: results = "Candela SPE"; break; - case Column.Candela_SPE_Verification: results = "SPE verification"; break; - case Column.Candela_Slip: results = "Candela Slip"; break; - case Column.Candela_Small_Verification: results = "Small Verification"; break; - case Column.Candela_Spirals: results = "Candela Spirals"; break; - case Column.Candela_Spirals_Verification: results = "Candela Spirals Verification"; break; - case Column.Candela_Total_Defects: results = "Candela Total Defects"; break; - case Column.Candela_Total_PSL: results = "Candela Total PSL"; break; - case Column.Candela__1_1um: results = ">1.1um"; break; - //case Column.Comment: results = "Comment"; break; - //case Column.Conductivity: results = "Conductivity"; break; - case Column.Contact_Symmetry: results = "Contact Symmetry"; break; - //case Column.Cracking_verification: results = "Cracking verification"; break; - //case Column.Crater_verification: results = "Crater verification"; break; - case Column.Date: results = "Date"; break; - case Column.Denton_Crystal_Life: results = "Denton_Crystal_Life"; break; - case Column.Denton_Current_AVG: results = "Denton_Current_AVG"; break; - case Column.Denton_Current_STDEV: results = "Denton_Current_STDEV"; break; - case Column.Denton_Deposition_Power_AVG: results = "Denton_Deposition_Power_AVG"; break; - case Column.Denton_Deposition_Power_STDEV: results = "Denton_Deposition_Power_STDEV"; break; - case Column.Denton_Deposition_Rate_AVG: results = "Denton_Deposition_Rate_AVG"; break; - case Column.Denton_Deposition_Rate_STDEV: results = "Denton_Deposition_Rate_STDEV"; break; - case Column.Denton_Gun_Pocket: results = "Denton_Gun_Pocket"; break; - case Column.Denton_Pumpdown_Time: results = "Denton_Pumpdown_Time"; break; - case Column.Denton_Voltage_AVG: results = "Denton_Voltage_AVG"; break; - case Column.Denton_Voltage_STDEV: results = "Denton_Voltage_STDEV"; break; - case Column.Employee: results = "Employee"; break; - case Column.Epi_Thickness_Mean: results = "Epi Thickness Mean"; break; - case Column.Epi_Thickness_Mean_XY: results = "Epi Thickness Mean_XY"; break; - case Column.Epi_Thickness_Std_Dev_: results = "Epi Thickness Std Dev %"; break; - case Column.FWHM_006_WTAVG: results = "FWHM 006 WTAVG"; break; - case Column.FWHM_006: results = "FWHM 006"; break; - case Column.FWHM_105_WTAVG: results = "FWHM 105 WTAVG"; break; - case Column.FWHM_105: results = "FWHM 105"; break; - case Column.Hall_Rs: results = "Hall Rs"; break; - case Column.Hall_Mobility_verif_sample: results = "Hall_Mobility_verif_sample"; break; - case Column.Hall_Ns_verif_sample: results = "Hall_Ns_verif_sample"; break; - case Column.Hall_Rs_verif_sample: results = "Hall_Rs_verif_sample"; break; - case Column.Job: results = "Job"; break; - case Column.LEI_RS_Average_value: results = "LEI RS Average value"; break; - case Column.LEI_RS_Maximum_value: results = "LEI RS Maximum value"; break; - case Column.LEI_RS_Minimum_value: results = "LEI RS Minimum value"; break; - case Column.LEI_RS_STDEV: results = "LEI RS STDEV"; break; - case Column.LEI_RS_STDEV_: results = "LEI RS STDEV%"; break; - //case Column.Large_Adder_Sum: results = "Large Adder Sum"; break; - case Column.Lot: results = "Lot"; break; - //case Column.Medium_Adder_Sum: results = "Medium Adder Sum"; break; - case Column.Microscope_Center_5x: results = "Microscope Center 5x"; break; - case Column.Microscope_Center_50x: results = "Microscope Center 50x"; break; - case Column.Microscope_Middle_5x: results = "Microscope Middle 5x"; break; - case Column.Microscope_Middle_50x: results = "Microscope Middle 50x"; break; - case Column.Microscope_Edge_5x: results = "Microscope Edge 5x"; break; - case Column.Microscope_Edge_50x: results = "Microscope Edge 50x"; break; - case Column.Mobility_Verification: results = "Mobility Verification"; break; - case Column.Mobility: results = "Mobility"; break; - case Column.Ns_Verification: results = "Ns Verification"; break; - case Column.PL_Edge_Wavelength: results = "PL Edge Wavelength"; break; - case Column.PL_Ratio: results = "PL Ratio"; break; - case Column.PR_Barrier_Composition: results = "PR Barrier Composition"; break; - case Column.PR_Peak: results = "PR Peak"; break; - case Column.Part: results = "Part"; break; - //case Column.Particles_verification: results = "Particles verification"; break; - //case Column.Pits_verification: results = "Pits verification"; break; - //case Column.Pocket: results = "Pocket"; break; - //case Column.Post_Bin_1: results = "Post Bin 1"; break; - //case Column.Post_Bin_2: results = "Post Bin 2"; break; - //case Column.Post_Bin_3: results = "Post Bin 3"; break; - //case Column.Post_Bin_4: results = "Post Bin 4"; break; - //case Column.Post_Bin_5: results = "Post Bin 5"; break; - //case Column.Post_Bin_6: results = "Post Bin 6"; break; - //case Column.Post_Bin_9: results = "Post Bin 9"; break; - //case Column.Pre_Bin_1: results = "Pre Bin 1"; break; - //case Column.Pre_Bin_2: results = "Pre Bin 2"; break; - //case Column.Pre_Bin_3: results = "Pre Bin 3"; break; - //case Column.Pre_Bin_4: results = "Pre Bin 4"; break; - //case Column.Pre_Bin_5: results = "Pre Bin 5"; break; - //case Column.Pre_Bin_6: results = "Pre Bin 6"; break; - //case Column.Pre_Bin_9: results = "Pre Bin 9"; break; - case Column.Process: results = "Process"; break; - //case Column.RPM_verif_Thickness_1: results = "RPM_verif_Thickness_1"; break; - //case Column.RPM_verif_Thickness_2: results = "RPM_verif_Thickness_2"; break; - //case Column.RPM_verif_Thickness_3: results = "RPM_verif_Thickness_3"; break; - //case Column.RPM_verif_Thickness_Average: results = "RPM_verif_Thickness_Average"; break; - //case Column.RTA_oxide_Thk_Change: results = "RTA oxide Thk Change"; break; - //case Column.RTA_oxide_post_anneal_Thk: results = "RTA oxide post-anneal Thk"; break; - //case Column.RTA_oxide_pre_anneal_Thk: results = "RTA oxide pre-anneal Thk"; break; - case Column.Recipe: results = "Recipe"; break; - //case Column.Resistivity_2_ohm_cm: results = "Resistivity 2 ohm cm"; break; //LEI Weekly Verification - //case Column.Resistivity_600_ohm_cm: results = "Resistivity 600 ohm cm"; break; //LEI Weekly Verification - case Column.Rs_verification: results = "Rs verification"; break; - case Column.Rs_verif_100kohm: results = "Rs_verif_100kohm"; break; - case Column.Rs_verif_10ohm: results = "Rs_verif_10ohm"; break; - case Column.Rs_verif_1kohm: results = "Rs_verif_1kohm"; break; - case Column.SID: results = "SID"; break; - case Column.SL_Period_WTAVG: results = "SL Period WTAVG"; break; - case Column.SL_Period: results = "SL Period"; break; - //case Column.SPE_verification: results = "SPE verification"; break; - //case Column.Sample_ID: results = "Sample ID"; break; - case Column.Sheet_Concentration: results = "Sheet Concentration"; break; - //case Column.Size: results = "Size"; break; - //case Column.Small_Adder_Sum: results = "Small Adder Sum"; break; - //case Column.Spirals_verification: results = "Spirals verification"; break; - case Column.Time: results = "Time"; break; - case Column.Tool_ID: results = "Tool ID"; break; - //case Column.Total_LPD_Adder: results = "Total LPD Adder"; break; - //case Column.Total_Verification: results = "Total Verification"; break; - case Column.Total_Warp_Calibration: results = "Total Warp Calibration"; break; - case Column.UV_Broken: results = "UV Broken"; break; - case Column.UV_Chipping: results = "UV Chipping"; break; - case Column.UV_Cracking_0_3mm_: results = "UV Cracking (0-3mm)"; break; - case Column.UV_Cracking_3_7mm_: results = "UV Cracking (3-7mm)"; break; - case Column.UV_Cracking_7mm_: results = "UV Cracking (>7mm)"; break; - case Column.UV_Crazing: results = "UV Crazing"; break; - case Column.UV_Crazing_Acceptable: results = "UV Crazing Acceptable"; break; - case Column.UV_FULL_Characterization_Wafer: results = "UV FULL Characterization Wafer"; break; - case Column.UV_Haze_count_: results = "UV Haze (count)"; break; - case Column.UV_LIGHT_Characterization_Wafer: results = "UV LIGHT Characterization Wafer"; break; - case Column.UV_Non_rotation: results = "UV Non-rotation"; break; - case Column.UV_Other: results = "UV Other"; break; - case Column.UV_Scratch_count_: results = "UV Scratch (count)"; break; - case Column.UV_Slip_count_: results = "UV Slip (count)"; break; - case Column.UV_True_Haze: results = "UV True Haze"; break; - case Column.UV_True_Haze_Acceptable: results = "UV True Haze Acceptable"; break; - case Column.UV_SPE_1mm_count: results = "UV-SPE (>1mm) count"; break; - case Column.UV_SPE_count_: results = "UV-SPE (count)"; break; - case Column.Verification_Contact_Symmetry: results = "Verification Contact Symmetry"; break; - case Column.Vp_Pinch_Off_Voltage: results = "Vp Pinch Off Voltage"; break; - case Column.Wafer_ID: results = "Wafer ID"; break; - //case Column.Wafer_Pocket: results = "Wafer Pocket"; break; - case Column.Wafer_Region: results = "Wafer Region"; break; - case Column.Wafer_Scribe: results = "Wafer Scribe"; break; - case Column.WaferPocket_Candela: results = "WaferPocket_Candela"; break; - case Column.WaferPocket_Warp: results = "WaferPocket_Warp"; break; - case Column.WaferPosition_CV: results = "WaferPosition_CV"; break; - case Column.WaferPosition_BV: results = "WaferPosition_BV"; break; - case Column.WaferPosition_Hall: results = "WaferPosition_Hall"; break; - case Column.WaferPosition_PR: results = "WaferPosition_PR"; break; - case Column.Warp: results = "Warp"; break; - case Column.X_Coord: results = "X-Coord"; break; - case Column.XRD_2_Theta_Peak_002: results = "XRD 2 Theta Peak 002"; break; - case Column.XRD_2_Theta_Peak_101: results = "XRD 2 Theta Peak 101"; break; - case Column.XRD_2_Theta_Position: results = "XRD 2-Theta Position"; break; - case Column.XRD_2_Theta_Position_Si_1: results = "XRD 2-Theta Position Si 1"; break; - case Column.XRD_2_Theta_Position_Si_2: results = "XRD 2-Theta Position Si 2"; break; - case Column.XRD_2_Theta_Position_Si_3: results = "XRD 2-Theta Position Si 3"; break; - case Column.XRD_Peak_002_Intensity: results = "XRD Peak 002 Intensity"; break; - case Column.XRD_Peak_101_Intensity: results = "XRD Peak 101 Intensity"; break; - case Column.XRD_Weekly_AL_Center: results = "XRD Weekly AL% Center"; break; - case Column.XRD_Weekly_Back_Barrier_Al_: results = "Back Barrier Al%"; break; - case Column.XRD_Weekly_Barrier_Al_: results = "Barrier Al%"; break; - case Column.XRD_Weekly_FWHM_002: results = "XRD Weekly FWHM 002"; break; - case Column.XRD_Weekly_FWHM_101: results = "XRD Weekly FWHM 101"; break; - case Column.XRD_Weekly_FWHM_105: results = "XRD Weekly FWHM 105"; break; - case Column.XRD_Weekly_Fringe_thick_0_0_: results = "XRD Weekly Fringe thick (0,0)"; break; - case Column.XRD_Weekly_Fringe_thick_48_48_: results = "XRD Weekly Fringe thick (48,48)"; break; - case Column.XRD_Weekly_Intensity: results = "XRD Weekly Intensity"; break; - case Column.XRD_Weekly_Super_Lattice_Al_: results = "Super Lattice Al%"; break; - case Column.XRD_Weekly_Super_Lattice_period: results = "Super Lattice period"; break; - case Column.XRD_Weekly_Super_Lattice_tks: results = "Super Lattice tks"; break; - case Column.XRR_Thickness_nm_WTAVG: results = "XRR Thickness (nm) WTAVG"; break; - case Column.XRR_Thickness_nm_: results = "XRR Thickness (nm)"; break; - case Column.Y_Coord: results = "Y-Coord"; break; - case Column.YellowBand_Power_mW_: results = "YellowBand_Power (mW)"; break; - case Column.YellowBand_V: results = "YellowBand_V"; break; - case Column.YellowBand_V_XY: results = "YellowBand_V_XY"; break; - case Column.YellowBand_nm: results = "YellowBand_nm"; break; - //case Column.pH: results = "pH"; break; - case Column.Ag: results = "Ag"; break; - case Column.Al: results = "Al"; break; - case Column.As: results = "As"; break; - case Column.Au: results = "Au"; break; - case Column.B: results = "B"; break; - case Column.Ba: results = "Ba"; break; - case Column.Ca: results = "Ca"; break; - case Column.Ce: results = "Ce"; break; - case Column.Co: results = "Co"; break; - case Column.Cr: results = "Cr"; break; - case Column.Cu: results = "Cu"; break; - case Column.Fe: results = "Fe"; break; - case Column.Ga: results = "Ga"; break; - case Column.Ge: results = "Ge"; break; - case Column.Hf: results = "Hf"; break; - case Column.K: results = "K"; break; - case Column.Li: results = "Li"; break; - case Column.Mg: results = "Mg"; break; - case Column.Mn: results = "Mn"; break; - case Column.Mo: results = "Mo"; break; - case Column.Na: results = "Na"; break; - case Column.Ni: results = "Ni"; break; - case Column.P: results = "P"; break; - case Column.Pb: results = "Pb"; break; - case Column.Sn: results = "Sn"; break; - case Column.Ta: results = "Ta"; break; - case Column.Ti: results = "Ti"; break; - case Column.W: results = "W"; break; - case Column.Y: results = "Y"; break; - case Column.Zn: results = "Zn"; break; - default: throw new Exception(); - } - return results; - } - - public static Description.Param GetParam(this Column column) - { - Description.Param results; - switch (column) - { - //case Column._8in_Total_Warp_Verification: results = Description.Param.String; break; - //case Column.AFM_Monthly_Y: results = Description.Param.String; break; - //case Column.AFM_Monthly: results = Description.Param.String; break; - case Column.AFM_Pit_Count: results = Description.Param.String; break; - case Column.AFM_Roughness: results = Description.Param.String; break; - //case Column.Adder_Bin_1: results = Description.Param.String; break; - //case Column.Adder_Bin_2: results = Description.Param.String; break; - //case Column.Adder_Bin_3: results = Description.Param.String; break; - //case Column.Adder_Bin_4: results = Description.Param.String; break; - //case Column.Adder_Bin_5: results = Description.Param.String; break; - //case Column.Adder_Bin_6: results = Description.Param.String; break; - //case Column.Adder_Bin_9: results = Description.Param.String; break; - case Column.Al_B_B_WTAVG: results = Description.Param.String; break; - case Column.Al_B_B_: results = Description.Param.String; break; - case Column.Al_Barrier_WTAVG: results = Description.Param.String; break; - case Column.Al_Barrier: results = Description.Param.String; break; - case Column.Al_SLS_WTAVG: results = Description.Param.String; break; - case Column.Al_SLS: results = Description.Param.String; break; - case Column.Al_TL1_WTAVG: results = Description.Param.String; break; - case Column.Al_TL1: results = Description.Param.String; break; - case Column.Al_TL2_WTAVG: results = Description.Param.String; break; - //case Column.BV_Resistance: results = Description.Param.String; break; - case Column.BandEdge_V: results = Description.Param.String; break; - case Column.BandEdge_V_XY: results = Description.Param.String; break; - case Column.BandEdge_nm: results = Description.Param.String; break; - case Column.Barrier_Composition_RPM_XY: results = Description.Param.String; break; - case Column.Bow_Calibration: results = Description.Param.String; break; - case Column.Bow_Range: results = Description.Param.String; break; - case Column.Bow: results = Description.Param.String; break; - case Column.BowCenter: results = Description.Param.String; break; - case Column.BowX: results = Description.Param.String; break; - case Column.BowY: results = Description.Param.String; break; - case Column.Breakdown_Voltage_Edge: results = Description.Param.String; break; - case Column.Breakdown_VoltageMiddle: results = Description.Param.String; break; - case Column.Breakdown_Voltage: results = Description.Param.String; break; - case Column.CV_C_at_10V: results = Description.Param.String; break; - case Column.CV_Nd_Min: results = Description.Param.String; break; - //case Column.Candela_Large_LPD_Quarterly: results = Description.Param.String; break; - //case Column.Candela_Medium_LPD_Quarterly: results = Description.Param.String; break; - //case Column.Candela_Small_LPD_Quarterly: results = Description.Param.String; break; - //case Column.Candela_Total_Quarterly: results = Description.Param.String; break; - case Column.Candela_102_83nm: results = Description.Param.String; break; - case Column.Candela_1_1um: results = Description.Param.String; break; - case Column.Candela_496nm: results = Description.Param.String; break; - case Column.Candela_600nm: results = Description.Param.String; break; - case Column.Candela_8620_Small: results = Description.Param.String; break; - case Column.Candela_Crack_Verification: results = Description.Param.String; break; - case Column.Candela_Cracking: results = Description.Param.String; break; - case Column.Candela_Cracking_Acceptable: results = Description.Param.String; break; - case Column.Candela_Crater: results = Description.Param.String; break; - case Column.Candela_Crater_Verification: results = Description.Param.String; break; - case Column.Candela_Haze: results = Description.Param.String; break; - case Column.Candela_LPD_Large: results = Description.Param.String; break; - case Column.Candela_LPD_Medium: results = Description.Param.String; break; - case Column.Candela_LPD_Small: results = Description.Param.String; break; - case Column.Candela_Large_Verification: results = Description.Param.String; break; - case Column.Candela_Medium_Verification: results = Description.Param.String; break; - case Column.Candela_Pits: results = Description.Param.String; break; - case Column.Candela_Pits_Verification: results = Description.Param.String; break; - case Column.Candela_SPE: results = Description.Param.String; break; - case Column.Candela_SPE_Verification: results = Description.Param.String; break; - case Column.Candela_Slip: results = Description.Param.String; break; - case Column.Candela_Small_Verification: results = Description.Param.String; break; - case Column.Candela_Spirals: results = Description.Param.String; break; - case Column.Candela_Spirals_Verification: results = Description.Param.String; break; - case Column.Candela_Total_Defects: results = Description.Param.String; break; - case Column.Candela_Total_PSL: results = Description.Param.String; break; - case Column.Candela__1_1um: results = Description.Param.String; break; - //case Column.Comment: results = Description.Param.String; break; - //case Column.Conductivity: results = Description.Param.String; break; - case Column.Contact_Symmetry: results = Description.Param.String; break; - //case Column.Cracking_verification: results = Description.Param.String; break; - //case Column.Crater_verification: results = Description.Param.String; break; - case Column.Date: results = Description.Param.String; break; - case Column.Denton_Crystal_Life: results = Description.Param.String; break; - case Column.Denton_Current_AVG: results = Description.Param.String; break; - case Column.Denton_Current_STDEV: results = Description.Param.String; break; - case Column.Denton_Deposition_Power_AVG: results = Description.Param.String; break; - case Column.Denton_Deposition_Power_STDEV: results = Description.Param.String; break; - case Column.Denton_Deposition_Rate_AVG: results = Description.Param.String; break; - case Column.Denton_Deposition_Rate_STDEV: results = Description.Param.String; break; - case Column.Denton_Gun_Pocket: results = Description.Param.String; break; - case Column.Denton_Pumpdown_Time: results = Description.Param.String; break; - case Column.Denton_Voltage_AVG: results = Description.Param.String; break; - case Column.Denton_Voltage_STDEV: results = Description.Param.String; break; - case Column.Employee: results = Description.Param.String; break; - case Column.Epi_Thickness_Mean: results = Description.Param.String; break; - case Column.Epi_Thickness_Mean_XY: results = Description.Param.String; break; - case Column.Epi_Thickness_Std_Dev_: results = Description.Param.String; break; - case Column.FWHM_006_WTAVG: results = Description.Param.String; break; - case Column.FWHM_006: results = Description.Param.String; break; - case Column.FWHM_105_WTAVG: results = Description.Param.String; break; - case Column.FWHM_105: results = Description.Param.String; break; - case Column.Hall_Rs: results = Description.Param.String; break; - case Column.Hall_Mobility_verif_sample: results = Description.Param.String; break; - case Column.Hall_Ns_verif_sample: results = Description.Param.String; break; - case Column.Hall_Rs_verif_sample: results = Description.Param.String; break; - case Column.Job: results = Description.Param.String; break; - case Column.LEI_RS_Average_value: results = Description.Param.String; break; - case Column.LEI_RS_Maximum_value: results = Description.Param.String; break; - case Column.LEI_RS_Minimum_value: results = Description.Param.String; break; - case Column.LEI_RS_STDEV: results = Description.Param.String; break; - case Column.LEI_RS_STDEV_: results = Description.Param.String; break; - //case Column.Large_Adder_Sum: results = Description.Param.String; break; - case Column.Lot: results = Description.Param.String; break; - //case Column.Medium_Adder_Sum: results = Description.Param.String; break; - case Column.Microscope_Center_5x: results = Description.Param.String; break; - case Column.Microscope_Center_50x: results = Description.Param.String; break; - case Column.Microscope_Middle_5x: results = Description.Param.String; break; - case Column.Microscope_Middle_50x: results = Description.Param.String; break; - case Column.Microscope_Edge_5x: results = Description.Param.String; break; - case Column.Microscope_Edge_50x: results = Description.Param.String; break; - case Column.Mobility_Verification: results = Description.Param.String; break; - case Column.Mobility: results = Description.Param.String; break; - case Column.Ns_Verification: results = Description.Param.String; break; - case Column.PL_Edge_Wavelength: results = Description.Param.String; break; - case Column.PL_Ratio: results = Description.Param.String; break; - case Column.PR_Barrier_Composition: results = Description.Param.String; break; - case Column.PR_Peak: results = Description.Param.String; break; - case Column.Part: results = Description.Param.String; break; - //case Column.Particles_verification: results = Description.Param.String; break; - //case Column.Pits_verification: results = Description.Param.String; break; - //case Column.Pocket: results = Description.Param.String; break; - //case Column.Post_Bin_1: results = Description.Param.String; break; - //case Column.Post_Bin_2: results = Description.Param.String; break; - //case Column.Post_Bin_3: results = Description.Param.String; break; - //case Column.Post_Bin_4: results = Description.Param.String; break; - //case Column.Post_Bin_5: results = Description.Param.String; break; - //case Column.Post_Bin_6: results = Description.Param.String; break; - //case Column.Post_Bin_9: results = Description.Param.String; break; - //case Column.Pre_Bin_1: results = Description.Param.String; break; - //case Column.Pre_Bin_2: results = Description.Param.String; break; - //case Column.Pre_Bin_3: results = Description.Param.String; break; - //case Column.Pre_Bin_4: results = Description.Param.String; break; - //case Column.Pre_Bin_5: results = Description.Param.String; break; - //case Column.Pre_Bin_6: results = Description.Param.String; break; - //case Column.Pre_Bin_9: results = Description.Param.String; break; - case Column.Process: results = Description.Param.String; break; - //case Column.RPM_verif_Thickness_1: results = Description.Param.String; break; - //case Column.RPM_verif_Thickness_2: results = Description.Param.String; break; - //case Column.RPM_verif_Thickness_3: results = Description.Param.String; break; - //case Column.RPM_verif_Thickness_Average: results = Description.Param.String; break; - //case Column.RTA_oxide_Thk_Change: results = Description.Param.String; break; - //case Column.RTA_oxide_post_anneal_Thk: results = Description.Param.String; break; - //case Column.RTA_oxide_pre_anneal_Thk: results = Description.Param.String; break; - case Column.Recipe: results = Description.Param.String; break; - //case Column.Resistivity_2_ohm_cm: results = Description.Param.String; break; - //case Column.Resistivity_600_ohm_cm: results = Description.Param.String; break; - case Column.Rs_verification: results = Description.Param.String; break; - case Column.Rs_verif_100kohm: results = Description.Param.String; break; - case Column.Rs_verif_10ohm: results = Description.Param.String; break; - case Column.Rs_verif_1kohm: results = Description.Param.String; break; - case Column.SID: results = Description.Param.String; break; - case Column.SL_Period_WTAVG: results = Description.Param.String; break; - case Column.SL_Period: results = Description.Param.String; break; - //case Column.SPE_verification: results = Description.Param.String; break; - //case Column.Sample_ID: results = Description.Param.String; break; - case Column.Sheet_Concentration: results = Description.Param.String; break; - //case Column.Size: results = Description.Param.String; break; - //case Column.Small_Adder_Sum: results = Description.Param.String; break; - //case Column.Spirals_verification: results = Description.Param.String; break; - case Column.Time: results = Description.Param.String; break; - case Column.Tool_ID: results = Description.Param.String; break; - //case Column.Total_LPD_Adder: results = Description.Param.String; break; - //case Column.Total_Verification: results = Description.Param.String; break; - case Column.Total_Warp_Calibration: results = Description.Param.String; break; - case Column.UV_Broken: results = Description.Param.String; break; - case Column.UV_Chipping: results = Description.Param.String; break; - case Column.UV_Cracking_0_3mm_: results = Description.Param.String; break; - case Column.UV_Cracking_3_7mm_: results = Description.Param.String; break; - case Column.UV_Cracking_7mm_: results = Description.Param.String; break; - case Column.UV_Crazing: results = Description.Param.String; break; - case Column.UV_Crazing_Acceptable: results = Description.Param.String; break; - case Column.UV_FULL_Characterization_Wafer: results = Description.Param.String; break; - case Column.UV_Haze_count_: results = Description.Param.String; break; - case Column.UV_LIGHT_Characterization_Wafer: results = Description.Param.String; break; - case Column.UV_Non_rotation: results = Description.Param.String; break; - case Column.UV_Other: results = Description.Param.String; break; - case Column.UV_Scratch_count_: results = Description.Param.String; break; - case Column.UV_Slip_count_: results = Description.Param.String; break; - case Column.UV_True_Haze: results = Description.Param.String; break; - case Column.UV_True_Haze_Acceptable: results = Description.Param.String; break; - case Column.UV_SPE_1mm_count: results = Description.Param.String; break; - case Column.UV_SPE_count_: results = Description.Param.String; break; - case Column.Verification_Contact_Symmetry: results = Description.Param.String; break; - case Column.Vp_Pinch_Off_Voltage: results = Description.Param.String; break; - case Column.Wafer_ID: results = Description.Param.String; break; - //case Column.Wafer_Pocket: results = Description.Param.String; break; - case Column.Wafer_Region: results = Description.Param.String; break; - case Column.Wafer_Scribe: results = Description.Param.String; break; - case Column.WaferPocket_Candela: results = Description.Param.String; break; - case Column.WaferPocket_Warp: results = Description.Param.String; break; - case Column.WaferPosition_CV: results = Description.Param.String; break; - case Column.WaferPosition_BV: results = Description.Param.String; break; - case Column.WaferPosition_Hall: results = Description.Param.String; break; - case Column.WaferPosition_PR: results = Description.Param.String; break; - case Column.Warp: results = Description.Param.String; break; - case Column.X_Coord: results = Description.Param.String; break; - case Column.XRD_2_Theta_Peak_002: results = Description.Param.String; break; - case Column.XRD_2_Theta_Peak_101: results = Description.Param.String; break; - case Column.XRD_2_Theta_Position: results = Description.Param.String; break; - case Column.XRD_2_Theta_Position_Si_1: results = Description.Param.String; break; - case Column.XRD_2_Theta_Position_Si_2: results = Description.Param.String; break; - case Column.XRD_2_Theta_Position_Si_3: results = Description.Param.String; break; - case Column.XRD_Peak_002_Intensity: results = Description.Param.String; break; - case Column.XRD_Peak_101_Intensity: results = Description.Param.String; break; - case Column.XRD_Weekly_AL_Center: results = Description.Param.String; break; - case Column.XRD_Weekly_Back_Barrier_Al_: results = Description.Param.String; break; - case Column.XRD_Weekly_Barrier_Al_: results = Description.Param.String; break; - case Column.XRD_Weekly_FWHM_002: results = Description.Param.String; break; - case Column.XRD_Weekly_FWHM_101: results = Description.Param.String; break; - case Column.XRD_Weekly_FWHM_105: results = Description.Param.String; break; - case Column.XRD_Weekly_Fringe_thick_0_0_: results = Description.Param.String; break; - case Column.XRD_Weekly_Fringe_thick_48_48_: results = Description.Param.String; break; - case Column.XRD_Weekly_Intensity: results = Description.Param.String; break; - case Column.XRD_Weekly_Super_Lattice_Al_: results = Description.Param.String; break; - case Column.XRD_Weekly_Super_Lattice_period: results = Description.Param.String; break; - case Column.XRD_Weekly_Super_Lattice_tks: results = Description.Param.String; break; - case Column.XRR_Thickness_nm_WTAVG: results = Description.Param.String; break; - case Column.XRR_Thickness_nm_: results = Description.Param.String; break; - case Column.Y_Coord: results = Description.Param.String; break; - case Column.YellowBand_Power_mW_: results = Description.Param.String; break; - case Column.YellowBand_V: results = Description.Param.String; break; - case Column.YellowBand_V_XY: results = Description.Param.String; break; - case Column.YellowBand_nm: results = Description.Param.String; break; - //case Column.pH: results = Description.Param.String; break; - case Column.Ag: results = Description.Param.String; break; - case Column.Al: results = Description.Param.String; break; - case Column.As: results = Description.Param.String; break; - case Column.Au: results = Description.Param.String; break; - case Column.B: results = Description.Param.String; break; - case Column.Ba: results = Description.Param.String; break; - case Column.Ca: results = Description.Param.String; break; - case Column.Ce: results = Description.Param.String; break; - case Column.Co: results = Description.Param.String; break; - case Column.Cr: results = Description.Param.String; break; - case Column.Cu: results = Description.Param.String; break; - case Column.Fe: results = Description.Param.String; break; - case Column.Ga: results = Description.Param.String; break; - case Column.Ge: results = Description.Param.String; break; - case Column.Hf: results = Description.Param.String; break; - case Column.K: results = Description.Param.String; break; - case Column.Li: results = Description.Param.String; break; - case Column.Mg: results = Description.Param.String; break; - case Column.Mn: results = Description.Param.String; break; - case Column.Mo: results = Description.Param.String; break; - case Column.Na: results = Description.Param.String; break; - case Column.Ni: results = Description.Param.String; break; - case Column.P: results = Description.Param.String; break; - case Column.Pb: results = Description.Param.String; break; - case Column.Sn: results = Description.Param.String; break; - case Column.Ta: results = Description.Param.String; break; - case Column.Ti: results = Description.Param.String; break; - case Column.W: results = Description.Param.String; break; - case Column.Y: results = Description.Param.String; break; - case Column.Zn: results = Description.Param.String; break; - default: throw new Exception(); - } - return results; - } - - } - - public enum Column - { - //_8in_Total_Warp_Verification, - //AFM_Monthly_Y, - //AFM_Monthly, - AFM_Pit_Count, - AFM_Roughness, - //Adder_Bin_1, - //Adder_Bin_2, - //Adder_Bin_3, - //Adder_Bin_4, - //Adder_Bin_5, - //Adder_Bin_6, - //Adder_Bin_9, - Al_B_B_WTAVG, - Al_B_B_, - Al_Barrier_WTAVG, - Al_Barrier, - Al_SLS_WTAVG, - Al_SLS, - Al_TL1_WTAVG, - Al_TL1, - Al_TL2_WTAVG, - //BV_Resistance, - BandEdge_V, - BandEdge_V_XY, - BandEdge_nm, - Barrier_Composition_RPM_XY, - Bow_Calibration, - Bow_Range, - Bow, - BowCenter, - BowX, - BowY, - Breakdown_Voltage_Edge, - Breakdown_VoltageMiddle, - Breakdown_Voltage, - CV_C_at_10V, - CV_Nd_Min, - //Candela_Large_LPD_Quarterly, - //Candela_Medium_LPD_Quarterly, - //Candela_Small_LPD_Quarterly, - //Candela_Total_Quarterly, - Candela_102_83nm, - Candela_1_1um, - Candela_496nm, - Candela_600nm, - Candela_8620_Small, - Candela_Crack_Verification, - Candela_Cracking, - Candela_Cracking_Acceptable, - Candela_Crater, - Candela_Crater_Verification, - Candela_Haze, - Candela_LPD_Large, - Candela_LPD_Medium, - Candela_LPD_Small, - Candela_Large_Verification, - Candela_Medium_Verification, - Candela_Pits, - Candela_Pits_Verification, - Candela_SPE, - Candela_SPE_Verification, - Candela_Slip, - Candela_Small_Verification, - Candela_Spirals, - Candela_Spirals_Verification, - Candela_Total_Defects, - Candela_Total_PSL, - Candela__1_1um, - //Comment, - //Conductivity, - Contact_Symmetry, - //Cracking_verification, - //Crater_verification, - Date, - Denton_Crystal_Life, - Denton_Current_AVG, - Denton_Current_STDEV, - Denton_Deposition_Power_AVG, - Denton_Deposition_Power_STDEV, - Denton_Deposition_Rate_AVG, - Denton_Deposition_Rate_STDEV, - Denton_Gun_Pocket, - Denton_Pumpdown_Time, - Denton_Voltage_AVG, - Denton_Voltage_STDEV, - Employee, - Epi_Thickness_Mean, - Epi_Thickness_Mean_XY, - Epi_Thickness_Std_Dev_, - FWHM_006_WTAVG, - FWHM_006, - FWHM_105_WTAVG, - FWHM_105, - Hall_Rs, - Hall_Mobility_verif_sample, - Hall_Ns_verif_sample, - Hall_Rs_verif_sample, - Job, - LEI_RS_Average_value, - LEI_RS_Maximum_value, - LEI_RS_Minimum_value, - LEI_RS_STDEV, - LEI_RS_STDEV_, - //Large_Adder_Sum, - Lot, - //Medium_Adder_Sum, - Microscope_Center_50x, - Microscope_Center_5x, - Microscope_Edge_50x, - Microscope_Edge_5x, - Microscope_Middle_50x, - Microscope_Middle_5x, - Mobility_Verification, - Mobility, - Ns_Verification, - PL_Edge_Wavelength, - PL_Ratio, - PR_Barrier_Composition, - PR_Peak, - Part, - //Particles_verification, - //Pits_verification, - //Pocket, - //Post_Bin_1, - //Post_Bin_2, - //Post_Bin_3, - //Post_Bin_4, - //Post_Bin_5, - //Post_Bin_6, - //Post_Bin_9, - //Pre_Bin_1, - //Pre_Bin_2, - //Pre_Bin_3, - //Pre_Bin_4, - //Pre_Bin_5, - //Pre_Bin_6, - //Pre_Bin_9, - Process, - //RPM_verif_Thickness_1, - //RPM_verif_Thickness_2, - //RPM_verif_Thickness_3, - //RPM_verif_Thickness_Average, - //RTA_oxide_Thk_Change, - //RTA_oxide_post_anneal_Thk, - //RTA_oxide_pre_anneal_Thk, - Recipe, - //Resistivity_2_ohm_cm, - //Resistivity_600_ohm_cm, - Rs_verification, - Rs_verif_100kohm, - Rs_verif_10ohm, - Rs_verif_1kohm, - SID, - SL_Period_WTAVG, - SL_Period, - //SPE_verification, - //Sample_ID, - Sheet_Concentration, - //Size, - //Small_Adder_Sum, - //Spirals_verification, - Time, - Tool_ID, - //Total_LPD_Adder, - //Total_Verification, - Total_Warp_Calibration, - UV_Broken, - UV_Chipping, - UV_Cracking_0_3mm_, - UV_Cracking_3_7mm_, - UV_Cracking_7mm_, - UV_Crazing, - UV_Crazing_Acceptable, - UV_FULL_Characterization_Wafer, - UV_Haze_count_, - UV_LIGHT_Characterization_Wafer, - UV_Non_rotation, - UV_Other, - UV_Scratch_count_, - UV_Slip_count_, - UV_True_Haze, - UV_True_Haze_Acceptable, - UV_SPE_1mm_count, - UV_SPE_count_, - Verification_Contact_Symmetry, - Vp_Pinch_Off_Voltage, - Wafer_ID, - //Wafer_Pocket, - Wafer_Region, - Wafer_Scribe, - WaferPocket_Candela, - WaferPocket_Warp, - WaferPosition_CV, - WaferPosition_BV, - WaferPosition_Hall, - WaferPosition_PR, - Warp, - X_Coord, - XRD_2_Theta_Peak_002, - XRD_2_Theta_Peak_101, - XRD_2_Theta_Position, - XRD_2_Theta_Position_Si_1, - XRD_2_Theta_Position_Si_2, - XRD_2_Theta_Position_Si_3, - XRD_Peak_002_Intensity, - XRD_Peak_101_Intensity, - XRD_Weekly_AL_Center, - XRD_Weekly_Back_Barrier_Al_, - XRD_Weekly_Barrier_Al_, - XRD_Weekly_FWHM_002, - XRD_Weekly_FWHM_101, - XRD_Weekly_FWHM_105, - XRD_Weekly_Fringe_thick_0_0_, - XRD_Weekly_Fringe_thick_48_48_, - XRD_Weekly_Intensity, - XRD_Weekly_Super_Lattice_Al_, - XRD_Weekly_Super_Lattice_period, - XRD_Weekly_Super_Lattice_tks, - XRR_Thickness_nm_, - XRR_Thickness_nm_WTAVG, - Y_Coord, - YellowBand_Power_mW_, - YellowBand_V, - YellowBand_V_XY, - YellowBand_nm, - //pH, - Ag, - Al, - As, - Au, - B, - Ba, - Ca, - Ce, - Co, - Cr, - Cu, - Fe, - Ga, - Ge, - Hf, - K, - Li, - Mg, - Mn, - Mo, - Na, - Ni, - P, - Pb, - Sn, - Ta, - Ti, - W, - Y, - Zn - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ConfigDataBase.cs b/Adaptation/Shared/Metrology/ConfigDataBase.cs deleted file mode 100644 index f391748..0000000 --- a/Adaptation/Shared/Metrology/ConfigDataBase.cs +++ /dev/null @@ -1,398 +0,0 @@ -using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Adaptation.Shared.Metrology -{ - - public class ConfigDataBase - { - - public bool UseCyclicalForDescription { get; protected set; } - public Dictionary CellNames { get; protected set; } - public Dictionary MesEntities { get; protected set; } - public IProcessDataDescription ProcessDataDescription { get; protected set; } - - public bool IsEvent { get; private set; } - public bool EafHosted { get; private set; } - public string CellName { get; private set; } - public bool IsSourceTimer { get; private set; } - public EquipmentType EquipmentType => _EquipmentType; - public string EquipmentElementName { get; private set; } - public bool IsDatabaseExportToIPDSF { get; private set; } - public EquipmentType? EquipmentConnection => _EquipmentConnection; - public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } - - protected readonly EventName _EventName; - protected readonly EquipmentType _EquipmentType; - protected readonly EquipmentType? _EquipmentConnection; - protected readonly Dictionary _Reactors; - - public ConfigDataBase(string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, bool isEAFHosted) - { - CellName = cellName; - EafHosted = isEAFHosted; - EquipmentType equipmentTypeValue; - _Reactors = new Dictionary(); - CellNames = new Dictionary(); - MesEntities = new Dictionary(); - EquipmentElementName = cellInstanceConnectionName; - FileConnectorConfiguration = fileConnectorConfiguration; - string[] segments = parameterizedModelObjectDefinitionType.Split('.'); - IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt")); - string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty); - IsDatabaseExportToIPDSF = (fileConnectorConfiguration.SourceFileLocation.Contains("DatabaseExport")); - if (!Enum.TryParse(segments[segments.Length - 1], out EventName eventNameValue)) - throw new Exception(cellInstanceConnectionName); - if (!Enum.TryParse(cellInstanceConnectionNameBase, out equipmentTypeValue)) - _EquipmentConnection = null; - else - _EquipmentConnection = equipmentTypeValue; - string suffix; - switch (eventNameValue) - { - case EventName.FileRead: suffix = string.Empty; break; - case EventName.FileReadDaily: suffix = "_Daily"; break; - case EventName.FileReadWeekly: suffix = "_Weekly"; break; - case EventName.FileReadMonthly: suffix = "_Monthly"; break; - case EventName.FileReadVerification: suffix = "_Verification"; break; - default: throw new Exception(cellInstanceConnectionName); - } - string parameterizedModelObjectDefinitionTypeAppended = string.Concat(segments[0], suffix); - IsEvent = cellInstanceConnectionNameBase != parameterizedModelObjectDefinitionTypeAppended; - _EventName = eventNameValue; - if (!Enum.TryParse(parameterizedModelObjectDefinitionTypeAppended, out equipmentTypeValue)) - throw new Exception(cellInstanceConnectionName); - _EquipmentType = equipmentTypeValue; - if (!isEAFHosted && equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended) - throw new Exception(cellInstanceConnectionName); - } - - public string GetEventName() - { - string result = _EventName.ToString(); - return result; - } - - public EventName GetEventNameValue() - { - EventName result = _EventName; - return result; - } - - public string GetEquipmentType() - { - string result; - if (_EquipmentConnection is null) - result = _EquipmentType.ToString(); - else - result = _EquipmentConnection.Value.ToString(); - return result; - } - - public string GetEventDescription() - { - string result = ProcessDataDescription.GetEventDescription(); - return result; - } - - public IProcessDataDescription GetDefault(ILogic logic) - { - IProcessDataDescription result = ProcessDataDescription.GetDefault(logic, this); - return result; - } - - public IProcessDataDescription GetDisplayNames(ILogic logic) - { - IProcessDataDescription result = ProcessDataDescription.GetDisplayNames(logic, this); - return result; - } - - public List GetDetailNames(ILogic logic) - { - List results = ProcessDataDescription.GetDetailNames(logic, this); - return results; - } - - public List GetHeaderNames(ILogic logic) - { - List results = ProcessDataDescription.GetHeaderNames(logic, this); - return results; - } - - public List GetNames(ILogic logic) - { - List results = ProcessDataDescription.GetNames(logic, this); - return results; - } - - public List GetPairedParameterNames(ILogic logic) - { - List results = ProcessDataDescription.GetPairedParameterNames(logic, this); - return results; - } - - public List GetParameterNames(ILogic logic) - { - List results = ProcessDataDescription.GetParameterNames(logic, this); - return results; - } - - public List GetDescription(ILogic logic, List tests, IProcessData iProcessData) - { - List results = ProcessDataDescription.GetDescription(logic, this, tests, iProcessData); - return results; - } - - public string GetCurrentReactor(ILogic logic) - { - string result = string.Empty; - foreach (KeyValuePair keyValuePair in _Reactors) - { - foreach (string filePrefix in keyValuePair.Value.Split('|')) - { - if (logic.Logistics.MID.StartsWith(filePrefix) || (_EventName != EventName.FileRead && MesEntities.ContainsKey(logic.Logistics.JobID) && keyValuePair.Value == MesEntities[logic.Logistics.JobID])) - { - result = keyValuePair.Key; - break; - } - } - } - if (string.IsNullOrEmpty(result) && _Reactors.Count == 1) - result = _Reactors.ElementAt(0).Key; - return result; - } - - protected JsonElement GetDefaultJsonElement(ILogic logic) - { - JsonElement result; - IProcessDataDescription processDataDescription = ProcessDataDescription.GetDefault(logic, this); - string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); - object @object = JsonSerializer.Deserialize(json); - result = (JsonElement)@object; - return result; - } - - public Dictionary>> GetParameterInfo(ILogic logic, bool allowNull) - { - Dictionary>> results = new Dictionary>>(); - string description; - Enum param; - Tuple tuple; - JsonElement defaultJsonElement = GetDefaultJsonElement(logic); - Dictionary keyValuePairs = GetDisplayNamesJsonElement(logic); - foreach (JsonProperty jsonProperty in defaultJsonElement.EnumerateObject()) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) - throw new Exception(); - if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) - { - description = string.Empty; - param = Description.Param.StructuredType; - //jValue = jObject.Value("Item1"); - throw new NotImplementedException("Item1"); - } - else - { - switch (jsonProperty.Value.ValueKind) - { - case JsonValueKind.String: param = Description.Param.String; break; - case JsonValueKind.Number: param = Description.Param.Double; break; - case JsonValueKind.True: - case JsonValueKind.False: param = Description.Param.Boolean; break; - case JsonValueKind.Null: param = Description.Param.String; break; - default: param = Description.Param.StructuredType; break; - } - } - if (!keyValuePairs.ContainsKey(jsonProperty.Name)) - description = string.Empty; - else - description = keyValuePairs[jsonProperty.Name]; - tuple = new Tuple(param, jsonProperty.Name, description, jsonProperty.Value.ToString()); - if (!results.ContainsKey(jsonProperty.Name)) - results.Add(jsonProperty.Name, new List>()); - results[jsonProperty.Name].Add(tuple); - } - return results; - } - - protected void WriteExportAliases(ILogic logic, string cellName, string equipmentElementName) - { - int i = 0; - Enum param; - object value; - Enum[] @params; - string description; - StringBuilder stringBuilder = new StringBuilder(); - string shareRoot = @"\\messv02ecc1.ec.local\EC_EDA"; - string shareDirectory = string.Concat(shareRoot, @"\Staging\Pdsf\", cellName, @"\ExportAliases\", equipmentElementName); - Dictionary>> keyValuePairs; - if (!(logic is null)) - keyValuePairs = GetParameterInfo(logic, allowNull: false); - else - keyValuePairs = new Dictionary>>(); - stringBuilder.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\""); - if (!Directory.Exists(shareRoot)) - return; - if (!Directory.Exists(shareDirectory)) - Directory.CreateDirectory(shareDirectory); - string shareFile = string.Concat(shareDirectory, @"\", DateTime.Now.Ticks, ".csv"); - foreach (KeyValuePair>> keyValuePair in keyValuePairs) - { - i += 1; - @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); - if (@params.Length != 1) - throw new Exception(); - if (keyValuePair.Value[0].Item2 != keyValuePair.Key) - throw new Exception(); - param = @params[0]; - if (!(param is Description.Param.String)) - stringBuilder.AppendLine($"\"{keyValuePair.Key}\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{keyValuePair.Key}\";\"\";\"{cellName}/{EquipmentElementName}/{_EventName}\";\"\";\"True\""); - else - { - description = keyValuePair.Value[0].Item3.Split('|')[0]; - if (string.IsNullOrEmpty(description)) - continue; - value = keyValuePair.Value[0].Item4; - stringBuilder.AppendLine($"\"'{description}'\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{value}\";\"\";\"{cellName}/{EquipmentElementName}/{_EventName}\";\"\";\"True\""); - } - } - if (keyValuePairs.Any()) - File.WriteAllText(shareFile, stringBuilder.ToString()); - } - - public Dictionary GetDisplayNamesJsonElement(ILogic logic) - { - Dictionary results = new Dictionary(); - IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this); - string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); - JsonElement jsonElement = JsonSerializer.Deserialize(json); - foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) - { - if (!results.ContainsKey(jsonProperty.Name)) - results.Add(jsonProperty.Name, string.Empty); - if (jsonProperty.Value is JsonElement jsonPropertyValue) - results[jsonProperty.Name] = jsonPropertyValue.ToString(); - } - return results; - } - - public List GetIgnoreParameterNames(ILogic logic, Test test, bool includePairedParameterNames) - { - List results = ProcessDataDescription.GetIgnoreParameterNames(logic, this, test); - if (includePairedParameterNames) - { - string value; - List pairedParameterNames = ProcessDataDescription.GetPairedParameterNames(logic, this); - IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this); - string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); - object @object = JsonSerializer.Deserialize(json); - if (!(@object is JsonElement jsonElement)) - throw new Exception(); - foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) - throw new Exception(); - value = jsonProperty.Value.ToString(); - if (!results.Contains(jsonProperty.Name) && pairedParameterNames.Contains(jsonProperty.Name) && (string.IsNullOrEmpty(value) || value[0] == '|')) - results.Add(jsonProperty.Name); - } - } - return results; - } - - public List GetProcessDataDescriptions(JsonElement jsonElement) - { - List results; - if (jsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; - results = JsonSerializer.Deserialize>(jsonElement.ToString(), jsonSerializerOptions); - return results; - } - - public Dictionary> GetKeyValuePairs(List processDataDescriptions) - { - Dictionary> results = new Dictionary>(); - Test testKey; - for (int i = 0; i < processDataDescriptions.Count; i++) - { - testKey = (Test)processDataDescriptions[i].Test; - if (!results.ContainsKey(testKey)) - results.Add(testKey, new List()); - results[testKey].Add(processDataDescriptions[i]); - } - return results; - } - - public Dictionary> GetKeyValuePairs(JsonElement jsonElement, List processDataDescriptions, Test test) - { - Dictionary> results = new Dictionary>(); - Test testKey; - if (jsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); - if (processDataDescriptions.Count != jsonElements.Length) - throw new Exception(); - for (int i = 0; i < processDataDescriptions.Count; i++) - { - testKey = (Test)processDataDescriptions[i].Test; - if (testKey != test) - continue; - foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject()) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) - throw new Exception(); - if (!results.ContainsKey(jsonProperty.Name)) - results.Add(jsonProperty.Name, new List()); - results[jsonProperty.Name].Add(jsonProperty.Value.ToString()); - } - } - return results; - } - - protected void VerifyProcessDataDescription(ILogic logic) - { - string description; - bool allowNull = false; - JsonElement defaultJsonElement = GetDefaultJsonElement(logic); - Dictionary keyValuePairs = GetDisplayNamesJsonElement(logic); - JsonProperty[] jsonProperties = defaultJsonElement.EnumerateObject().ToArray(); - foreach (JsonProperty jsonProperty in jsonProperties) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) - throw new Exception(); - if (!(jsonProperty.Value.ValueKind is JsonValueKind.String) || !keyValuePairs.ContainsKey(jsonProperty.Name)) - description = string.Empty; - else - description = keyValuePairs[jsonProperty.Name].Split('|')[0]; - } - } - - public List GetIProcessDataDescriptions(JsonElement jsonElement) - { - List results = new List(); - if (jsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - object @object; - Type type = ProcessDataDescription.GetType(); - JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); - JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString }; - for (int i = 0; i < jsonElements.Length; i++) - { - @object = JsonSerializer.Deserialize(jsonElements[i].ToString(), type, jsonSerializerOptions); - if (!(@object is IProcessDataDescription processDataDescription)) - continue; - results.Add(processDataDescription); - } - return results; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/EventName.cs b/Adaptation/Shared/Metrology/EventName.cs deleted file mode 100644 index b34f1de..0000000 --- a/Adaptation/Shared/Metrology/EventName.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public enum EventName - { - FileRead, - FileReadDaily, - FileReadMonthly, - FileReadVerification, - FileReadWeekly - } - -} diff --git a/Adaptation/Shared/Metrology/ILogic.cs b/Adaptation/Shared/Metrology/ILogic.cs deleted file mode 100644 index 01176cf..0000000 --- a/Adaptation/Shared/Metrology/ILogic.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; -using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Text.Json; - -namespace Adaptation.Shared.Metrology -{ - - public interface ILogic - { - - ILogic ShallowCopy(); - Logistics Logistics { get; } - - void ConfigurationRestore(); - string GetConfigurationErrorTargetFileLocation(); - string GetConfigurationSourceFileLocation(); - string GetConfigurationTarget2FileLocation(); - string GetConfigurationTargetFileLocation(); - string GetConfigurationTargetFileName(); - Tuple> GetExtractResult(string reportFullPath, string eventName); - object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile); - string GetReportFullPath(Dictionary keyValuePairs); - string GetTarget2FileLocation(); - void Move(string reportFullPath, Tuple> extractResults, Exception exception = null); - Tuple> ReExtract(string searchDirectory, string sourceFileFilter); - void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums); - ConfigDataBase ReflectionCreateSelfDescriptionV2(string json); - string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); - string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true); - string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); - string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = ""); - void SetFileParameter(string key, string value); - void SetFileParameterLotID(string value, bool includeLogisticsSequence = false); - void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true); - void SetFileParameterSystemDateTimeToLogisticsSequence(); - void SetPlaceHolder(string reportFullPath, string key, string value); - void SetTarget2FileLocation(string value); - - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/MET08AFMD3100.cs b/Adaptation/Shared/Metrology/MET08AFMD3100.cs deleted file mode 100644 index d6525f0..0000000 --- a/Adaptation/Shared/Metrology/MET08AFMD3100.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08AFMD3100 - { - - public enum Test - { - AFMRoughness = Metrology.Test.AFMRoughness - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08ANLYSDIFAAST230.cs b/Adaptation/Shared/Metrology/MET08ANLYSDIFAAST230.cs deleted file mode 100644 index 0c632dd..0000000 --- a/Adaptation/Shared/Metrology/MET08ANLYSDIFAAST230.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08ANLYSDIFAAST230 - { - - public enum Test - { - DiffusionLength = Metrology.Test.DiffusionLength - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08BVHGPROBE.cs b/Adaptation/Shared/Metrology/MET08BVHGPROBE.cs deleted file mode 100644 index 3afc9e2..0000000 --- a/Adaptation/Shared/Metrology/MET08BVHGPROBE.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08BVHGPROBE - { - - public enum Test - { - BreakdownVoltageCenter = Metrology.Test.BreakdownVoltageCenter, - BreakdownVoltageEdge = Metrology.Test.BreakdownVoltageEdge, - BreakdownVoltageMiddle8in = Metrology.Test.BreakdownVoltageMiddle8in - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08CVHGPROBE802B150.cs b/Adaptation/Shared/Metrology/MET08CVHGPROBE802B150.cs deleted file mode 100644 index b13032e..0000000 --- a/Adaptation/Shared/Metrology/MET08CVHGPROBE802B150.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08CVHGPROBE802B150 - { - - public enum Test - { - CV = Metrology.Test.CV, - MonthlyCV = Metrology.Test.MonthlyCV, - WeeklyCV = Metrology.Test.WeeklyCV - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08DDINCAN8620.cs b/Adaptation/Shared/Metrology/MET08DDINCAN8620.cs deleted file mode 100644 index 2149e4f..0000000 --- a/Adaptation/Shared/Metrology/MET08DDINCAN8620.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08DDINCAN8620 - { - - public enum Test - { - CandelaKlarfDC = Metrology.Test.CandelaKlarfDC, - CandelaLaser = Metrology.Test.CandelaLaser, - CandelaVerify = Metrology.Test.CandelaVerify, - CandelaPSL = Metrology.Test.CandelaPSL, - CandelaProdU = Metrology.Test.CandelaProdU - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs b/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs deleted file mode 100644 index 2c41326..0000000 --- a/Adaptation/Shared/Metrology/MET08DDUPSFS6420.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08DDUPSFS6420 - { - - public enum Test - { - Tencor = Metrology.Test.Tencor - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs b/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs deleted file mode 100644 index 2e97af4..0000000 --- a/Adaptation/Shared/Metrology/MET08DDUPSP1TBI.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08DDUPSP1TBI - { - - public enum Test - { - SP1 = Metrology.Test.SP1 - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08EBEAMINTEGRITY26.cs b/Adaptation/Shared/Metrology/MET08EBEAMINTEGRITY26.cs deleted file mode 100644 index d60681a..0000000 --- a/Adaptation/Shared/Metrology/MET08EBEAMINTEGRITY26.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08EBEAMINTEGRITY26 - { - - public enum Test - { - Denton = Metrology.Test.Denton - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08HALLHL5580.cs b/Adaptation/Shared/Metrology/MET08HALLHL5580.cs deleted file mode 100644 index a32918a..0000000 --- a/Adaptation/Shared/Metrology/MET08HALLHL5580.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08HALLHL5580 - { - - public enum Test - { - Hall = Metrology.Test.Hall, - MonthlyHall = Metrology.Test.MonthlyHall, - WeeklyHall = Metrology.Test.WeeklyHall - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08MESMICROSCOPE.cs b/Adaptation/Shared/Metrology/MET08MESMICROSCOPE.cs deleted file mode 100644 index 3df0822..0000000 --- a/Adaptation/Shared/Metrology/MET08MESMICROSCOPE.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08MESMICROSCOPE - { - - public enum Test - { - Microscope = Metrology.Test.Microscope - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08NDFRESIMAP151C.cs b/Adaptation/Shared/Metrology/MET08NDFRESIMAP151C.cs deleted file mode 100644 index 864d15f..0000000 --- a/Adaptation/Shared/Metrology/MET08NDFRESIMAP151C.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08NDFRESIMAP151C - { - - public enum Test - { - Lehighton = Metrology.Test.Lehighton, - VerificationLehighton = Metrology.Test.VerificationLehighton - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08PLMAPRPM.cs b/Adaptation/Shared/Metrology/MET08PLMAPRPM.cs deleted file mode 100644 index f784a51..0000000 --- a/Adaptation/Shared/Metrology/MET08PLMAPRPM.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08PLMAPRPM - { - - public enum Test - { - RPMXY = Metrology.Test.RPMXY, - RPMAverage = Metrology.Test.RPMAverage, - RPMPLRatio = Metrology.Test.RPMPLRatio, - DailyRPMXY = Metrology.Test.DailyRPMXY, - DailyRPMAverage = Metrology.Test.DailyRPMAverage, - DailyRPMPLRatio = Metrology.Test.DailyRPMPLRatio, - VerificationRPM = Metrology.Test.VerificationRPM - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08PRFUSB4000.cs b/Adaptation/Shared/Metrology/MET08PRFUSB4000.cs deleted file mode 100644 index 4f6db44..0000000 --- a/Adaptation/Shared/Metrology/MET08PRFUSB4000.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08PRFUSB4000 - { - - public enum Test - { - Photoreflectance = Metrology.Test.Photoreflectance - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08RESIHGCV.cs b/Adaptation/Shared/Metrology/MET08RESIHGCV.cs deleted file mode 100644 index f0a0063..0000000 --- a/Adaptation/Shared/Metrology/MET08RESIHGCV.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08RESIHGCV - { - - public enum Test - { - HgCV = Metrology.Test.HgCV - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs b/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs deleted file mode 100644 index c09df31..0000000 --- a/Adaptation/Shared/Metrology/MET08RESIMAPCDE.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08RESIMAPCDE - { - - public enum Test - { - CDE = Metrology.Test.CDE - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs b/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs deleted file mode 100644 index a94645e..0000000 --- a/Adaptation/Shared/Metrology/MET08THFTIRQS408M.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08THFTIRQS408M - { - - public enum Test - { - BioRadQS408M = Metrology.Test.BioRadQS408M - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs b/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs deleted file mode 100644 index 66d933a..0000000 --- a/Adaptation/Shared/Metrology/MET08THFTIRSTRATUS.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08THFTIRSTRATUS - { - - public enum Test - { - BioRadStratus = Metrology.Test.BioRadStratus - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08UVH44GS100M.cs b/Adaptation/Shared/Metrology/MET08UVH44GS100M.cs deleted file mode 100644 index f69f7ab..0000000 --- a/Adaptation/Shared/Metrology/MET08UVH44GS100M.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08UVH44GS100M - { - - public enum Test - { - UV = Metrology.Test.UV - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08VPDSUBCON.cs b/Adaptation/Shared/Metrology/MET08VPDSUBCON.cs deleted file mode 100644 index 92d070b..0000000 --- a/Adaptation/Shared/Metrology/MET08VPDSUBCON.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08VPDSUBCON - { - - public enum Test - { - VpdIcpmsAnalyte = Metrology.Test.VpdIcpmsAnalyte - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08WGEOMX203641Q.cs b/Adaptation/Shared/Metrology/MET08WGEOMX203641Q.cs deleted file mode 100644 index 028696c..0000000 --- a/Adaptation/Shared/Metrology/MET08WGEOMX203641Q.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08WGEOMX203641Q - { - - public enum Test - { - WarpAndBow = Metrology.Test.WarpAndBow, - VerificationWarpAndBow = Metrology.Test.VerificationWarpAndBow - } - - } - -} diff --git a/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs b/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs deleted file mode 100644 index d900c33..0000000 --- a/Adaptation/Shared/Metrology/MET08XRDXPERTPROMRDXL.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public class MET08XRDXPERTPROMRDXL - { - - public enum Test - { - XRDXY = Metrology.Test.XRDXY, - XRDWeightedAverage = Metrology.Test.XRDWeightedAverage, - MonthlyXRD = Metrology.Test.MonthlyXRD, - WeeklyXRD = Metrology.Test.WeeklyXRD, - WeeklyXRDAIcomp = Metrology.Test.WeeklyXRDAIcomp, - WeeklyXRDFWHM002 = Metrology.Test.WeeklyXRDFWHM002, - WeeklyXRDFWHM105 = Metrology.Test.WeeklyXRDFWHM105, - WeeklyXRDSLStks = Metrology.Test.WeeklyXRDSLStks, - WeeklyXRDXRR = Metrology.Test.WeeklyXRDXRR, - XRDXRAY = Metrology.Test.XRDXRAY - } - - } - -} diff --git a/Adaptation/Shared/Metrology/OIGaNViewer.cs b/Adaptation/Shared/Metrology/OIGaNViewer.cs deleted file mode 100644 index 8a15858..0000000 --- a/Adaptation/Shared/Metrology/OIGaNViewer.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; - -namespace Adaptation.Shared.Metrology -{ - - internal class OIGaNViewer - { - - private static System.Net.WebClient _WebClient; - - internal static string WebClientDownloadString(string baseAddress, ConfigDataBase configDataBase, string reportFullPath, bool isErrorFile, string target) - { - string result = string.Empty; - if (System.Diagnostics.Debugger.IsAttached) - result = DateTime.Now.ToString(); - else - { - if (string.IsNullOrEmpty(baseAddress) || !baseAddress.Contains(":") || !baseAddress.Contains(".")) - throw new Exception("Invalid URL"); - try - { - if (_WebClient is null) - _WebClient = new System.Net.WebClient(); - string address = string.Concat(baseAddress, "/Home/ExtractMove/?equipment_connection=", configDataBase.GetEquipmentType(), "&is_error_file=", isErrorFile); - _WebClient.OpenRead(address); - result = _WebClient.ResponseHeaders["Date"]; - _WebClient.CancelAsync(); - } - catch (Exception) { } - } - return result; - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs b/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs deleted file mode 100644 index 1a7dc26..0000000 --- a/Adaptation/Shared/Metrology/ProcessData.Duplicator.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.Json; - -namespace Adaptation.Shared.Metrology -{ - - public class Duplicator - { - - public class Description : IProcessDataDescription - { - - public int Test { get; set; } - public int Count { get; set; } - public int Index { get; set; } - // - public string EventName { get; set; } - public string NullData { get; set; } - public string JobID { get; set; } - public string Sequence { get; set; } - public string MesEntity { get; set; } - public string ReportFullPath { get; set; } - public string ProcessJobID { get; set; } - public string MID { get; set; } - public string Date { get; set; } //2021-02-22 - - public string GetEventDescription() { return "File Has been read and parsed"; } - - public List GetHeaderNames(ILogic logic, ConfigDataBase configDataBase) - { - List results = new List(); - return results; - } - - public List GetDetailNames(ILogic logic, ConfigDataBase configDataBase) - { - List results = new List(); - return results; - } - - public List GetParameterNames(ILogic logic, ConfigDataBase configDataBase) - { - List results = new List(); - return results; - } - - public List GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase) - { - List results = new List(); - return results; - } - - public List GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test) - { - List results = new List(); - return results; - } - - public List GetNames(ILogic logic, ConfigDataBase configDataBase) - { - List results = new List(); - IProcessDataDescription processDataDescription = GetDefault(logic, configDataBase); - string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType()); - object @object = JsonSerializer.Deserialize(json); - if (!(@object is JsonElement jsonElement)) - throw new Exception(); - foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject()) - results.Add(jsonProperty.Name); - return results; - } - - public IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase) - { - Description result = new Description(); - return result; - } - - public IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase) - { - Description result = new Description - { - Test = -1, - Count = 0, - Index = -1, - // - EventName = configDataBase.GetEventName(), - NullData = string.Empty, - JobID = logic.Logistics.JobID, - Sequence = logic.Logistics.Sequence.ToString(), - MesEntity = logic.Logistics.MesEntity, - ReportFullPath = logic.Logistics.ReportFullPath, - ProcessJobID = logic.Logistics.ProcessJobID, - MID = logic.Logistics.MID, - Date = logic.Logistics.DateTimeFromSequence.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss"), - }; - return result; - } - - public List GetDescription(ILogic logic, ConfigDataBase configDataBase, List tests, IProcessData iProcessData) - { - List results = new List(); - return results; - } - - } - - } - -} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs b/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs deleted file mode 100644 index 9e16fa0..0000000 --- a/Adaptation/Shared/Metrology/ProcessDataStandardFormat.cs +++ /dev/null @@ -1,527 +0,0 @@ -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.Metrology -{ - - public class ProcessDataStandardFormat - { - - public const string RecordStart = "RECORD_START"; - - public enum SearchFor - { - EquipmentIntegration = 1, - BusinessIntegration = 2, - SystemExport = 3, - Archive = 4 - } - - public static string GetPDSFText(ILogic logic, string eventName, string equipmentType, JsonElement jsonElement, string logisticsText) - { - string result; - if (jsonElement.ValueKind != JsonValueKind.Array) - result = string.Empty; - else - { - int columns = 0; - List lines; - string endOffset = "E#######T"; - string dataOffset = "D#######T"; - string headerOffset = "H#######T"; - string format = "MM/dd/yyyy HH:mm:ss"; - StringBuilder stringBuilder = new StringBuilder(); - 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'); - JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); - 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 ", logic.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=", eventName, ";A_INFO2=", equipmentType, ";A_JOBID=", logic.Logistics.JobID, ";A_MES_ENTITY=", logic.Logistics.MesEntity, ";A_MID=", logic.Logistics.MID, ";A_NULL_DATA=", logic.Logistics.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logic.Logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logic.Logistics.Sequence, ";A_WAFER_ID=;")); - lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", eventName, ";B_INFO2=", equipmentType, ";B_JOBID=", logic.Logistics.JobID, ";B_MES_ENTITY=", logic.Logistics.MesEntity, ";B_MID=", logic.Logistics.MID, ";B_NULL_DATA=", logic.Logistics.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logic.Logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logic.Logistics.Sequence, ";B_WAFER_ID=;")); - lines.Add("END_HEADER"); - } - stringBuilder.Clear(); - foreach (string line in lines) - stringBuilder.AppendLine(line); - result = stringBuilder.ToString(); - result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')). - Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')). - Replace(endOffset, result.Length.ToString().PadLeft(9, '0')); - } - return result; - } - - public static Tuple GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null) - { - string segment; - List body = new List(); - StringBuilder logistics = new StringBuilder(); - if (lines is null) - lines = File.ReadAllLines(reportFullPath); - string[] segments; - if (lines.Length < 7) - segments = new string[] { }; - else - segments = lines[6].Trim().Split('\t'); - List columns = new List(); - for (int c = 0; c < segments.Length; c++) - { - segment = segments[c].Substring(1, segments[c].Length - 2); - if (!columns.Contains(segment)) - columns.Add(segment); - else - { - for (short i = 1; i < short.MaxValue; i++) - { - segment = string.Concat(segment, "_", i); - if (!columns.Contains(segment)) - { - columns.Add(segment); - break; - } - } - } - } - bool lookForLogistics = false; - for (int r = 7; r < lines.Count(); r++) - { - if (lines[r].StartsWith("NUM_DATA_ROWS")) - lookForLogistics = true; - if (!lookForLogistics) - { - body.Add(lines[r]); - continue; - } - if (lines[r].StartsWith("LOGISTICS_1")) - { - for (int i = r; i < lines.Count(); i++) - { - if (lines[r].StartsWith("END_HEADER")) - break; - logistics.AppendLine(lines[i]); - } - break; - } - } - return new Tuple(logistics.ToString(), columns.ToArray(), body.ToArray()); - } - - public static JsonElement GetArray(Tuple pdsf, bool lookForNumbers = false) - { - JsonElement result; - string logistics = pdsf.Item1; - string[] columns = pdsf.Item2; - string[] bodyLines = pdsf.Item3; - if (!bodyLines.Any() || !bodyLines[0].Contains('\t')) - result = JsonSerializer.Deserialize("[]"); - else - { - string value; - string[] segments; - StringBuilder stringBuilder = new StringBuilder(); - 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); - result = JsonSerializer.Deserialize(string.Concat("[", stringBuilder, "]")); - } - return result; - } - - public static Dictionary> GetDictionary(Tuple pdsf) - { - Dictionary> results = new Dictionary>(); - string[] segments; - string[] columns = pdsf.Item2; - string[] bodyLines = pdsf.Item3; - foreach (string column in columns) - results.Add(column, new List()); - foreach (string bodyLine in bodyLines) - { - segments = bodyLine.Split('\t'); - for (int c = 1; c < segments.Length; c++) - { - if (c >= columns.Length) - continue; - results[columns[c]].Add(segments[c]); - } - } - return results; - } - - public static Tuple>>> GetTestDictionary(Tuple pdsf) - { - Dictionary>> results = new Dictionary>>(); - string testColumn = Description.RowColumn.Test.ToString(); - Dictionary> keyValuePairs = GetDictionary(pdsf); - if (!keyValuePairs.ContainsKey(testColumn)) - throw new Exception(); - int min; - int max; - Test testKey; - List vs; - string columnKey; - Dictionary> tests = new Dictionary>(); - for (int i = 0; i < keyValuePairs[testColumn].Count; i++) - { - if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test)) - { - if (!results.ContainsKey(test)) - { - tests.Add(test, new List()); - results.Add(test, new Dictionary>()); - } - tests[test].Add(i); - } - } - foreach (KeyValuePair> testKeyValuePair in tests) - { - testKey = testKeyValuePair.Key; - min = testKeyValuePair.Value.Min(); - max = testKeyValuePair.Value.Max() + 1; - foreach (KeyValuePair> keyValuePair in keyValuePairs) - results[testKey].Add(keyValuePair.Key, new List()); - foreach (KeyValuePair> keyValuePair in keyValuePairs) - { - vs = keyValuePair.Value; - columnKey = keyValuePair.Key; - for (int i = min; i < max; i++) - { - if (vs.Count > i) - results[testKey][columnKey].Add(vs[i]); - else - results[testKey][columnKey].Add(string.Empty); - } - } - } - return new Tuple>>>(pdsf.Item1, results); - } - - private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ') - { - if (!addSpaces) - return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor); - else - return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex"))); - } - - public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') - { - return GetString(SearchFor.EquipmentIntegration, addSpaces, separator); - } - - public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') - { - return GetString(SearchFor.BusinessIntegration, addSpaces, separator); - } - - public static string SystemExport(bool addSpaces = true, char separator = ' ') - { - return GetString(SearchFor.SystemExport, addSpaces, separator); - } - - public static string Archive(bool addSpaces = true, char separator = ' ') - { - return GetString(SearchFor.Archive, addSpaces, separator); - } - - public static string GetLines(Logistics logistics, IScopeInfo scopeInfo, Dictionary> keyValuePairs, Enum[] enumColumns, string dateFormat, string timeFormat, Column[] pairedColumns, bool useDateTimeFromSequence = true, string format = "", Dictionary alternateDisplayName = null, Enum[] ignoreColumns = null) - { - StringBuilder result = new StringBuilder(); - if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) - throw new Exception(); - else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) - throw new Exception(); - int start; - string ckey; - string pKey; - int pairedColumnsCount; - string firstDuplicate = "_1"; - if (ignoreColumns is null) - ignoreColumns = new Enum[] { }; - if (alternateDisplayName is null) - alternateDisplayName = new Dictionary(); - string columnDate = Column.Date.ToString(); - string columnTime = Column.Time.ToString(); - List columnKeys = new List(); - foreach (Enum item in enumColumns) - { - if (ignoreColumns.Contains(item)) - continue; - columnKeys.Add(item.ToString()); - } - result.AppendLine(scopeInfo.Header); - StringBuilder line = new StringBuilder(); - int count = keyValuePairs[Description.RowColumn.Count.ToString()].Count(); - string nullData; - if (logistics.NullData is null) - nullData = string.Empty; - else - nullData = logistics.NullData.ToString(); - if (pairedColumns is null) - { - start = -1; - pairedColumnsCount = 0; - } - else - { - start = 0; - pairedColumnsCount = pairedColumns.Length; - } - for (int r = 0; r < count; r++) - { - for (int p = start; p < pairedColumnsCount; p++) - { - if (pairedColumnsCount == 0) - pKey = string.Empty; - else if (!(ignoreColumns is null) && ignoreColumns.Contains(pairedColumns[p])) - continue; - else - { - pKey = pairedColumns[p].ToString(); - if (!keyValuePairs.ContainsKey(pKey)) - continue; - else if (keyValuePairs[pKey][r] == nullData) - continue; - } - if (pairedColumnsCount == 0 || !string.IsNullOrEmpty(pKey)) - { - line.Clear(); - line.Append("!"); - for (int i = 0; i < columnKeys.Count; i++) - { - ckey = columnKeys[i]; - if (!keyValuePairs.ContainsKey(ckey)) - line.Append(string.Empty); - else - { - if (useDateTimeFromSequence && ckey == columnDate) - line.Append(logistics.DateTimeFromSequence.ToString(dateFormat)); - else if (useDateTimeFromSequence && ckey == columnTime) - line.Append(logistics.DateTimeFromSequence.ToString(timeFormat)); - else if (!useDateTimeFromSequence && ckey == columnDate && keyValuePairs[ckey][r].Length == format.Length) - line.Append(DateTime.ParseExact(keyValuePairs[ckey][r], format, CultureInfo.InvariantCulture).ToString(dateFormat)); - else if (!useDateTimeFromSequence && ckey == columnTime && keyValuePairs.ContainsKey(string.Concat(ckey, firstDuplicate)) && keyValuePairs[string.Concat(ckey, firstDuplicate)][r].Length == format.Length) - line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(ckey, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat)); - else - line.Append(keyValuePairs[ckey][r]); - } - line.Append(';'); - } - if (pairedColumnsCount > 0) - { - if (!alternateDisplayName.ContainsKey(pairedColumns[p])) - line.Append(pairedColumns[p].GetDiplayName()); - else - line.Append(alternateDisplayName[pairedColumns[p]]); - line.Append(';'); - line.Append(keyValuePairs[pKey][r]); - line.Append(';'); - } - line.Remove(line.Length - 1, 1); - result.AppendLine(line.ToString()); - } - } - } - return result.ToString(); - } - - public static string GetLines(Logistics logistics, IScopeInfo scopeInfo, List names, Dictionary> keyValuePairs, string dateFormat, string timeFormat, List pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List ignoreParameterNames = null) - { - StringBuilder result = new StringBuilder(); - if (ignoreParameterNames is null) - ignoreParameterNames = new List(); - if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) - throw new Exception(); - else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) - throw new Exception(); - string nullData; - const string columnDate = "Date"; - const string columnTime = "Time"; - const string firstDuplicate = "_1"; - result.AppendLine(scopeInfo.Header); - StringBuilder line = new StringBuilder(); - if (logistics.NullData is null) - nullData = string.Empty; - else - nullData = logistics.NullData.ToString(); - int count = (from l in keyValuePairs select l.Value.Count).Min(); - for (int r = 0; r < count; r++) - { - line.Clear(); - line.Append("!"); - foreach (KeyValuePair> keyValuePair in keyValuePairs) - { - if (!names.Contains(keyValuePair.Key)) - continue; - if (ignoreParameterNames.Contains(keyValuePair.Key)) - continue; - if (pairedParameterNames.Contains(keyValuePair.Key)) - { - if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) - continue; - else - result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]); - } - else - { - if (useDateTimeFromSequence && keyValuePair.Key == columnDate) - line.Append(logistics.DateTimeFromSequence.ToString(dateFormat)); - else if (useDateTimeFromSequence && keyValuePair.Key == columnTime) - line.Append(logistics.DateTimeFromSequence.ToString(timeFormat)); - else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length) - line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat)); - else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length) - line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat)); - else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) - line.Append(nullData); - else - line.Append(keyValuePair.Value[r]); - line.Append(';'); - } - } - if (!pairedParameterNames.Any()) - { - line.Remove(line.Length - 1, 1); - result.AppendLine(line.ToString()); - } - } - return result.ToString(); - } - - public static List PDSFToFixedWidth(string reportFullPath) - { - List results = new List(); - if (!File.Exists(reportFullPath)) - throw new Exception(); - int[] group; - string line; - int startsAt = 0; - string[] segments; - int? currentGroup = null; - char inputSeperator = '\t'; - char outputSeperator = '\t'; - List vs = new List(); - List groups = new List(); - string[] lines = File.ReadAllLines(reportFullPath); - StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < lines.Length; i++) - { - if (string.IsNullOrEmpty(lines[i])) - continue; - segments = lines[i].Split(inputSeperator); - if (currentGroup is null) - currentGroup = segments.Length; - if (segments.Length != currentGroup) - { - currentGroup = segments.Length; - groups.Add(new int[] { startsAt, i - 1 }); - startsAt = i; - } - } - if (startsAt == lines.Length - 1 && lines[0].Split(inputSeperator).Length != currentGroup) - groups.Add(new int[] { lines.Length - 1, lines.Length - 1 }); - for (int g = 0; g < groups.Count; g++) - { - vs.Clear(); - group = groups[g]; - line = lines[group[0]]; - segments = line.Split(inputSeperator); - for (int s = 0; s < segments.Length; s++) - vs.Add(segments[s].Length); - for (int i = group[0]; i <= group[1]; i++) - { - line = lines[i]; - segments = line.Split(inputSeperator); - for (int s = 0; s < segments.Length; s++) - { - if (vs[s] < segments[s].Length) - vs[s] = segments[s].Length; - } - } - stringBuilder.Clear(); - for (int s = 0; s < segments.Length; s++) - stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator); - stringBuilder.Remove(stringBuilder.Length - 1, 1); - results.Add(stringBuilder.ToString()); - for (int i = group[0]; i <= group[1]; i++) - { - line = lines[i]; - stringBuilder.Clear(); - segments = line.Split(inputSeperator); - for (int s = 0; s < segments.Length; s++) - stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator); - stringBuilder.Remove(stringBuilder.Length - 1, 1); - results.Add(stringBuilder.ToString()); - } - results.Add(string.Empty); - } - return results; - } - - } - -} diff --git a/Adaptation/Shared/Metrology/ScopeInfo.cs b/Adaptation/Shared/Metrology/ScopeInfo.cs index 02c7441..2de909e 100644 --- a/Adaptation/Shared/Metrology/ScopeInfo.cs +++ b/Adaptation/Shared/Metrology/ScopeInfo.cs @@ -1,409 +1,300 @@ using System; using System.IO; -namespace Adaptation.Shared.Metrology +namespace Adaptation.Shared.Metrology; + +public class ScopeInfo : Properties.IScopeInfo { - public class ScopeInfo : 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 = "") { - - 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 EquipmentType EquipmentType { get; private set; } - - public ScopeInfo(ILogic logic, ConfigDataBase configDataBase, Test test) - { - Enum = test; - Test = test; - TestValue = (int)test; - if (configDataBase.EquipmentConnection is null) - EquipmentType = configDataBase.EquipmentType; - else - EquipmentType = configDataBase.EquipmentConnection.Value; - string eventName = GetEventNameAndSetRemaining(); - if (eventName != configDataBase.GetEventName()) - { - File.Move(logic.Logistics.ReportFullPath, Path.ChangeExtension(logic.Logistics.ReportFullPath, eventName)); - throw new Exception(); - } - else if (EquipmentType != configDataBase.EquipmentType && EquipmentType != configDataBase.EquipmentConnection) - { - File.Move(logic.Logistics.ReportFullPath, Path.ChangeExtension(logic.Logistics.ReportFullPath, EquipmentType.ToString())); - throw new Exception(); - } - } - - public ScopeInfo(ILogic logic, ConfigDataBase configDataBase, Test test, string fileName, string queryFilter, string title = "", string html = "") - { - Enum = test; - Test = test; - TestValue = (int)test; - if (configDataBase.EquipmentConnection is null) - EquipmentType = configDataBase.EquipmentType; - else - EquipmentType = configDataBase.EquipmentConnection.Value; - FileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName); - Header = string.Empty; - QueryFilter = queryFilter; - Title = title; - HTML = html; - FileName = fileName; - } - - public ScopeInfo ShallowCopy() - { - return (ScopeInfo)MemberwiseClone(); - } - - private string GetEventNameAndSetRemaining() - { - EventName eventName; - switch (Test) - { - case Test.AFMRoughness: - EquipmentType = EquipmentType.MET08AFMD3100; - eventName = EventName.FileRead; - FileNameWithoutExtension = "afm_iqs_01"; - Header = string.Empty; - QueryFilter = "AFM Roughness"; - Title = "AFM"; - HTML = @"GaN Epi Data\10 - afm.html"; - break; - case Test.BreakdownVoltageCenter: - EquipmentType = EquipmentType.MET08BVHGPROBE; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08BVHGPROBE; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08BVHGPROBE; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08CVHGPROBE802B150; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08CVHGPROBE802B150_Monthly; - eventName = EventName.FileReadMonthly; - 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: - EquipmentType = EquipmentType.MET08CVHGPROBE802B150_Weekly; - eventName = EventName.FileReadWeekly; - 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: - EquipmentType = EquipmentType.MET08DDINCAN8620; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08DDINCAN8620; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08DDINCAN8620; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08DDINCAN8620_Daily; - eventName = EventName.FileReadDaily; - FileNameWithoutExtension = "candela_iqs_01"; - Header = string.Empty; - QueryFilter = "102-83nm"; - Title = "Candela"; - HTML = @"GaN Epi Data\12 - candela.html"; - break; - case Test.CandelaProdU: - EquipmentType = EquipmentType.MET08DDINCAN8620_Daily; - eventName = EventName.FileReadDaily; - FileNameWithoutExtension = "candela_iqs_01"; - Header = string.Empty; - QueryFilter = "SPE verification"; - Title = "Candela"; - HTML = @"GaN Epi Data\12 - candela.html"; - break; - case Test.Denton: - EquipmentType = EquipmentType.MET08EBEAMINTEGRITY26; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08HALLHL5580; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08HALLHL5580_Monthly; - eventName = EventName.FileReadMonthly; - 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: - EquipmentType = EquipmentType.MET08HALLHL5580_Weekly; - eventName = EventName.FileReadWeekly; - 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: - EquipmentType = EquipmentType.MET08NDFRESIMAP151C; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08NDFRESIMAP151C_Verification; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08MESMICROSCOPE; - eventName = EventName.FileRead; - FileNameWithoutExtension = string.Empty; - Header = string.Empty; - QueryFilter = "Microscope Center 5x"; - Title = "Total Microscope Defects"; - HTML = string.Empty; - break; - case Test.RPMXY: - EquipmentType = EquipmentType.MET08PLMAPRPM; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; - eventName = EventName.FileReadDaily; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; - eventName = EventName.FileReadDaily; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM_Daily; - eventName = EventName.FileReadDaily; - 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: - EquipmentType = EquipmentType.MET08PLMAPRPM_Verification; - eventName = EventName.FileReadVerification; - 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: - EquipmentType = EquipmentType.MET08PRFUSB4000; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08UVH44GS100M; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08VPDSUBCON; - eventName = EventName.FileRead; - FileNameWithoutExtension = "VPD_iqs_01"; - Header = "Reactor;RunID;RunDate;PartNumber;PocketNumber;WaferScribe;Analyte;Value"; - QueryFilter = "Mg"; - Title = "VpdIcpmsAnalyteData"; - HTML = @""; - break; - case Test.WarpAndBow: - EquipmentType = EquipmentType.MET08WGEOMX203641Q; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08WGEOMX203641Q_Verification; - eventName = EventName.FileReadVerification; - 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: - EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL; - eventName = EventName.FileRead; - 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: - EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL_Monthly; - eventName = EventName.FileReadMonthly; - 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: - EquipmentType = EquipmentType.MET08XRDXPERTPROMRDXL_Weekly; - eventName = EventName.FileReadWeekly; - 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.XRDXRAY: - EquipmentType = EquipmentType.METBRXRAYJV7300L; - eventName = EventName.FileRead; - 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"); - return eventName.ToString(); - } - - public override string ToString() - { - return string.Concat(EquipmentType, " - (", Enum, ""); - } - + 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(); + } \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/Test.cs b/Adaptation/Shared/Metrology/Test.cs deleted file mode 100644 index 9d9d076..0000000 --- a/Adaptation/Shared/Metrology/Test.cs +++ /dev/null @@ -1,57 +0,0 @@ -namespace Adaptation.Shared.Metrology -{ - - public enum Test - { - AFMRoughness = 34, - BioRadQS408M = 25, - BioRadStratus = 26, - BreakdownVoltageCenter = 0, - BreakdownVoltageEdge = 1, - BreakdownVoltageMiddle8in = 2, - CandelaKlarfDC = 6, - CandelaLaser = 36, - CandelaProdU = 39, - CandelaPSL = 38, - CandelaVerify = 37, - CDE = 24, - CV = 3, - DailyRPMAverage = 19, - DailyRPMPLRatio = 20, - DailyRPMXY = 18, - Denton = 9, - DiffusionLength = 45, - Hall = 10, - HgCV = 23, - Lehighton = 13, - Microscope = 46, - MonthlyCV = 4, - MonthlyHall = 11, - MonthlyXRD = 32, - Photoreflectance = 22, - PlatoA = 48, //Largest - RPMAverage = 16, - RPMPLRatio = 17, - RPMXY = 15, - SP1 = 8, - Tencor = 7, - UV = 35, - VerificationLehighton = 14, - VerificationRPM = 21, - VerificationWarpAndBow = 29, - VpdIcpmsAnalyte = 27, - WarpAndBow = 28, - WeeklyCV = 5, - WeeklyHall = 12, - WeeklyXRD = 33, - WeeklyXRDAIcomp = 40, - WeeklyXRDFWHM002 = 41, - WeeklyXRDFWHM105 = 42, - WeeklyXRDSLStks = 43, - WeeklyXRDXRR = 44, - XRDWeightedAverage = 31, - JVXRD = 47, - XRDXY = 30 - } - -} diff --git a/Adaptation/Shared/Metrology/WS.Attachment.cs b/Adaptation/Shared/Metrology/WS.Attachment.cs new file mode 100644 index 0000000..ea105ed --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.Attachment.cs @@ -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; + } + + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.Results.cs b/Adaptation/Shared/Metrology/WS.Results.cs new file mode 100644 index 0000000..2d1c603 --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.Results.cs @@ -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 Errors { get; set; } + + // this collection will contain a list of warnings, they will not prevent data from being saved + public List Warnings { get; set; } + + // this is just a helper function to make displaying the results easier + public override string ToString() => JsonSerializer.Serialize(this, GetType()); + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Metrology/WS.cs b/Adaptation/Shared/Metrology/WS.cs new file mode 100644 index 0000000..ae43eb9 --- /dev/null +++ b/Adaptation/Shared/Metrology/WS.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Text.Json; + +namespace Adaptation.Shared.Metrology; + +public partial class WS +{ + + public static Tuple 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(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(); + results.Errors.Add(stringBuilder.ToString()); + } + return new Tuple(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 headerAttachments = null, List 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()); + } + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/ParameterType.cs b/Adaptation/Shared/ParameterType.cs new file mode 100644 index 0000000..cd3fc15 --- /dev/null +++ b/Adaptation/Shared/ParameterType.cs @@ -0,0 +1,10 @@ +namespace Adaptation.Shared; + +public enum ParameterType +{ + String = 0, + Integer = 2, + Double = 3, + Boolean = 4, + StructuredType = 5 +} \ No newline at end of file diff --git a/Adaptation/Shared/ProcessDataStandardFormat.cs b/Adaptation/Shared/ProcessDataStandardFormat.cs new file mode 100644 index 0000000..251d1b4 --- /dev/null +++ b/Adaptation/Shared/ProcessDataStandardFormat.cs @@ -0,0 +1,411 @@ +using Adaptation.Shared.Methods; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.Json; + +namespace Adaptation.Shared; + +public class ProcessDataStandardFormat +{ + + public const string RecordStart = "RECORD_START"; + + public enum SearchFor + { + EquipmentIntegration = 1, + BusinessIntegration = 2, + SystemExport = 3, + Archive = 4 + } + + public static string GetPDSFText(IFileRead fileRead, Logistics logistics, JsonElement[] jsonElements, string logisticsText) + { + string result; + if (!jsonElements.Any()) + result = string.Empty; + else + { + int columns = 0; + List lines; + string endOffset = "E#######T"; + string dataOffset = "D#######T"; + string headerOffset = "H#######T"; + string format = "MM/dd/yyyy HH:mm:ss"; + StringBuilder stringBuilder = new(); + lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList(); + _ = stringBuilder.Append("\"Time\"").Append('\t'); + _ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t'); + _ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t'); + for (int i = 0; i < jsonElements.Length;) + { + foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject()) + { + columns += 1; + _ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t'); + } + break; + } + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + lines.Add(stringBuilder.ToString()); + for (int i = 0; i < jsonElements.Length; i++) + { + _ = stringBuilder.Clear(); + _ = stringBuilder.Append("0.1").Append('\t'); + _ = stringBuilder.Append('1').Append('\t'); + _ = stringBuilder.Append('2').Append('\t'); + foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject()) + _ = stringBuilder.Append(jsonProperty.Value).Append('\t'); + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + lines.Add(stringBuilder.ToString()); + } + lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0'))); + lines.Add(string.Concat("NUM_DATA_COLUMNS ", (columns + 3).ToString().PadLeft(9, '0'))); + lines.Add("DELIMITER ;"); + lines.Add(string.Concat("START_TIME_FORMAT ", format)); + lines.Add(string.Concat("START_TIME ", logistics.DateTimeFromSequence.ToString(format))); //12/26/2019 15:22:44 + lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "A_LOGISTICS")); + lines.Add(string.Concat("LOGISTICS_COLUMN", '\t', "B_LOGISTICS")); + if (!string.IsNullOrEmpty(logisticsText)) + lines.Add(logisticsText); + else + { + lines.Add(string.Concat("LOGISTICS_1", '\t', "A_CHAMBER=;A_INFO=", fileRead.EventName, ";A_INFO2=", fileRead.EquipmentType, ";A_JOBID=", fileRead.CellInstanceName, ";A_MES_ENTITY=", fileRead.MesEntity, ";A_MID=", logistics.MID, ";A_NULL_DATA=", fileRead.NullData, ";A_PPID=NO_PPID;A_PROCESS_JOBID=", logistics.ProcessJobID, ";A_PRODUCT=;A_SEQUENCE=", logistics.Sequence, ";A_WAFER_ID=;")); + lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;")); + lines.Add("END_HEADER"); + } + _ = stringBuilder.Clear(); + foreach (string line in lines) + _ = stringBuilder.AppendLine(line); + result = stringBuilder.ToString(); + result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')). + Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')). + Replace(endOffset, result.Length.ToString().PadLeft(9, '0')); + } + return result; + } + + public static Tuple GetLogisticsColumnsAndBody(string reportFullPath, string[] lines = null) + { + string segment; + List body = new(); + StringBuilder logistics = new(); + if (lines is null) + lines = File.ReadAllLines(reportFullPath); + string[] segments; + if (lines.Length < 7) + segments = Array.Empty(); + else + segments = lines[6].Trim().Split('\t'); + List columns = new(); + for (int c = 0; c < segments.Length; c++) + { + segment = segments[c].Substring(1, segments[c].Length - 2); + if (!columns.Contains(segment)) + columns.Add(segment); + else + { + for (short i = 1; i < short.MaxValue; i++) + { + segment = string.Concat(segment, "_", i); + if (!columns.Contains(segment)) + { + columns.Add(segment); + break; + } + } + } + } + bool lookForLogistics = false; + for (int r = 7; r < lines.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(logistics.ToString(), columns.ToArray(), body.ToArray()); + } + + public static JsonElement[] GetArray(Tuple pdsf, bool lookForNumbers = false) + { + JsonElement[] results; + string logistics = pdsf.Item1; + string[] columns = pdsf.Item2; + string[] bodyLines = pdsf.Item3; + if (!bodyLines.Any() || !bodyLines[0].Contains('\t')) + results = JsonSerializer.Deserialize("[]"); + else + { + string value; + string[] segments; + StringBuilder stringBuilder = new(); + foreach (string bodyLine in bodyLines) + { + _ = stringBuilder.Append('{'); + segments = bodyLine.Trim().Split('\t'); + if (!lookForNumbers) + { + for (int c = 1; c < segments.Length; c++) + { + value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\"); + _ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\","); + } + } + else + { + for (int c = 1; c < segments.Length; c++) + { + value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\"); + if (string.IsNullOrEmpty(value)) + _ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,"); + else if (value.All(char.IsDigit)) + _ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(','); + else + _ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\","); + } + } + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + _ = stringBuilder.AppendLine("},"); + } + _ = stringBuilder.Remove(stringBuilder.Length - 3, 3); + results = JsonSerializer.Deserialize(string.Concat("[", stringBuilder, "]")); + } + return results; + } + + public static Dictionary> GetDictionary(Tuple pdsf) + { + Dictionary> results = new(); + string[] segments; + string[] columns = pdsf.Item2; + string[] bodyLines = pdsf.Item3; + foreach (string column in columns) + results.Add(column, new List()); + foreach (string bodyLine in bodyLines) + { + segments = bodyLine.Split('\t'); + for (int c = 1; c < segments.Length; c++) + { + if (c >= columns.Length) + continue; + results[columns[c]].Add(segments[c]); + } + } + return results; + } + + public static Tuple>>> GetTestDictionary(Tuple pdsf) + { + Dictionary>> results = new(); + string testColumn = nameof(Test); + Dictionary> keyValuePairs = GetDictionary(pdsf); + if (!keyValuePairs.ContainsKey(testColumn)) + throw new Exception(); + int min; + int max; + Test testKey; + List vs; + string columnKey; + Dictionary> tests = new(); + for (int i = 0; i < keyValuePairs[testColumn].Count; i++) + { + if (Enum.TryParse(keyValuePairs[testColumn][i], out Test test)) + { + if (!results.ContainsKey(test)) + { + tests.Add(test, new List()); + results.Add(test, new Dictionary>()); + } + tests[test].Add(i); + } + } + foreach (KeyValuePair> testKeyValuePair in tests) + { + testKey = testKeyValuePair.Key; + min = testKeyValuePair.Value.Min(); + max = testKeyValuePair.Value.Max() + 1; + foreach (KeyValuePair> keyValuePair in keyValuePairs) + results[testKey].Add(keyValuePair.Key, new List()); + foreach (KeyValuePair> keyValuePair in keyValuePairs) + { + vs = keyValuePair.Value; + columnKey = keyValuePair.Key; + for (int i = min; i < max; i++) + { + if (vs.Count > i) + results[testKey][columnKey].Add(vs[i]); + else + results[testKey][columnKey].Add(string.Empty); + } + } + } + return new Tuple>>>(pdsf.Item1, results); + } + + private static string GetString(SearchFor searchFor, bool addSpaces, char separator = ' ') + { + if (!addSpaces) + return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), searchFor); + else + return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex"))); + } + + public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') => 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 names, Dictionary> keyValuePairs, string dateFormat, string timeFormat, List pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List ignoreParameterNames = null) + { + StringBuilder result = new(); + if (ignoreParameterNames is null) + ignoreParameterNames = new List(); + if (useDateTimeFromSequence && !string.IsNullOrEmpty(format)) + throw new Exception(); + else if (!useDateTimeFromSequence && string.IsNullOrEmpty(format)) + throw new Exception(); + string nullData; + const string columnDate = "Date"; + const string columnTime = "Time"; + const string firstDuplicate = "_1"; + _ = result.AppendLine(scopeInfo.Header); + StringBuilder line = new(); + if (logistics.NullData is null) + nullData = string.Empty; + else + nullData = logistics.NullData.ToString(); + int count = (from l in keyValuePairs select l.Value.Count).Min(); + for (int r = 0; r < count; r++) + { + _ = line.Clear(); + _ = line.Append('!'); + foreach (KeyValuePair> keyValuePair in keyValuePairs) + { + if (!names.Contains(keyValuePair.Key)) + continue; + if (ignoreParameterNames.Contains(keyValuePair.Key)) + continue; + if (pairedParameterNames.Contains(keyValuePair.Key)) + { + if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) + continue; + else + _ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]); + } + else + { + if (useDateTimeFromSequence && keyValuePair.Key == columnDate) + _ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat)); + else if (useDateTimeFromSequence && keyValuePair.Key == columnTime) + _ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat)); + else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length) + _ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat)); + else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length) + _ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat)); + else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData) + _ = line.Append(nullData); + else + _ = line.Append(keyValuePair.Value[r]); + _ = line.Append(';'); + } + } + if (!pairedParameterNames.Any()) + { + _ = line.Remove(line.Length - 1, 1); + _ = result.AppendLine(line.ToString()); + } + } + return result.ToString(); + } + + public static List PDSFToFixedWidth(string reportFullPath) + { + List results = new(); + if (!File.Exists(reportFullPath)) + throw new Exception(); + int[] group; + string line; + int startsAt = 0; + string[] segments; + int? currentGroup = null; + char inputSeperator = '\t'; + char outputSeperator = '\t'; + List vs = new(); + List groups = new(); + string[] lines = File.ReadAllLines(reportFullPath); + StringBuilder stringBuilder = new(); + for (int i = 0; i < lines.Length; i++) + { + if (string.IsNullOrEmpty(lines[i])) + continue; + segments = lines[i].Split(inputSeperator); + if (currentGroup is null) + currentGroup = segments.Length; + if (segments.Length != currentGroup) + { + currentGroup = segments.Length; + groups.Add(new int[] { startsAt, i - 1 }); + startsAt = i; + } + } + if (startsAt == lines.Length - 1 && lines[0].Split(inputSeperator).Length != currentGroup) + groups.Add(new int[] { lines.Length - 1, lines.Length - 1 }); + for (int g = 0; g < groups.Count; g++) + { + vs.Clear(); + group = groups[g]; + line = lines[group[0]]; + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + vs.Add(segments[s].Length); + for (int i = group[0]; i <= group[1]; i++) + { + line = lines[i]; + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + { + if (vs[s] < segments[s].Length) + vs[s] = segments[s].Length; + } + } + _ = stringBuilder.Clear(); + for (int s = 0; s < segments.Length; s++) + _ = stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator); + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + results.Add(stringBuilder.ToString()); + for (int i = group[0]; i <= group[1]; i++) + { + line = lines[i]; + _ = stringBuilder.Clear(); + segments = line.Split(inputSeperator); + for (int s = 0; s < segments.Length; s++) + _ = stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator); + _ = stringBuilder.Remove(stringBuilder.Length - 1, 1); + results.Add(stringBuilder.ToString()); + } + results.Add(string.Empty); + } + return results; + } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IDescription.cs b/Adaptation/Shared/Properties/IDescription.cs new file mode 100644 index 0000000..93e6de5 --- /dev/null +++ b/Adaptation/Shared/Properties/IDescription.cs @@ -0,0 +1,10 @@ +namespace Adaptation.Shared.Properties; + +public interface IDescription +{ + + int Test { get; } + int Count { get; } + int Index { get; } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IFileRead.cs b/Adaptation/Shared/Properties/IFileRead.cs new file mode 100644 index 0000000..2e85ac9 --- /dev/null +++ b/Adaptation/Shared/Properties/IFileRead.cs @@ -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; } +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/ILogistics.cs b/Adaptation/Shared/Properties/ILogistics.cs new file mode 100644 index 0000000..dc1a106 --- /dev/null +++ b/Adaptation/Shared/Properties/ILogistics.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +namespace Adaptation.Shared.Properties; + +public interface ILogistics +{ + + public object NullData { get; } + public string JobID { get; } //CellName + public long Sequence { get; } //Ticks + public DateTime DateTimeFromSequence { get; } + public double TotalSecondsSinceLastWriteTimeFromSequence { get; } + public string MesEntity { get; } //SPC + public string ReportFullPath { get; } //Extract file + public string ProcessJobID { get; set; } //Reactor (duplicate but I want it in the logistics) + public string MID { get; set; } //Lot & Pocket || Lot + public List Tags { get; set; } + public List Logistics1 { get; set; } + public List Logistics2 { get; set; } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/ILogistics2.cs b/Adaptation/Shared/Properties/ILogistics2.cs new file mode 100644 index 0000000..ae8a15a --- /dev/null +++ b/Adaptation/Shared/Properties/ILogistics2.cs @@ -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; } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IProcessData.cs b/Adaptation/Shared/Properties/IProcessData.cs new file mode 100644 index 0000000..e378288 --- /dev/null +++ b/Adaptation/Shared/Properties/IProcessData.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Adaptation.Shared.Properties; + +public interface IProcessData +{ + + List Details { get; } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Properties/IScopeInfo.cs b/Adaptation/Shared/Properties/IScopeInfo.cs new file mode 100644 index 0000000..10d7385 --- /dev/null +++ b/Adaptation/Shared/Properties/IScopeInfo.cs @@ -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; } + +} \ No newline at end of file diff --git a/Adaptation/Shared/Test.cs b/Adaptation/Shared/Test.cs new file mode 100644 index 0000000..aeb4bea --- /dev/null +++ b/Adaptation/Shared/Test.cs @@ -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, +} \ No newline at end of file diff --git a/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs new file mode 100644 index 0000000..6263ae4 --- /dev/null +++ b/Adaptation/_Tests/CreateSelfDescription/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs @@ -0,0 +1,154 @@ +using Adaptation._Tests.Shared; +using Adaptation.Shared.Methods; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Text.Json; +using System.Threading; + +namespace Adaptation._Tests.CreateSelfDescription.Staging.v2_43_0; + +[TestClass] +public class MET08ANLYSDIFAAST230 : EAFLoggingUnitTesting +{ + +#pragma warning disable CA2254 +#pragma warning disable IDE0060 + + internal static MET08ANLYSDIFAAST230 EAFLoggingUnitTesting { get; private set; } + + public MET08ANLYSDIFAAST230() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) + { + if (EAFLoggingUnitTesting is null) + throw new Exception(); + } + + public MET08ANLYSDIFAAST230(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false) + { + } + + [ClassInitialize] + public static void ClassInitialize(TestContext testContext) + { + if (EAFLoggingUnitTesting is null) + EAFLoggingUnitTesting = new MET08ANLYSDIFAAST230(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__MET08ANLYSDIFAAST230__MoveMatchingFiles() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy() + { + string check = "637400762024374000.zip"; + MethodBase methodBase = new StackFrame().GetMethod(); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration")); + _ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting); + EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit")); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Extract/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs b/Adaptation/_Tests/Extract/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs new file mode 100644 index 0000000..3c6adb3 --- /dev/null +++ b/Adaptation/_Tests/Extract/Staging/v2.43.0/MET08ANLYSDIFAAST230.cs @@ -0,0 +1,74 @@ +using Adaptation._Tests.Shared; +using Adaptation.Shared; +using Adaptation.Shared.Methods; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Text.Json; +using System.Threading; + +namespace Adaptation._Tests.Extract.Staging.v2_43_0; + +[TestClass] +public class MET08ANLYSDIFAAST230 +{ + +#pragma warning disable CA2254 +#pragma warning disable IDE0060 + + private static CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230 _MET08ANLYSDIFAAST230; + + [ClassInitialize] + public static void ClassInitialize(TestContext testContext) + { + CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230.ClassInitialize(testContext); + _MET08ANLYSDIFAAST230 = CreateSelfDescription.Staging.v2_43_0.MET08ANLYSDIFAAST230.EAFLoggingUnitTesting; + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles637710931421087642__Normal() + { + string check = "*.pdsf"; + MethodBase methodBase = new StackFrame().GetMethod(); + _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles(); + string[] variables = _MET08ANLYSDIFAAST230.AdaptationTesting.GetVariables(methodBase, check); + IFileRead fileRead = _MET08ANLYSDIFAAST230.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false); + Logistics logistics = new(fileRead); + _ = Helpers.Metrology.ReExtractComapareUpdatePassDirectory(variables, fileRead, logistics); + } + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewer(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__IQSSi(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsight(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__OpenInsightMetrologyViewerAttachments(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__APC() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__APC(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__SPaCe(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Processed(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Archive(); + + [TestMethod] + public void Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy() => _MET08ANLYSDIFAAST230.Staging__v2_43_0__MET08ANLYSDIFAAST230__Dummy(); + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Helpers/Metrology.cs b/Adaptation/_Tests/Helpers/Metrology.cs new file mode 100644 index 0000000..30ed92e --- /dev/null +++ b/Adaptation/_Tests/Helpers/Metrology.cs @@ -0,0 +1,192 @@ +using Adaptation.Shared; +using Adaptation.Shared.Methods; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text.Json; + +namespace Adaptation._Tests.Helpers; + +public class Metrology +{ + + internal static Tuple GetLogisticsColumnsAndBody(string fileFullName) + { + Tuple results; + results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(fileFullName); + Assert.IsFalse(string.IsNullOrEmpty(results.Item1)); + Assert.IsTrue(results.Item2.Length > 0, "Column check"); + Assert.IsTrue(results.Item3.Length > 0, "Body check"); + return results; + } + + internal static Tuple GetLogisticsColumnsAndBody(string searchDirectory, string searchPattern) + { + Tuple results; + if (searchPattern.Length > 3 && !searchPattern.Contains('*') && File.Exists(searchPattern)) + results = GetLogisticsColumnsAndBody(searchPattern); + else + { + string[] pdsfFiles; + pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly); + if (!pdsfFiles.Any()) + _ = Process.Start("explorer.exe", searchDirectory); + Assert.IsTrue(pdsfFiles.Any(), "GetFiles check"); + results = GetLogisticsColumnsAndBody(pdsfFiles[0]); + } + Assert.IsFalse(string.IsNullOrEmpty(results.Item1)); + Assert.IsTrue(results.Item2.Length > 0, "Column check"); + Assert.IsTrue(results.Item3.Length > 0, "Body check"); + return results; + } + + internal static Tuple GetLogisticsColumnsAndBody(IFileRead fileRead, Logistics logistics, Tuple> extractResult, Tuple pdsf) + { + Tuple results; + string text = ProcessDataStandardFormat.GetPDSFText(fileRead, logistics, extractResult.Item3, logisticsText: pdsf.Item1); + string[] lines = text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + results = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(logistics.ReportFullPath, lines); + Assert.IsFalse(string.IsNullOrEmpty(results.Item1)); + Assert.IsTrue(results.Item2.Length > 0, "Column check"); + Assert.IsTrue(results.Item3.Length > 0, "Body check"); + return results; + } + + internal static string[] GetItem2(Tuple pdsf, Tuple pdsfNew) + { + JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true }; + string jsonOld = JsonSerializer.Serialize(pdsf.Item2, pdsf.Item2.GetType(), jsonSerializerOptions); + string jsonNew = JsonSerializer.Serialize(pdsfNew.Item2, pdsfNew.Item2.GetType(), jsonSerializerOptions); + return new string[] { jsonOld, jsonNew }; + } + + internal static string[] GetItem3(Tuple pdsf, Tuple pdsfNew) + { + string joinOld = string.Join(Environment.NewLine, from l in pdsf.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t)); + string joinNew = string.Join(Environment.NewLine, from l in pdsfNew.Item3 select string.Join('\t', from t in l.Split('\t') where !t.Contains(@"\\") select t)); + return new string[] { joinOld, joinNew }; + } + + internal static void UpdatePassDirectory(string searchDirectory) + { + DateTime dateTime = DateTime.Now; + try + { Directory.SetLastWriteTime(searchDirectory, dateTime); } + catch (Exception) { } + string ticksDirectory = Path.GetDirectoryName(searchDirectory); + try + { Directory.SetLastWriteTime(ticksDirectory, dateTime); } + catch (Exception) { } + string[] directories = Directory.GetDirectories(searchDirectory, "*", SearchOption.TopDirectoryOnly); + foreach (string directory in directories) + { + try + { Directory.SetLastWriteTime(directory, dateTime); } + catch (Exception) { } + } + } + + internal static string GetFileName(MethodBase methodBase) + { + string result; + string connectionName; + string seperator = "__"; + string connectionNameAndTicks; + string[] segments = methodBase.Name.Split(new string[] { seperator }, StringSplitOptions.None); + string environment = segments[0]; + string rawVersionName = segments[1]; + string equipmentTypeDirectory = segments[2]; + string ticks = DateTime.Now.Ticks.ToString(); + string comment = segments[segments.Length - 1]; + string versionName = segments[1].Replace('_', '.'); + string before = string.Concat(environment, seperator, rawVersionName, seperator, equipmentTypeDirectory, seperator); + string after = methodBase.Name.Substring(before.Length); + if (after.Length < ticks.Length) + { + connectionName = after; + } + else + { + connectionNameAndTicks = after.Substring(0, after.Length - 2 - comment.Length); + connectionName = connectionNameAndTicks.Substring(0, connectionNameAndTicks.Length - ticks.Length); + ticks = connectionNameAndTicks.Substring(connectionName.Length); + } + result = Path.Combine(environment, equipmentTypeDirectory, versionName, $"{environment}__{rawVersionName}__{equipmentTypeDirectory}__{connectionName}", ticks, $"{connectionName.Replace('_', '-')}.json"); + if (result.Contains('/')) + result = string.Concat('/', result); + else + result = string.Concat('\\', result); + return result; + } + + internal static void CompareSaveTSV(string textFileDirectory, string[] join) + { + if (join[0] != join[1]) + { + _ = Process.Start("explorer.exe", textFileDirectory); + File.WriteAllText(Path.Combine(textFileDirectory, "0.tsv"), join[0]); + File.WriteAllText(Path.Combine(textFileDirectory, "1.tsv"), join[1]); + } + } + + internal static void CompareSaveJSON(string textFileDirectory, string[] json) + { + if (json[0] != json[1]) + { + _ = Process.Start("explorer.exe", textFileDirectory); + File.WriteAllText(Path.Combine(textFileDirectory, "0.json"), json[0]); + File.WriteAllText(Path.Combine(textFileDirectory, "1.json"), json[1]); + } + } + + internal static void CompareSave(string textFileDirectory, Tuple pdsf, Tuple pdsfNew) + { + if (pdsf.Item1 != pdsfNew.Item1) + { + _ = Process.Start("explorer.exe", textFileDirectory); + File.WriteAllText(Path.Combine(textFileDirectory, "0.dat"), pdsf.Item1); + File.WriteAllText(Path.Combine(textFileDirectory, "1.dat"), pdsfNew.Item1); + } + } + + internal static IFileRead GetWriteConfigurationGetFileRead(MethodBase methodBase, string check, Shared.AdaptationTesting adaptationTesting) + { + IFileRead result; + string[] fileNameAndJson = adaptationTesting.GetConfiguration(methodBase); + Assert.IsTrue(fileNameAndJson[1].Contains(check)); + File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]); + result = adaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false); + Assert.IsFalse(string.IsNullOrEmpty(result.CellInstanceConnectionName)); + return result; + } + + internal static string ReExtractComapareUpdatePassDirectory(string[] variables, IFileRead fileRead, Logistics logistics, bool validatePDSF = true) + { + string result; + Tuple> extractResult = fileRead.ReExtract(); + Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1)); + Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!"); + Assert.IsNotNull(extractResult.Item4); + Tuple pdsf = GetLogisticsColumnsAndBody(variables[2], variables[4]); + Tuple pdsfNew = GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf); + if (validatePDSF) + { + CompareSave(variables[5], pdsf, pdsfNew); + Assert.IsTrue(pdsf.Item1 == pdsfNew.Item1, "Item1 check!"); + string[] json = GetItem2(pdsf, pdsfNew); + CompareSaveJSON(variables[5], json); + Assert.IsTrue(json[0] == json[1], "Item2 check!"); + string[] join = GetItem3(pdsf, pdsfNew); + CompareSaveTSV(variables[5], join); + Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!"); + } + UpdatePassDirectory(variables[2]); + result = extractResult.Item1; + return result; + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/AdaptationTesting.cs b/Adaptation/_Tests/Shared/AdaptationTesting.cs new file mode 100644 index 0000000..1af6d2c --- /dev/null +++ b/Adaptation/_Tests/Shared/AdaptationTesting.cs @@ -0,0 +1,1047 @@ +using Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.CellInstance; +using Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.ConfigurationData; +using Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.EquipmentDictionary; +using Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.EquipmentType; +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.Ifx.Eaf.Common.Configuration; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared.Methods; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Serialization; + +namespace Adaptation._Tests.Shared; + +public class AdaptationTesting : ISMTP +{ + + protected readonly string _Environment; + protected readonly string _HostNameAndPort; + protected readonly TestContext _TestContext; + protected readonly bool _SkipEquipmentDictionary; + protected readonly Dictionary _CellInstanceVersions; + protected readonly Dictionary _EquipmentTypeVersions; + protected readonly Dictionary _ParameterizedModelObjectDefinitionTypes; + protected readonly Dictionary _EquipmentDictionaryVersions; + protected readonly Dictionary _FileConnectorConfigurations; + protected readonly Dictionary> _ModelObjectParameters; + protected readonly Dictionary>> _EquipmentDictionaryEventDescriptions; + + public string Environment => _Environment; + public TestContext TestContext => _TestContext; + public string HostNameAndPort => _HostNameAndPort; + public bool SkipEquipmentDictionary => _SkipEquipmentDictionary; + public Dictionary CellInstanceVersions => _CellInstanceVersions; + public Dictionary EquipmentTypeVersions => _EquipmentTypeVersions; + public Dictionary> ModelObjectParameters => _ModelObjectParameters; + public Dictionary EquipmentDictionaryVersions => _EquipmentDictionaryVersions; + public Dictionary FileConnectorConfigurations => _FileConnectorConfigurations; + public Dictionary ParameterizedModelObjectDefinitionTypes => _ParameterizedModelObjectDefinitionTypes; + public Dictionary>> EquipmentDictionaryEventDescriptions => _EquipmentDictionaryEventDescriptions; + + void ISMTP.SendLowPriorityEmailMessage(string subject, string body) => throw new NotImplementedException(); + + void ISMTP.SendHighPriorityEmailMessage(string subject, string body) => throw new NotImplementedException(); + + void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) => throw new NotImplementedException(); + + public AdaptationTesting(TestContext testContext, bool skipEquipmentDictionary) + { + + string environment = GetEnvironment(testContext); + string hostNameAndPort = GetHostNameAndPort(environment); + _TestContext = testContext; + _Environment = environment; + _HostNameAndPort = hostNameAndPort; + _SkipEquipmentDictionary = skipEquipmentDictionary; + _CellInstanceVersions = new Dictionary(); + _EquipmentTypeVersions = new Dictionary(); + _ParameterizedModelObjectDefinitionTypes = new Dictionary(); + _EquipmentDictionaryVersions = new Dictionary(); + _FileConnectorConfigurations = new Dictionary(); + _ModelObjectParameters = new Dictionary>(); + _EquipmentDictionaryEventDescriptions = new Dictionary>>(); + } + + protected static string GetEnvironment(TestContext testContext) + { + string result = testContext.TestName.Split('_')[0]; + return result; + } + + protected static string GetHostNameAndPort(string environment) + { + string result; + result = environment switch + { + "LocalHost" => "localhost:9003", + "Development" => "eaf-dev.mes.infineon.com:9003", + "Staging" => "eaf-staging.mes.infineon.com:9003", + "Production" => "eaf-prod.mes.infineon.com:9003", + _ => throw new Exception(), + }; + return result; + } + + protected string GetTestResultsDirectory() + { + string result = string.Empty; + string testResults = "05_TestResults"; + string checkDirectory = _TestContext.TestResultsDirectory; + if (string.IsNullOrEmpty(checkDirectory) || !checkDirectory.Contains(testResults)) + throw new Exception(); + string rootDirectory = Path.GetPathRoot(checkDirectory); + for (int i = 0; i < int.MaxValue; i++) + { + checkDirectory = Path.GetDirectoryName(checkDirectory); + if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == rootDirectory) + break; + if (checkDirectory.EndsWith(testResults) && Directory.Exists(checkDirectory)) + { + result = checkDirectory; + break; + } + } + if (string.IsNullOrEmpty(result)) + throw new Exception(); + return result; + } + + protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName) + { + string result; + if (string.IsNullOrEmpty(cellInstanceConnectionName) || cellInstanceConnectionName[cellInstanceConnectionName.Length - 1] != '_') + result = cellInstanceConnectionName; + else + { + bool check = false; + List chars = new(); + StringBuilder stringBuilder = new(); + for (int i = cellInstanceConnectionName.Length - 1; i > -1; i--) + { + if (!check && cellInstanceConnectionName[i] != '_') + check = true; + else if (!check && cellInstanceConnectionName[i] == '_') + chars.Add('-'); + if (check) + chars.Add(cellInstanceConnectionName[i]); + } + for (int i = chars.Count - 1; i > -1; i--) + _ = stringBuilder.Append(chars[i]); + result = stringBuilder.ToString(); + } + return result; + } + + private static string GetMethodBaseNameWithActualCICN(string methodBaseName, string cellInstanceName, string cellInstanceConnectionNameFromMethodBaseName, string cellInstanceConnectionName, string ticks) + { + string results; + if (string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || string.IsNullOrEmpty(cellInstanceConnectionName)) + results = methodBaseName; + else if (cellInstanceConnectionNameFromMethodBaseName.Length != cellInstanceConnectionName.Length) + throw new Exception(); + else + { + string[] segments = methodBaseName.Split(new string[] { cellInstanceName }, StringSplitOptions.None); + if (segments.Length == 2) + results = methodBaseName.Replace(cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName); + else if (segments.Length != 3) + throw new Exception(); + else if (string.IsNullOrEmpty(ticks)) + results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName); + else if (!segments[2].Contains(ticks)) + throw new Exception(); + else + results = string.Concat(segments[0], cellInstanceName, segments[1], cellInstanceConnectionName, ticks, segments[2].Split(new string[] { ticks }, StringSplitOptions.None)[1]); + } + if (methodBaseName.Length != results.Length) + throw new Exception(); + return results; + } + + internal string[] GetSegments(string methodBaseName) + { + List results; + string fileFullName; + string comment; + string[] textFiles; + string seperator = "__"; + string connectionNameAndTicks; + string cellInstanceConnectionName; + string ticks = DateTime.Now.Ticks.ToString(); + string cellInstanceConnectionNameFromMethodBaseName; + string testResultsDirectory = GetTestResultsDirectory(); + string[] segments = methodBaseName.Split(new string[] { seperator }, StringSplitOptions.None); + if (segments[0] != _Environment) + throw new Exception(); + string rawVersionName = segments[1]; + string rawCellInstanceName = segments[2]; + string cellInstanceVersionName = segments[1].Replace('_', '.'); + string cellInstanceName = segments[2].Replace('_', '-').Replace("_EQPT", "-EQPT"); + string before = string.Concat(_Environment, seperator, rawVersionName, seperator, cellInstanceName, seperator); + string after = methodBaseName.Substring(before.Length); + string versionDirectory = Path.Combine(testResultsDirectory, _Environment, cellInstanceName, cellInstanceVersionName); + if (!Directory.Exists(versionDirectory)) + _ = Directory.CreateDirectory(versionDirectory); + comment = segments[segments.Length - 1]; + if (after.Length < ticks.Length || after == comment) + { + ticks = string.Empty; + cellInstanceConnectionNameFromMethodBaseName = string.Empty; + } + else + { + connectionNameAndTicks = after.Substring(0, after.Length - 2 - comment.Length); + if (connectionNameAndTicks.Length - ticks.Length < 1) + { + ticks = string.Empty; + cellInstanceConnectionNameFromMethodBaseName = string.Empty; + } + else + { + cellInstanceConnectionNameFromMethodBaseName = connectionNameAndTicks.Substring(0, connectionNameAndTicks.Length - ticks.Length); + ticks = connectionNameAndTicks.Substring(cellInstanceConnectionNameFromMethodBaseName.Length); + } + } + if (string.IsNullOrEmpty(ticks) || string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || !long.TryParse(ticks, out _)) + { + ticks = string.Empty; + comment = string.Empty; + cellInstanceConnectionNameFromMethodBaseName = after; + } + cellInstanceConnectionName = GetCellInstanceConnectionName(cellInstanceConnectionNameFromMethodBaseName); + string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks); + if (string.IsNullOrEmpty(ticks)) + { + textFiles = Array.Empty(); + fileFullName = Path.Combine(versionDirectory, methodBaseNameWithActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json"); + } + else + { + segments = methodBaseNameWithActualCICN.Split(new string[] { ticks }, StringSplitOptions.None); + string textDirectory = Path.Combine(versionDirectory, segments[0], string.Concat(ticks, segments[1])); + fileFullName = Path.Combine(versionDirectory, segments[0], $"{cellInstanceConnectionNameFromMethodBaseName}.json"); + if (!Directory.Exists(textDirectory)) + { + textFiles = Array.Empty(); + string renameDirectory = Path.Combine(Path.GetDirectoryName(textDirectory), $"_Rename - {Path.GetFileName(textDirectory)}"); + _ = Directory.CreateDirectory(renameDirectory); + _ = Process.Start("explorer.exe", renameDirectory); + File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileFilter)}.txt"), string.Empty); + File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileLocation)}.txt"), string.Empty); + } + else + { + textFiles = Directory.GetFiles(textDirectory, "*.txt", SearchOption.TopDirectoryOnly); + if (!textFiles.Any()) + { + _ = Process.Start("explorer.exe", textDirectory); + File.WriteAllText(Path.Combine(textDirectory, "_ Why.why"), string.Empty); + } + } + } + results = new List + { + _Environment, + rawCellInstanceName, + cellInstanceName, + cellInstanceVersionName, + cellInstanceConnectionNameFromMethodBaseName, + cellInstanceConnectionName, + ticks, + comment, + fileFullName + }; + results.AddRange(textFiles); + return results.ToArray(); + } + + internal string[] GetSegments(MethodBase methodBase) + { + string[] results = GetSegments(methodBase.Name); + return results; + } + + internal static string GetEnvironment(string[] segments) => segments[0]; + + internal static string GetRawCellInstanceName(string[] segments) => segments[1]; + + internal static string GetCellInstanceName(string[] segments) => segments[2]; + + internal static string GetCellInstanceVersionName(string[] segments) => segments[3]; + + internal static string GetCellInstanceConnectionNameFromMethodBaseName(string[] segments) => segments[4]; + + internal static string GetCellInstanceConnectionName(string[] segments) => segments[5]; + + internal static string GetTicks(string[] segments) => segments[6]; + + internal static string GetComment(string[] segments) => segments[7]; + + internal static FileInfo GetFileName(string[] segments) => new(segments[8]); + + internal static string[] GetTextFiles(string[] segments) + { + List results = new(); + if (segments.Length > 8) + { + for (int i = 9; i < segments.Length; i++) + results.Add(segments[i]); + } + return results.ToArray(); + } + + protected static Stream ToStream(string @this) + { + MemoryStream memoryStream = new(); + StreamWriter streamWriter = new(memoryStream); + streamWriter.Write(@this); + streamWriter.Flush(); + memoryStream.Position = 0; + return memoryStream; + } + + internal static T ParseXML(string @this, bool throwExceptions) where T : class + { + object result = null; + try + { + Stream stream = ToStream(@this.Trim()); + XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document }); + XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes()); + result = xmlSerializer.Deserialize(xmlReader); + stream.Dispose(); + } + catch (Exception) + { + if (throwExceptions) + throw; + } + return result as T; + } + + protected static CellInstanceVersion GetCellInstanceVersion(string url) + { + CellInstanceVersion result; + byte[] byteArray; + ConfigurationData configurationData; + string decodedCellInstanceConfigurationData; + string xml; + try + { + xml = XDocument.Load(url).ToString(); + } + catch (Exception exception) + { + throw new Exception(string.Concat(url, System.Environment.NewLine, exception.Message)); + } + configurationData = ParseXML(xml, throwExceptions: true); + byteArray = Convert.FromBase64String(configurationData.Data); + decodedCellInstanceConfigurationData = Encoding.Unicode.GetString(byteArray); + if (xml.Length <= 41) + throw new Exception(string.Concat("xml isn't valid {", xml, "}")); + decodedCellInstanceConfigurationData = decodedCellInstanceConfigurationData.Substring(41).Replace("i:type", "i___type"); + result = ParseXML(decodedCellInstanceConfigurationData, throwExceptions: true); + return result; + } + + protected Tuple GetCellInstanceVersionTuple(string cellInstanceName, string cellInstanceVersionName) + { + Tuple result; + CellInstanceVersion cellInstanceVersion; + string cellInstanceServiceV2 = string.Concat("http://", _HostNameAndPort, "/CellInstanceServiceV2/", cellInstanceName, "/", cellInstanceVersionName, "/configuration"); + if (_CellInstanceVersions.ContainsKey(cellInstanceServiceV2)) + cellInstanceVersion = _CellInstanceVersions[cellInstanceServiceV2]; + else + { + cellInstanceVersion = GetCellInstanceVersion(cellInstanceServiceV2); + _CellInstanceVersions.Add(cellInstanceServiceV2, cellInstanceVersion); + } + result = new Tuple(cellInstanceServiceV2, cellInstanceVersion); + return result; + } + + protected static Dictionary GetComponentModelComponentsIndexes(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName) + { + Dictionary results = new(); + ComponentsCellComponent componentsCellComponent; + if (cellInstanceVersion.ComponentModel.Components is not null) + { + for (int i = 0; i < cellInstanceVersion.ComponentModel.Components.Length; i++) + { + componentsCellComponent = cellInstanceVersion.ComponentModel.Components[i]; + for (int j = 0; j < componentsCellComponent.Children.Length; j++) + { + if (string.IsNullOrEmpty(componentsCellComponent.Children[j].Equipment.Name)) + continue; + results.Add(componentsCellComponent.Children[j].Name, new int[] { i, j }); + } + } + } + if (!results.Any() || (!string.IsNullOrEmpty(cellInstanceConnectionName) && !results.ContainsKey(cellInstanceConnectionName))) + throw new Exception("Match not found (check test method name matches Mango)!"); + return results; + } + + protected static int[] GetCellInstanceConnectionNameIndexes(string cellInstanceConnectionName, Dictionary componentModelComponentsIndexes) + { + int[] result; + if (string.IsNullOrEmpty(cellInstanceConnectionName)) + result = componentModelComponentsIndexes.ElementAt(0).Value; + else + { + if (componentModelComponentsIndexes is null || !componentModelComponentsIndexes.ContainsKey(cellInstanceConnectionName)) + throw new Exception(); + result = componentModelComponentsIndexes[cellInstanceConnectionName]; + } + return result; + } + + protected string[] GetCSharpTextB(FileInfo fileInfo, string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion) + { + List results = new(); + string check; + string loopName; + string equipmentTypeName; + string methodName = string.Empty; + string extractText = string.Empty; + StringBuilder stringBuilder = new(); + string createSelfDescriptionText = string.Empty; + List componentsCellComponentCellComponentEquipmentNames = new(); + string cellInstanceNameWithoutHyphen = cellInstanceName.Replace('-', '_'); + ComponentsCellComponentCellComponent componentsCellComponentCellComponent; + List componentsCellComponentCellComponentEquipmentTypeNames = new(); + string cellInstanceVersionNameAsCode = cellInstanceVersionName.Replace('.', '_'); + List componentsCellComponentCellComponentEquipmentDictionaryNames = new(); + const string sourceDirectoryCloaking = nameof(FileConnectorConfiguration.SourceDirectoryCloaking); + for (int i = 1; i < 3; i++) + { + if (i == 2) + loopName = "Extract"; + else if (i == 1) + loopName = "CreateSelfDescription"; + else + throw new Exception(); + _ = stringBuilder. + AppendLine("using Adaptation.Shared.Methods;"). + AppendLine("using Microsoft.Extensions.Logging;"). + AppendLine("using Microsoft.VisualStudio.TestTools.UnitTesting;"). + AppendLine("using Adaptation._Tests.Shared;"). + AppendLine("using System;"). + AppendLine("using System.Collections.Generic;"). + AppendLine("using System.Diagnostics;"). + AppendLine("using System.IO;"). + AppendLine("using System.Reflection;"). + AppendLine("using System.Text.Json;"). + AppendLine("using System.Threading;"); + _ = stringBuilder.AppendLine(). + Append("namespace Adaptation._Tests.").Append(loopName).Append('.').Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).AppendLine(";"). + AppendLine(). + AppendLine("[TestClass]"); + if (i == 2) + _ = stringBuilder. + Append("public class ").AppendLine(cellInstanceNameWithoutHyphen). + AppendLine("{"). + AppendLine(). + AppendLine("#pragma warning disable CA2254"). + AppendLine("#pragma warning disable IDE0060"). + AppendLine(). + Append("private static CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).Append(" _").Append(cellInstanceNameWithoutHyphen).AppendLine(";"); + else if (i == 1) + _ = stringBuilder. + Append("public class ").Append(cellInstanceNameWithoutHyphen).AppendLine(" : EAFLoggingUnitTesting"). + AppendLine("{"). + AppendLine(). + AppendLine("#pragma warning disable CA2254"). + AppendLine("#pragma warning disable IDE0060"). + AppendLine(). + Append("internal static ").Append(cellInstanceNameWithoutHyphen).AppendLine(" EAFLoggingUnitTesting { get; private set; }"); + else + throw new Exception(); + if (i == 2) + _ = stringBuilder.AppendLine(); + else if (i == 1) + _ = stringBuilder. + AppendLine(). + Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)"). + AppendLine("{"). + AppendLine("if (EAFLoggingUnitTesting is null)"). + AppendLine("throw new Exception();"). + AppendLine("}"). + AppendLine(). + Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)"). + AppendLine("{"). + AppendLine("}"). + AppendLine(); + else + throw new Exception(); + _ = stringBuilder. + AppendLine("[ClassInitialize]"). + AppendLine("public static void ClassInitialize(TestContext testContext)"). + AppendLine("{"); + if (i == 2) + _ = stringBuilder. + Append("CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).AppendLine(".ClassInitialize(testContext);"). + Append('_').Append(cellInstanceNameWithoutHyphen).Append(" = CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).AppendLine(".EAFLoggingUnitTesting;"). + AppendLine("}"); + else if (i == 1) + _ = stringBuilder. + AppendLine("if (EAFLoggingUnitTesting is null)"). + Append("EAFLoggingUnitTesting = new ").Append(cellInstanceNameWithoutHyphen).AppendLine("(testContext);"). + AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, \" - ClassInitialize\"));"). + AppendLine("string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);"). + AppendLine("File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);"). + AppendLine("File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);"). + AppendLine("}"); + else + throw new Exception(); + if (i == 2) + _ = stringBuilder.AppendLine(); + else if (i == 1) + _ = stringBuilder. + AppendLine(). + AppendLine("[ClassCleanup()]"). + AppendLine("public static void ClassCleanup()"). + AppendLine("{"). + AppendLine("if (EAFLoggingUnitTesting.Logger is not null)"). + AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(\"Cleanup\");"). + AppendLine("if (EAFLoggingUnitTesting is not null)"). + AppendLine("EAFLoggingUnitTesting.Dispose();"). + AppendLine("}"). + AppendLine(); + else + throw new Exception(); + foreach (ComponentsCellComponent componentsCellComponent in cellInstanceVersion.ComponentModel.Components) + { + if (componentsCellComponent.Children.Length != 1) + continue; + componentsCellComponentCellComponent = componentsCellComponent.Children[0]; + if (componentsCellComponentCellComponent.Equipment.EquipmentDictionaries?.CellEquipmentDictionaryReference?.DictionaryName is not null) + componentsCellComponentCellComponentEquipmentDictionaryNames.Add(componentsCellComponentCellComponent.Equipment.EquipmentDictionaries?.CellEquipmentDictionaryReference?.DictionaryName); + componentsCellComponentCellComponentEquipmentNames.Add(componentsCellComponentCellComponent.Equipment.Name); + componentsCellComponentCellComponentEquipmentTypeNames.Add(componentsCellComponentCellComponent.Equipment.EquipmentType.Name); + methodName = $"{_Environment}__{cellInstanceVersionNameAsCode}__{cellInstanceNameWithoutHyphen}__{componentsCellComponentCellComponent.Equipment.Name.Replace('-', '_')}"; + if (componentsCellComponentCellComponent?.Equipment?.ConnectionSettings?.Setting is null) + check = string.Empty; + else + check = (from l in componentsCellComponentCellComponent.Equipment.ConnectionSettings.Setting where l.Name == sourceDirectoryCloaking select l.Value).FirstOrDefault(); + if (string.IsNullOrEmpty(check)) + check = componentsCellComponentCellComponent.Equipment.SourceFileFilter; + if (i == 2) + { + _ = stringBuilder. + AppendLine("[TestMethod]"). + Append("public void ").Append(methodName).Append("() => ").Append('_').Append(cellInstanceNameWithoutHyphen).Append('.').Append(methodName).AppendLine("();").AppendLine(); + } + else if (i == 1) + { + if (componentsCellComponentCellComponent.Equipment.EquipmentType.Version != cellInstanceVersionName) + throw new Exception("Versions should match!"); + equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name; + _ = stringBuilder. + AppendLine("[TestMethod]"). + Append("public void ").Append(methodName).AppendLine("()"). + AppendLine("{"). + Append("string check = \"").Append(check.Split('\\').Last()).AppendLine("\";"). + AppendLine("MethodBase methodBase = new StackFrame().GetMethod();"). + AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Getting configuration\"));"). + AppendLine("_ = Helpers.Metrology.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);"). + AppendLine("EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Exit\"));"). + AppendLine("}"). + AppendLine(); + } + else + throw new Exception(); + } + _ = stringBuilder. + AppendLine("}"). + AppendLine(); + if (i == 2) + extractText = stringBuilder.ToString().Trim(); + else if (i == 1) + createSelfDescriptionText = stringBuilder.ToString().Trim(); + else + throw new Exception(); + _ = stringBuilder.Clear(); + } + if (componentsCellComponentCellComponentEquipmentDictionaryNames.Any() && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy)) + { + if (!cellInstanceVersion.CellCommunicatingRule.EndsWith(".Communicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any()) + throw new Exception($"{methodName} - CellCommunicatingRule not correct in Mango!"); + if (!cellInstanceVersion.CellNotCommunicatingRule.EndsWith(".NotCommunicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellNotCommunicatingRule.Split('.')[0] select true).Any()) + throw new Exception($"{methodName} - CellNotCommunicatingRule not correct in Mango!"); + } + string versionLevelDirectory = Path.GetDirectoryName(fileInfo.DirectoryName); + results.Add(Path.Combine(versionLevelDirectory, $"{cellInstanceName}-0-CreateSelfDescription.txt")); + results.Add(createSelfDescriptionText); + results.Add(Path.Combine(versionLevelDirectory, $"{cellInstanceName}-1-Extract.txt")); + results.Add(extractText); + return results.ToArray(); + } + + protected static FileConnectorConfiguration GetFileConnectorConfiguration(string json, ComponentsCellComponentCellComponent componentsCellComponentCellComponent) + { + FileConnectorConfiguration result; + const string sourceDirectoryCloaking = nameof(FileConnectorConfiguration.SourceDirectoryCloaking); + JsonSerializerOptions jsonSerializerOptions = new() + { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + json = json.Replace(string.Concat("\"", nameof(FileConnectorConfiguration.ConnectionSettings), "\":"), string.Concat("\"Ignore", nameof(FileConnectorConfiguration.ConnectionSettings), "\":")); + result = JsonSerializer.Deserialize(json, jsonSerializerOptions); + if (string.IsNullOrEmpty(result.SourceFileFilter)) + result.SourceFileFilter = string.Empty; + if (result.ErrorTargetFileLocation is null) + result.ErrorTargetFileLocation = string.Empty; + if (result.SourceFileLocation is null) + result.SourceFileLocation = string.Empty; + if (result.TargetFileLocation is null) + result.TargetFileLocation = string.Empty; + if (result.FolderAgeCheckIndividualSubFolders is null) + result.FolderAgeCheckIndividualSubFolders = false; + result.ConnectionSettings = new List(); + result.SourceFileFilters = result.SourceFileFilter.Split('|').ToList(); + if (componentsCellComponentCellComponent.Equipment?.ConnectionSettings is not null) + { + foreach (Setting setting in componentsCellComponentCellComponent.Equipment.ConnectionSettings.Setting) + result.ConnectionSettings.Add(new ConnectionSetting(null, null) { Name = setting.Name, Value = setting.Value }); + } + IEnumerable sourceDirectoryCloakingCollection = from l in result.ConnectionSettings where l.Name == sourceDirectoryCloaking select l; + if (sourceDirectoryCloakingCollection.Any()) + result.SourceDirectoryCloaking = sourceDirectoryCloakingCollection.First().Value; + else + { + result.SourceDirectoryCloaking = string.Empty; + result.ConnectionSettings.Add(new ConnectionSetting(null, null) { Name = sourceDirectoryCloaking, Value = string.Empty }); + } + return result; + } + + protected Tuple GetFileConnectorConfigurationTuple(Tuple cellInstanceVersionTuple, string cellInstanceConnectionName) + { + Tuple result; + FileConnectorConfiguration fileConnectorConfiguration; + string cellInstanceServiceV2With = string.Concat(cellInstanceVersionTuple.Item1, '/', cellInstanceConnectionName); + if (_FileConnectorConfigurations.ContainsKey(cellInstanceServiceV2With)) + fileConnectorConfiguration = _FileConnectorConfigurations[cellInstanceServiceV2With]; + else + { + Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); + int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes); + ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersionTuple.Item2.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]]; + string json = JsonSerializer.Serialize(componentsCellComponentCellComponent.Equipment, new JsonSerializerOptions { WriteIndented = true }); + fileConnectorConfiguration = GetFileConnectorConfiguration(json, componentsCellComponentCellComponent); + _FileConnectorConfigurations.Add(cellInstanceServiceV2With, fileConnectorConfiguration); + } + result = new Tuple(cellInstanceServiceV2With, fileConnectorConfiguration); + return result; + } + + protected static EquipmentTypeVersion GetEquipmentTypeVersion(string url) + { + EquipmentTypeVersion result; + byte[] byteArray; + ConfigurationData configurationData; + string decodedCellInstanceConfigurationData; + string xml; + try + { + xml = XDocument.Load(url).ToString(); + } + catch (Exception exception) + { + throw new Exception(string.Concat(url, System.Environment.NewLine, exception.Message)); + } + configurationData = ParseXML(xml, throwExceptions: true); + byteArray = Convert.FromBase64String(configurationData.Data); + decodedCellInstanceConfigurationData = Encoding.Unicode.GetString(byteArray); + if (xml.Length <= 41) + throw new Exception(string.Concat("xml isn't valid {", xml, "}")); + decodedCellInstanceConfigurationData = decodedCellInstanceConfigurationData.Substring(41).Replace("i:type", "i___type"); + result = ParseXML(decodedCellInstanceConfigurationData, throwExceptions: true); + return result; + } + + protected Tuple GetEquipmentTypeVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName) + { + Tuple result; + EquipmentTypeVersion equipmentTypeVersion; + Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName); + int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes); + ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]]; + string equipmentTypeServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentTypeServiceV2/", componentsCellComponentCellComponent.Equipment.EquipmentType.Name, "/", componentsCellComponentCellComponent.Equipment.EquipmentType.Version, "/configuration"); + if (_EquipmentTypeVersions.ContainsKey(equipmentTypeServiceV2)) + equipmentTypeVersion = _EquipmentTypeVersions[equipmentTypeServiceV2]; + else + { + equipmentTypeVersion = GetEquipmentTypeVersion(equipmentTypeServiceV2); + _EquipmentTypeVersions.Add(equipmentTypeServiceV2, equipmentTypeVersion); + } + result = new Tuple(equipmentTypeServiceV2, componentsCellComponentCellComponent.Equipment.EquipmentType.Name, componentsCellComponentCellComponent.Equipment.EquipmentType.Version, equipmentTypeVersion); + return result; + } + + protected Tuple GetParameterizedModelObjectDefinitionTypeTuple(Tuple equipmentTypeVersionTuple) + { + Tuple result; + string parameterizedModelObjectDefinitionType; + if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1)) + parameterizedModelObjectDefinitionType = _ParameterizedModelObjectDefinitionTypes[equipmentTypeVersionTuple.Item1]; + else + parameterizedModelObjectDefinitionType = equipmentTypeVersionTuple.Item4.FileHandlerObjectTypes.ParameterizedModelObjectDefinition.Type; + result = new Tuple(equipmentTypeVersionTuple.Item1, parameterizedModelObjectDefinitionType); + return result; + } + + protected IList GetModelObjectParameters(string json) + { + IList results; + JsonSerializerOptions jsonSerializerOptions = new() + { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + JsonElement jsonElement = JsonSerializer.Deserialize(json); + string parameters = "Parameters"; + string fileHandlerObjectTypes = nameof(FileHandlerObjectTypes); + string parameterizedModelObjectDefinition = nameof(ParameterizedModelObjectDefinition); + if (!json.Contains(fileHandlerObjectTypes) || !json.Contains(parameterizedModelObjectDefinition)) + throw new Exception(); + jsonElement = jsonElement.GetProperty(fileHandlerObjectTypes); + if (jsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + jsonElement = jsonElement.GetProperty(parameterizedModelObjectDefinition); + if (jsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + jsonElement = jsonElement.GetProperty(parameters); + if (jsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + results = JsonSerializer.Deserialize>(jsonElement.ToString(), jsonSerializerOptions); + return results; + } + + protected Tuple> GetModelObjectParameters(Tuple equipmentTypeVersionTuple) + { + Tuple> result; + IList modelObjectParameters; + if (_FileConnectorConfigurations.ContainsKey(equipmentTypeVersionTuple.Item1)) + modelObjectParameters = _ModelObjectParameters[equipmentTypeVersionTuple.Item1]; + else + { + string json = JsonSerializer.Serialize(equipmentTypeVersionTuple.Item4, new JsonSerializerOptions { WriteIndented = true }); + modelObjectParameters = GetModelObjectParameters(json); + } + result = new Tuple>(equipmentTypeVersionTuple.Item1, modelObjectParameters); + return result; + } + + protected string[] GetEquipmentDictionaryStrings(ComponentsCellComponentCellComponentEquipment componentsCellComponentCellComponentEquipment, EquipmentTypeVersion equipmentTypeVersion) + { + string[] results; + string equipmentDictionaryName; + string equipmentDictionaryVersionName; + if (_SkipEquipmentDictionary || equipmentTypeVersion?.EventActionSequences is null || !equipmentTypeVersion.EventActionSequences.Any() || !(from l in equipmentTypeVersion.EventActionSequences where l.HandledEvent.StartsWith("Equipment.FileRead") select 1).Any()) + { + equipmentDictionaryName = string.Empty; + equipmentDictionaryVersionName = string.Empty; + } + else + { + if (componentsCellComponentCellComponentEquipment?.EquipmentDictionaries.CellEquipmentDictionaryReference is null) + { + // equipmentDictionaryName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryName; + // equipmentDictionaryVersionName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryVersion; + equipmentDictionaryName = string.Empty; + equipmentDictionaryVersionName = string.Empty; + } + else + { + equipmentDictionaryName = componentsCellComponentCellComponentEquipment.EquipmentDictionaries.CellEquipmentDictionaryReference.DictionaryName; + equipmentDictionaryVersionName = componentsCellComponentCellComponentEquipment.EquipmentDictionaries.CellEquipmentDictionaryReference.DictionaryVersion; + } + } + results = new string[] { equipmentDictionaryName, equipmentDictionaryVersionName }; + return results; + } + + protected static EquipmentDictionaryVersion GetEquipmentDictionaryVersion(string url) + { + EquipmentDictionaryVersion result; + string xml; + try + { + xml = XDocument.Load(url).ToString(); + } + catch (Exception exception) + { + throw new Exception(string.Concat(url, System.Environment.NewLine, exception.Message)); + } + ConfigurationData configurationData = ParseXML(xml, throwExceptions: true); + byte[] byteArray = Convert.FromBase64String(configurationData.Data); + string decodedCellInstanceConfigurationData = Encoding.Unicode.GetString(byteArray); + if (xml.Length <= 41) + throw new Exception(string.Concat("xml isn't valid {", xml, "}")); + decodedCellInstanceConfigurationData = decodedCellInstanceConfigurationData.Substring(41).Replace("i:type", "i___type"); + result = ParseXML(decodedCellInstanceConfigurationData, throwExceptions: true); + return result; + } + + protected Tuple GetEquipmentDictionaryVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName, EquipmentTypeVersion equipmentTypeVersion) + { + Tuple result; + string equipmentDictionaryName; + string equipmentDictionaryVersionName; + EquipmentDictionaryVersion equipmentDictionaryVersion; + Dictionary componentModelComponentsIndexes = GetComponentModelComponentsIndexes(cellInstanceVersion, cellInstanceConnectionName); + int[] cellInstanceConnectionNameIndexes = GetCellInstanceConnectionNameIndexes(cellInstanceConnectionName, componentModelComponentsIndexes); + ComponentsCellComponentCellComponent componentsCellComponentCellComponent = cellInstanceVersion.ComponentModel.Components[cellInstanceConnectionNameIndexes[0]].Children[cellInstanceConnectionNameIndexes[1]]; + string[] segments = GetEquipmentDictionaryStrings(componentsCellComponentCellComponent.Equipment, equipmentTypeVersion); + if (_SkipEquipmentDictionary || segments is null || segments.Length != 2 || string.IsNullOrEmpty(segments[0]) || string.IsNullOrEmpty(segments[1])) + { + equipmentDictionaryName = string.Empty; + equipmentDictionaryVersionName = string.Empty; + } + else + { + equipmentDictionaryName = segments[0]; + equipmentDictionaryVersionName = segments[1]; + } + string equipmentDictionaryServiceV2 = string.Concat("http://", _HostNameAndPort, "/EquipmentDictionaryServiceV2/", equipmentDictionaryName, "/", equipmentDictionaryVersionName, "/configuration"); + if (string.IsNullOrEmpty(equipmentDictionaryName) || string.IsNullOrEmpty(equipmentDictionaryVersionName)) + equipmentDictionaryVersion = null; + else + { + if (_EquipmentDictionaryVersions.ContainsKey(equipmentDictionaryServiceV2)) + equipmentDictionaryVersion = _EquipmentDictionaryVersions[equipmentDictionaryServiceV2]; + else + { + equipmentDictionaryVersion = GetEquipmentDictionaryVersion(equipmentDictionaryServiceV2); + _EquipmentDictionaryVersions.Add(equipmentDictionaryServiceV2, equipmentDictionaryVersion); + } + } + result = new Tuple(equipmentDictionaryServiceV2, equipmentDictionaryName, equipmentDictionaryVersionName, equipmentDictionaryVersion); + return result; + } + + protected Tuple>> GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(Tuple equipmentDictionaryVersionTuple) + { + Tuple>> result; + List> results; + if (_SkipEquipmentDictionary) + results = new List>(); + else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1)) + throw new Exception(); + else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null) + results = new List>(); + else if (_EquipmentDictionaryEventDescriptions.ContainsKey(equipmentDictionaryVersionTuple.Item1)) + results = _EquipmentDictionaryEventDescriptions[equipmentDictionaryVersionTuple.Item1]; + else + { + results = new List>(); + foreach (EquipmentDictionaryVersionEventsEvent equipmentDictionaryVersionEventsEvent in equipmentDictionaryVersionTuple.Item4.Events.Event) + { + if (string.IsNullOrEmpty(equipmentDictionaryVersionEventsEvent.Description)) + continue; + if (!equipmentDictionaryVersionEventsEvent.IsAlwaysEnabled) + continue; + results.Add(new Tuple(equipmentDictionaryVersionEventsEvent.Name, equipmentDictionaryVersionEventsEvent.Description)); + } + } + result = new Tuple>>(equipmentDictionaryVersionTuple.Item1, results); + return result; + } + + protected Dictionary GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList modelObjectParameters, string equipmentDictionaryName, List> equipmentDictionaryIsAlwaysEnabledEvents) + { + Dictionary results = new() + { + { nameof(Environment), _Environment }, + { nameof(HostNameAndPort), _HostNameAndPort }, + { nameof(cellInstanceName), cellInstanceName }, + { nameof(equipmentTypeName), equipmentTypeName }, + { nameof(cellInstanceVersionName), cellInstanceVersionName }, + { nameof(equipmentDictionaryName), equipmentDictionaryName }, + { nameof(cellInstanceConnectionName), cellInstanceConnectionName }, + { nameof(FileConnectorConfiguration), fileConnectorConfiguration }, + { nameof(IList), modelObjectParameters }, + { nameof(parameterizedModelObjectDefinitionType), parameterizedModelObjectDefinitionType }, + { nameof(equipmentDictionaryIsAlwaysEnabledEvents), equipmentDictionaryIsAlwaysEnabledEvents } + }; + return results; + } + + public string[] GetCSharpText(string testName) + { + string[] results; + string[] segments = GetSegments(testName); + FileInfo fileInfo = GetFileName(segments); + string cellInstanceName = GetCellInstanceName(segments); + string cellInstanceVersionName = GetCellInstanceVersionName(segments); + string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); + if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + _ = Directory.CreateDirectory(fileInfo.Directory.FullName); + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); + results = GetCSharpTextB(fileInfo, cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2); + return results; + } + + public string[] GetConfiguration(MethodBase methodBase) + { + string[] results; + string[] segments = GetSegments(methodBase.Name); + FileInfo fileInfo = GetFileName(segments); + string cellInstanceName = GetCellInstanceName(segments); + string cellInstanceVersionName = GetCellInstanceVersionName(segments); + string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); + if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + _ = Directory.CreateDirectory(fileInfo.Directory.FullName); + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); + Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName); + Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); + Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple); + Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple); + Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4); + Tuple>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple); + Dictionary objects = GetKeyValuePairs(cellInstanceName, cellInstanceVersionName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2); + string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true }); + results = new string[] { fileInfo.FullName, json }; + return results; + } + + public IFileRead Get(MethodBase methodBase, string sourceFileLocation, string sourceFileFilter, bool useCyclicalForDescription) + { + IFileRead result; + string[] segments = GetSegments(methodBase.Name); + FileInfo fileInfo = GetFileName(segments); + string cellInstanceName = GetCellInstanceName(segments); + string cellInstanceVersionName = GetCellInstanceVersionName(segments); + Dictionary fileParameter = new(); + string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); + if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName)) + _ = Directory.CreateDirectory(fileInfo.Directory.FullName); + Dictionary> dummyRuns = new(); + Tuple cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName); + Tuple fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName); + Tuple equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName); + Tuple parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple); + Tuple> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple); + Tuple equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4); + _ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple); + if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation) + fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation; + if (!string.IsNullOrEmpty(sourceFileFilter) && sourceFileFilter != fileConnectorConfigurationTuple.Item2.SourceFileFilter) + { + fileConnectorConfigurationTuple.Item2.SourceFileFilter = sourceFileFilter; + fileConnectorConfigurationTuple.Item2.SourceFileFilters = sourceFileFilter.Split('|').ToList(); + } + result = FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, useCyclicalForDescription, isEAFHosted: false); + return result; + } + + public string[] GetVariables(MethodBase methodBase, string check) + { + string[] results; + string[] lines; + string ipdsfFile; + string textFileDirectory; + string fileNameWithoutExtension; + string searchPattern = "*.ipdsf"; + string sourceFileFilter = string.Empty; + string sourceFileLocation = string.Empty; + string[] segments = GetSegments(methodBase); + string ticks = GetTicks(segments); + FileInfo fileInfo = GetFileName(segments); + string[] textFiles = GetTextFiles(segments); + string cellInstanceName = GetCellInstanceName(segments); + string rawCellInstanceName = GetRawCellInstanceName(segments); + string cellInstanceConnectionName = GetCellInstanceConnectionName(segments); + string cellInstanceConnectionNameFromMethodBaseName = GetCellInstanceConnectionNameFromMethodBaseName(segments); + string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBase.Name, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks); + if (!textFiles.Any()) + textFileDirectory = string.Empty; + else + textFileDirectory = Path.GetDirectoryName(textFiles[0]); + foreach (string textFile in textFiles) + { + lines = File.ReadAllLines(textFile); + if (lines.Length != 1) + continue; + fileNameWithoutExtension = Path.GetFileNameWithoutExtension(textFile); + if (fileNameWithoutExtension == nameof(FileConnectorConfiguration.SourceFileFilter)) + sourceFileFilter = lines[0]; + else if (fileNameWithoutExtension == nameof(FileConnectorConfiguration.SourceFileLocation)) + { + segments = lines[0].Split(new string[] { ticks }, StringSplitOptions.None); + if (segments.Length > 2) + throw new Exception("Ticks should only appear once in source file location!"); + if (segments.Length != 2) + throw new Exception("Ticks missing from source file location!"); + if (segments[1].Contains(ticks)) + throw new Exception("From source file location path should not contain ticks!"); + if (!segments[1].EndsWith(methodBaseNameWithActualCICN.Replace(ticks, string.Empty))) + throw new Exception("Method name missing from source file location!"); + sourceFileLocation = lines[0]; + } + } + if (!Directory.Exists(fileInfo.Directory.FullName)) + _ = Directory.CreateDirectory(fileInfo.Directory.FullName); + if (!fileInfo.Exists) + throw new Exception(); + string json = File.ReadAllText(fileInfo.FullName); + if (!json.Contains(check)) + throw new Exception(); + if (!json.Contains(nameof(FileConnectorConfiguration))) + throw new Exception(); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration)); + if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + JsonSerializerOptions jsonSerializerOptions = new() + { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions); + if (!string.IsNullOrEmpty(sourceFileFilter)) + fileConnectorConfiguration.SourceFileFilter = sourceFileFilter; + if (!string.IsNullOrEmpty(sourceFileLocation)) + fileConnectorConfiguration.SourceFileLocation = sourceFileLocation; + if (string.IsNullOrEmpty(sourceFileLocation)) + ipdsfFile = searchPattern; + else + { + string ipdsfDirectory = Path.Combine(sourceFileLocation, "ipdsf"); + if (!Directory.Exists(ipdsfDirectory)) + ipdsfFile = searchPattern; + else + { + string[] files = Directory.GetFiles(ipdsfDirectory, searchPattern, SearchOption.TopDirectoryOnly); + if (files.Any()) + ipdsfFile = files[0]; + else + ipdsfFile = searchPattern; + } + } + if (ipdsfFile == searchPattern) + throw new Exception(); + results = new string[] { fileInfo.FullName, json, fileConnectorConfiguration.SourceFileLocation, fileConnectorConfiguration.SourceFileFilter, ipdsfFile, textFileDirectory }; + if (string.IsNullOrEmpty(results[0])) + throw new Exception(); + if (string.IsNullOrEmpty(results[1])) + throw new Exception(); + if (string.IsNullOrEmpty(results[2])) + throw new Exception(); + if (string.IsNullOrEmpty(results[3])) + throw new Exception(); + if (string.IsNullOrEmpty(results[4])) + throw new Exception(); + if (string.IsNullOrEmpty(results[5])) + throw new Exception(); + return results; + } + +} +// namespace Adaptation._Tests.Helpers { public class AdaptationTesting { } } +// 2022-05-12 -> AdaptationTesting \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs b/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs new file mode 100644 index 0000000..62a6cf7 --- /dev/null +++ b/Adaptation/_Tests/Shared/EAFLoggingUnitTesting.cs @@ -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); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/IsEnvironment.cs b/Adaptation/_Tests/Shared/IsEnvironment.cs new file mode 100644 index 0000000..fee5113 --- /dev/null +++ b/Adaptation/_Tests/Shared/IsEnvironment.cs @@ -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; + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/ConsoleLogger.cs b/Adaptation/_Tests/Shared/Log/ConsoleLogger.cs new file mode 100644 index 0000000..6b91bb6 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/ConsoleLogger.cs @@ -0,0 +1,35 @@ +using Microsoft.Extensions.Logging; + +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 state) => null; + + public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id)) + { + string message = formatter(state, null); + Console.WriteLine(message); + } + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/ConsoleProvider.cs b/Adaptation/_Tests/Shared/Log/ConsoleProvider.cs new file mode 100644 index 0000000..490f569 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/ConsoleProvider.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Logging; +using System.Collections.Concurrent; + +namespace Adaptation._Tests.Shared.Log; + +public class ConsoleProvider : ILoggerProvider +{ + + private readonly LogLevel _LogLevel; + private readonly ConcurrentDictionary _Loggers; + + public ConsoleProvider(LogLevel logLevel) + { + _LogLevel = logLevel; + _Loggers = new ConcurrentDictionary(); + } + + public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new ConsoleLogger(_LogLevel, name)); + + public void Dispose() + { + _Loggers.Clear(); + GC.SuppressFinalize(this); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/DebugLogger.cs b/Adaptation/_Tests/Shared/Log/DebugLogger.cs new file mode 100644 index 0000000..08e1ba6 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/DebugLogger.cs @@ -0,0 +1,35 @@ +using Microsoft.Extensions.Logging; + +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 state) => null; + + public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (IsEnabled(logLevel) && (EventId == 0 || EventId == eventId.Id)) + { + string message = formatter(state, null); + System.Diagnostics.Debug.Print(message); + } + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/DebugProvider.cs b/Adaptation/_Tests/Shared/Log/DebugProvider.cs new file mode 100644 index 0000000..bd6a488 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/DebugProvider.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Logging; +using System.Collections.Concurrent; + +namespace Adaptation._Tests.Shared.Log; + +public class DebugProvider : ILoggerProvider +{ + + private readonly LogLevel _LogLevel; + private readonly ConcurrentDictionary _Loggers; + + public DebugProvider(LogLevel logLevel) + { + _LogLevel = logLevel; + _Loggers = new ConcurrentDictionary(); + } + + public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new DebugLogger(_LogLevel, name)); + + public void Dispose() + { + _Loggers.Clear(); + GC.SuppressFinalize(this); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/FeedbackLogger.cs b/Adaptation/_Tests/Shared/Log/FeedbackLogger.cs new file mode 100644 index 0000000..27d337a --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/FeedbackLogger.cs @@ -0,0 +1,48 @@ +using Microsoft.Extensions.Logging; + +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 state) => null; + + public bool IsEnabled(LogLevel logLevel) => logLevel >= _LogLevel; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func 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); + } + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/FeedbackProvider.cs b/Adaptation/_Tests/Shared/Log/FeedbackProvider.cs new file mode 100644 index 0000000..cb3ea87 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/FeedbackProvider.cs @@ -0,0 +1,28 @@ +using Microsoft.Extensions.Logging; +using System.Collections.Concurrent; + +namespace Adaptation._Tests.Shared.Log; + +public class FeedbackProvider : ILoggerProvider +{ + + private readonly LogLevel _LogLevel; + private readonly IFeedback _Feedback; + private readonly ConcurrentDictionary _Loggers; + + public FeedbackProvider(LogLevel logLevel, IFeedback feedback) + { + _LogLevel = logLevel; + _Feedback = feedback; + _Loggers = new ConcurrentDictionary(); + } + + public ILogger CreateLogger(string categoryName) => _Loggers.GetOrAdd(categoryName, name => new FeedbackLogger(_LogLevel, _Feedback, name)); + + public void Dispose() + { + _Loggers.Clear(); + GC.SuppressFinalize(this); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/IFeedback.cs b/Adaptation/_Tests/Shared/Log/IFeedback.cs new file mode 100644 index 0000000..8ba82fa --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/IFeedback.cs @@ -0,0 +1,9 @@ +namespace Adaptation._Tests.Shared.Log; + +public interface IFeedback +{ + + List Messages { get; } + void Print(string message, int color); + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/Log/Log.cs b/Adaptation/_Tests/Shared/Log/Log.cs new file mode 100644 index 0000000..7760fb9 --- /dev/null +++ b/Adaptation/_Tests/Shared/Log/Log.cs @@ -0,0 +1,136 @@ +using Microsoft.Extensions.Logging; + +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 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; + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/LoggingUnitTesting.cs b/Adaptation/_Tests/Shared/LoggingUnitTesting.cs new file mode 100644 index 0000000..f5c6a40 --- /dev/null +++ b/Adaptation/_Tests/Shared/LoggingUnitTesting.cs @@ -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 _Logger; + protected ILoggerFactory _LoggerFactory; + protected readonly LogLevel? _DefaultLogLevel; + protected readonly LogLevel? _Log4netProviderLogLevel; + protected readonly IConfigurationRoot _ConfigurationRoot; + public ILogger 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 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(); + } + + public static string GetEnvironmentSpecialDirectory() + { + string result = string.Empty; + string traceFile; + List 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); + } + +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/CellInstance.cs b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/CellInstance.cs new file mode 100644 index 0000000..1c8c8dc --- /dev/null +++ b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/CellInstance.cs @@ -0,0 +1,3056 @@ +namespace Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.CellInstance; + +// NOTE: Generated code may require at least .NET Framework 4.5 or .NET Core/Standard 2.0. +/// +[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 CellInstanceVersion +{ + +#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 long idField; + + private bool isFrozenField; + + private bool isRetiredField; + + private DateTime retireDateField; + + private object retiredByField; + + private string cellCommunicatingRuleField; + + private string cellNotCommunicatingRuleField; + + private CellInstanceVersionCellSetting cellSettingField; + + private CellInstanceVersionComponentModel componentModelField; + + private SelectedDeploymentPackage[] deploymentPackagesField; + + private CellInstanceVersionEdaConnection edaConnectionField; + + private EquipmentConnectionSettings[] equipmentConnectionsField; + + private string nameField; + + private CellInstanceVersionParentInstance parentInstanceField; + + private CellInstanceVersionEdaTraceHandling edaTraceHandlingField; + + private string id1Field; + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + public string CellCommunicatingRule + { + get => this.cellCommunicatingRuleField; + set => this.cellCommunicatingRuleField = value; + } + + /// + public string CellNotCommunicatingRule + { + get => this.cellNotCommunicatingRuleField; + set => this.cellNotCommunicatingRuleField = value; + } + + /// + public CellInstanceVersionCellSetting CellSetting + { + get => this.cellSettingField; + set => this.cellSettingField = value; + } + + /// + public CellInstanceVersionComponentModel ComponentModel + { + get => this.componentModelField; + set => this.componentModelField = value; + } + + /// + [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; + } + + /// + public CellInstanceVersionEdaConnection EdaConnection + { + get => this.edaConnectionField; + set => this.edaConnectionField = value; + } + + /// + [System.Xml.Serialization.XmlArrayItem("EquipmentConnectionSettings", Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances", IsNullable = false)] + public EquipmentConnectionSettings[] EquipmentConnections + { + get => this.equipmentConnectionsField; + set => this.equipmentConnectionsField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public CellInstanceVersionParentInstance ParentInstance + { + get => this.parentInstanceField; + set => this.parentInstanceField = value; + } + + /// + public CellInstanceVersionEdaTraceHandling EdaTraceHandling + { + get => this.edaTraceHandlingField; + set => this.edaTraceHandlingField = value; + } + + /// + [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; + } +} + +/// +[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 long idField; + + private string packageNameField; + + private string packageVersionField; + + /// + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public string PackageName + { + get => this.packageNameField; + set => this.packageNameField = value; + } + + /// + public string PackageVersion + { + get => this.packageVersionField; + set => this.packageVersionField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances", IsNullable = false)] +public partial class EquipmentConnectionSettings +{ + + private string refField; + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } +} + +/// +[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 long idField; + + private string classNameField; + + private object configurationField; + + private string nameField; + + private object editorsField; + + private string id1Field; + + private string i___typeField; + + /// + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tAutomationClient")] + public object Editors + { + get => this.editorsField; + set => this.editorsField = value; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] +public partial class CellInstanceVersionCellSetting +{ + + private long idField; + + private CellType cellTypeField; + + private string nameField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + public CellType CellType + { + get => this.cellTypeField; + set => this.cellTypeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances", IsNullable = false)] +public partial class CellType +{ + + private long idField; + + private string nameField; + + private string versionField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Version + { + get => this.versionField; + set => this.versionField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] +public partial class CellInstanceVersionComponentModel +{ + + private long idField; + + private ComponentsCellComponent[] componentsField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + [System.Xml.Serialization.XmlArrayItem("CellComponent", IsNullable = false)] + public ComponentsCellComponent[] Components + { + get => this.componentsField; + set => this.componentsField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponent +{ + + private ComponentsCellComponentCellComponent[] childrenField; + + private ComponentsCellComponentEquipment equipmentField; + + private object equipmentObjectTypeField; + + private string nameField; + + private ComponentsCellComponentComponentParameter[] parametersField; + + private string typeField; + + private string idField; + + /// + [System.Xml.Serialization.XmlArrayItem("CellComponent", IsNullable = false)] + public ComponentsCellComponentCellComponent[] Children + { + get => this.childrenField; + set => this.childrenField = value; + } + + /// + public ComponentsCellComponentEquipment Equipment + { + get => this.equipmentField; + set => this.equipmentField = value; + } + + /// + public object EquipmentObjectType + { + get => this.equipmentObjectTypeField; + set => this.equipmentObjectTypeField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlArrayItem("ComponentParameter", IsNullable = false)] + public ComponentsCellComponentComponentParameter[] Parameters + { + get => this.parametersField; + set => this.parametersField = value; + } + + /// + public string Type + { + get => this.typeField; + set => this.typeField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentCellComponent +{ + + private object childrenField; + + private ComponentsCellComponentCellComponentEquipment equipmentField; + + private object equipmentObjectTypeField; + + private string nameField; + + private ComponentsCellComponentCellComponentComponentParameter[] parametersField; + + private string typeField; + + private string idField; + + /// + public object Children + { + get => this.childrenField; + set => this.childrenField = value; + } + + /// + public ComponentsCellComponentCellComponentEquipment Equipment + { + get => this.equipmentField; + set => this.equipmentField = value; + } + + /// + public object EquipmentObjectType + { + get => this.equipmentObjectTypeField; + set => this.equipmentObjectTypeField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlArrayItem("ComponentParameter", IsNullable = false)] + public ComponentsCellComponentCellComponentComponentParameter[] Parameters + { + get => this.parametersField; + set => this.parametersField = value; + } + + /// + public string Type + { + get => this.typeField; + set => this.typeField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentCellComponentEquipment +{ + + private long idField; + + private ComponentsCellComponentChildrenCellComponentEquipmentEquipmentDictionaries equipmentDictionariesField; + + private ComponentsCellComponentCellComponentEquipmentEquipmentType equipmentTypeField; + + private string nameField; + + private string alternateTargetFolderField; + + private long connectionRetryIntervalField; + + private ConnectionSettings connectionSettingsField; + + private bool copySourceFolderStructureField; + + private string defaultPlaceHolderValueField; + + private bool deleteEmptySourceSubFoldersField; + + private string errorPostProcessingModeField; + + private string errorTargetFileLocationField; + + private string errorTargetFileNameField; + + private string fileAgeFilterModeField; + + private string fileAgeThresholdField; + + private long fileHandleTimeoutField; + + private long fileHandleWaitTimeField; + + private int fileScanningIntervalInSecondsField; + + private string fileScanningOptionField; + + private int idleEventWaitTimeInSecondsField; + + private string ifFileExistActionField; + + private string ifPostProcessingFailsActionField; + + private bool includeSubDirectoriesField; + + private string postProcessingModeField; + + private long postProcessingRetriesField; + + private string preProcessingModeField; + + private string skipSearchDirectoryNamesField; + + private string sourceFileFilterField; + + private string sourceFileLocationField; + + private string targetFileLocationField; + + private string targetFileNameField; + + private bool triggerOnChangedField; + + private bool triggerOnCreatedField; + + private bool useZip64ModeField; + + private string zipErrorTargetFileNameField; + + private long zipFileAmountField; + + private long zipFileSubFolderLevelField; + + private long zipFileTimeField; + + private string zipModeField; + + private string zipTargetFileNameField; + + private string baudRateField; + + private string connectionModeField; + + private byte deviceIdField; + + private bool deviceIdFieldSpecified; + + private string hostField; + + private string linkTestTimerField; + + private ushort portField; + + private bool portFieldSpecified; + + private string portTypeField; + + private string sessionModeField; + + private string t1InterCharacterField; + + private string t2ProtocolField; + + private string t3MessageReplyField; + + private string t4InterBlockField; + + private string t5ConnectionSeperationField; + + private string t6HsmsControlMessageField; + + private string t7ConnectionIdleField; + + private string t8NetworkIntercharacterField; + + private string id1Field; + + private string i___typeField; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + + /// + public ComponentsCellComponentChildrenCellComponentEquipmentEquipmentDictionaries EquipmentDictionaries + { + get => this.equipmentDictionariesField; + set => this.equipmentDictionariesField = value; + } + + /// + public ComponentsCellComponentCellComponentEquipmentEquipmentType EquipmentType + { + get => this.equipmentTypeField; + set => this.equipmentTypeField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string AlternateTargetFolder + { + get => this.alternateTargetFolderField; + set => this.alternateTargetFolderField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ConnectionRetryInterval + { + get => this.connectionRetryIntervalField; + set => this.connectionRetryIntervalField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public ConnectionSettings ConnectionSettings + { + get => this.connectionSettingsField; + set => this.connectionSettingsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool CopySourceFolderStructure + { + get => this.copySourceFolderStructureField; + set => this.copySourceFolderStructureField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string DefaultPlaceHolderValue + { + get => this.defaultPlaceHolderValueField; + set => this.defaultPlaceHolderValueField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool DeleteEmptySourceSubFolders + { + get => this.deleteEmptySourceSubFoldersField; + set => this.deleteEmptySourceSubFoldersField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorPostProcessingMode + { + get => this.errorPostProcessingModeField; + set => this.errorPostProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileLocation + { + get => this.errorTargetFileLocationField; + set => this.errorTargetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileName + { + get => this.errorTargetFileNameField; + set => this.errorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeFilterMode + { + get => this.fileAgeFilterModeField; + set => this.fileAgeFilterModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeThreshold + { + get => this.fileAgeThresholdField; + set => this.fileAgeThresholdField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleTimeout + { + get => this.fileHandleTimeoutField; + set => this.fileHandleTimeoutField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleWaitTime + { + get => this.fileHandleWaitTimeField; + set => this.fileHandleWaitTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int FileScanningIntervalInSeconds + { + get => this.fileScanningIntervalInSecondsField; + set => this.fileScanningIntervalInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileScanningOption + { + get => this.fileScanningOptionField; + set => this.fileScanningOptionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int IdleEventWaitTimeInSeconds + { + get => this.idleEventWaitTimeInSecondsField; + set => this.idleEventWaitTimeInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfFileExistAction + { + get => this.ifFileExistActionField; + set => this.ifFileExistActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfPostProcessingFailsAction + { + get => this.ifPostProcessingFailsActionField; + set => this.ifPostProcessingFailsActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool IncludeSubDirectories + { + get => this.includeSubDirectoriesField; + set => this.includeSubDirectoriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PostProcessingMode + { + get => this.postProcessingModeField; + set => this.postProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long PostProcessingRetries + { + get => this.postProcessingRetriesField; + set => this.postProcessingRetriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PreProcessingMode + { + get => this.preProcessingModeField; + set => this.preProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SkipSearchDirectoryNames + { + get => this.skipSearchDirectoryNamesField; + set => this.skipSearchDirectoryNamesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileFilter + { + get => this.sourceFileFilterField; + set => this.sourceFileFilterField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileLocation + { + get => this.sourceFileLocationField; + set => this.sourceFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileLocation + { + get => this.targetFileLocationField; + set => this.targetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileName + { + get => this.targetFileNameField; + set => this.targetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnChanged + { + get => this.triggerOnChangedField; + set => this.triggerOnChangedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnCreated + { + get => this.triggerOnCreatedField; + set => this.triggerOnCreatedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool UseZip64Mode + { + get => this.useZip64ModeField; + set => this.useZip64ModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipErrorTargetFileName + { + get => this.zipErrorTargetFileNameField; + set => this.zipErrorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileAmount + { + get => this.zipFileAmountField; + set => this.zipFileAmountField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileSubFolderLevel + { + get => this.zipFileSubFolderLevelField; + set => this.zipFileSubFolderLevelField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileTime + { + get => this.zipFileTimeField; + set => this.zipFileTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipMode + { + get => this.zipModeField; + set => this.zipModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipTargetFileName + { + get => this.zipTargetFileNameField; + set => this.zipTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public string BaudRate + { + get => this.baudRateField; + set => this.baudRateField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public string ConnectionMode + { + get => this.connectionModeField; + set => this.connectionModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public byte DeviceId + { + get => this.deviceIdField; + set => this.deviceIdField = value; + } + + /// + [System.Xml.Serialization.XmlIgnore()] + public bool DeviceIdSpecified + { + get => this.deviceIdFieldSpecified; + set => this.deviceIdFieldSpecified = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public string Host + { + get => this.hostField; + set => this.hostField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string LinkTestTimer + { + get => this.linkTestTimerField; + set => this.linkTestTimerField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public ushort Port + { + get => this.portField; + set => this.portField = value; + } + + /// + [System.Xml.Serialization.XmlIgnore()] + public bool PortSpecified + { + get => this.portFieldSpecified; + set => this.portFieldSpecified = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public string PortType + { + get => this.portTypeField; + set => this.portTypeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances")] + public string SessionMode + { + get => this.sessionModeField; + set => this.sessionModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T1InterCharacter + { + get => this.t1InterCharacterField; + set => this.t1InterCharacterField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T2Protocol + { + get => this.t2ProtocolField; + set => this.t2ProtocolField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T3MessageReply + { + get => this.t3MessageReplyField; + set => this.t3MessageReplyField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T4InterBlock + { + get => this.t4InterBlockField; + set => this.t4InterBlockField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T5ConnectionSeperation + { + get => this.t5ConnectionSeperationField; + set => this.t5ConnectionSeperationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T6HsmsControlMessage + { + get => this.t6HsmsControlMessageField; + set => this.t6HsmsControlMessageField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T7ConnectionIdle + { + get => this.t7ConnectionIdleField; + set => this.t7ConnectionIdleField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Semicond" + + "uctor.CellInstances", DataType = "duration")] + public string T8NetworkIntercharacter + { + get => this.t8NetworkIntercharacterField; + set => this.t8NetworkIntercharacterField = value; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentChildrenCellComponentEquipmentEquipmentDictionaries +{ + + private CellEquipmentDictionaryReference cellEquipmentDictionaryReferenceField; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public CellEquipmentDictionaryReference CellEquipmentDictionaryReference + { + get => this.cellEquipmentDictionaryReferenceField; + set => this.cellEquipmentDictionaryReferenceField = value; + } +} + +/// +[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 CellEquipmentDictionaryReference +{ + + private string dictionaryNameField; + + private string dictionaryVersionField; + + private byte idField; + + private string id1Field; + + /// + public string DictionaryName + { + get => this.dictionaryNameField; + set => this.dictionaryNameField = value; + } + + /// + public string DictionaryVersion + { + get => this.dictionaryVersionField; + set => this.dictionaryVersionField = value; + } + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentCellComponentEquipmentEquipmentType +{ + + private long idField; + + private string nameField; + + private string versionField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Version + { + get => this.versionField; + set => this.versionField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentCellComponentComponentParameter +{ + + private object enumTypeField; + + private long idField; + + private string nameField; + + private string valueField; + + private string valueTypeField; + + private bool isOverrideField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation", IsNullable = true)] + public object EnumType + { + get => this.enumTypeField; + set => this.enumTypeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string Value + { + get => this.valueField; + set => this.valueField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string ValueType + { + get => this.valueTypeField; + set => this.valueTypeField = value; + } + + /// + public bool IsOverride + { + get => this.isOverrideField; + set => this.isOverrideField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentEquipment +{ + + private long idField; + + private object equipmentDictionariesField; + + private ComponentsCellComponentEquipmentEquipmentType equipmentTypeField; + + private string nameField; + + private string alternateTargetFolderField; + + private long connectionRetryIntervalField; + + private ConnectionSettings connectionSettingsField; + + private bool copySourceFolderStructureField; + + private string defaultPlaceHolderValueField; + + private bool deleteEmptySourceSubFoldersField; + + private string errorPostProcessingModeField; + + private string errorTargetFileLocationField; + + private string errorTargetFileNameField; + + private string fileAgeFilterModeField; + + private string fileAgeThresholdField; + + private long fileHandleTimeoutField; + + private long fileHandleWaitTimeField; + + private int fileScanningIntervalInSecondsField; + + private string fileScanningOptionField; + + private int idleEventWaitTimeInSecondsField; + + private string ifFileExistActionField; + + private string ifPostProcessingFailsActionField; + + private bool includeSubDirectoriesField; + + private string postProcessingModeField; + + private long postProcessingRetriesField; + + private string preProcessingModeField; + + private string skipSearchDirectoryNamesField; + + private string sourceFileFilterField; + + private string sourceFileLocationField; + + private string targetFileLocationField; + + private string targetFileNameField; + + private bool triggerOnChangedField; + + private bool triggerOnCreatedField; + + private bool useZip64ModeField; + + private string zipErrorTargetFileNameField; + + private long zipFileAmountField; + + private long zipFileSubFolderLevelField; + + private long zipFileTimeField; + + private string zipModeField; + + private string zipTargetFileNameField; + + private string refField; + + private string id1Field; + + private string i___typeField; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public object EquipmentDictionaries + { + get => this.equipmentDictionariesField; + set => this.equipmentDictionariesField = value; + } + + /// + public ComponentsCellComponentEquipmentEquipmentType EquipmentType + { + get => this.equipmentTypeField; + set => this.equipmentTypeField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string AlternateTargetFolder + { + get => this.alternateTargetFolderField; + set => this.alternateTargetFolderField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ConnectionRetryInterval + { + get => this.connectionRetryIntervalField; + set => this.connectionRetryIntervalField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public ConnectionSettings ConnectionSettings + { + get => this.connectionSettingsField; + set => this.connectionSettingsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool CopySourceFolderStructure + { + get => this.copySourceFolderStructureField; + set => this.copySourceFolderStructureField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string DefaultPlaceHolderValue + { + get => this.defaultPlaceHolderValueField; + set => this.defaultPlaceHolderValueField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool DeleteEmptySourceSubFolders + { + get => this.deleteEmptySourceSubFoldersField; + set => this.deleteEmptySourceSubFoldersField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorPostProcessingMode + { + get => this.errorPostProcessingModeField; + set => this.errorPostProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileLocation + { + get => this.errorTargetFileLocationField; + set => this.errorTargetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileName + { + get => this.errorTargetFileNameField; + set => this.errorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeFilterMode + { + get => this.fileAgeFilterModeField; + set => this.fileAgeFilterModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeThreshold + { + get => this.fileAgeThresholdField; + set => this.fileAgeThresholdField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleTimeout + { + get => this.fileHandleTimeoutField; + set => this.fileHandleTimeoutField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleWaitTime + { + get => this.fileHandleWaitTimeField; + set => this.fileHandleWaitTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int FileScanningIntervalInSeconds + { + get => this.fileScanningIntervalInSecondsField; + set => this.fileScanningIntervalInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileScanningOption + { + get => this.fileScanningOptionField; + set => this.fileScanningOptionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int IdleEventWaitTimeInSeconds + { + get => this.idleEventWaitTimeInSecondsField; + set => this.idleEventWaitTimeInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfFileExistAction + { + get => this.ifFileExistActionField; + set => this.ifFileExistActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfPostProcessingFailsAction + { + get => this.ifPostProcessingFailsActionField; + set => this.ifPostProcessingFailsActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool IncludeSubDirectories + { + get => this.includeSubDirectoriesField; + set => this.includeSubDirectoriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PostProcessingMode + { + get => this.postProcessingModeField; + set => this.postProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long PostProcessingRetries + { + get => this.postProcessingRetriesField; + set => this.postProcessingRetriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PreProcessingMode + { + get => this.preProcessingModeField; + set => this.preProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SkipSearchDirectoryNames + { + get => this.skipSearchDirectoryNamesField; + set => this.skipSearchDirectoryNamesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileFilter + { + get => this.sourceFileFilterField; + set => this.sourceFileFilterField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileLocation + { + get => this.sourceFileLocationField; + set => this.sourceFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileLocation + { + get => this.targetFileLocationField; + set => this.targetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileName + { + get => this.targetFileNameField; + set => this.targetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnChanged + { + get => this.triggerOnChangedField; + set => this.triggerOnChangedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnCreated + { + get => this.triggerOnCreatedField; + set => this.triggerOnCreatedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool UseZip64Mode + { + get => this.useZip64ModeField; + set => this.useZip64ModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipErrorTargetFileName + { + get => this.zipErrorTargetFileNameField; + set => this.zipErrorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileAmount + { + get => this.zipFileAmountField; + set => this.zipFileAmountField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileSubFolderLevel + { + get => this.zipFileSubFolderLevelField; + set => this.zipFileSubFolderLevelField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileTime + { + get => this.zipFileTimeField; + set => this.zipFileTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipMode + { + get => this.zipModeField; + set => this.zipModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipTargetFileName + { + get => this.zipTargetFileNameField; + set => this.zipTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentEquipmentEquipmentType +{ + + private long idField; + + private string nameField; + + private string versionField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Version + { + get => this.versionField; + set => this.versionField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +public partial class ComponentsCellComponentComponentParameter +{ + + private object enumTypeField; + + private long idField; + + private string nameField; + + private string valueField; + + private string valueTypeField; + + private bool isOverrideField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation", IsNullable = true)] + public object EnumType + { + get => this.enumTypeField; + set => this.enumTypeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string Value + { + get => this.valueField; + set => this.valueField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.CellAuto" + + "mation")] + public string ValueType + { + get => this.valueTypeField; + set => this.valueTypeField = value; + } + + /// + public bool IsOverride + { + get => this.isOverrideField; + set => this.isOverrideField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] +public partial class CellInstanceVersionEdaConnection +{ + + private long idField; + + private int checkIntervalField; + + private int connectionTimeoutField; + + private object edaClientProxyFactoryProviderNameField; + + private long maxLostPingsField; + + private string portNameField; + + private int portNumberField; + + private string sSLEnabledField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public int CheckInterval + { + get => this.checkIntervalField; + set => this.checkIntervalField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public int ConnectionTimeout + { + get => this.connectionTimeoutField; + set => this.connectionTimeoutField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA", IsNullable = true)] + public object EdaClientProxyFactoryProviderName + { + get => this.edaClientProxyFactoryProviderNameField; + set => this.edaClientProxyFactoryProviderNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public long MaxLostPings + { + get => this.maxLostPingsField; + set => this.maxLostPingsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public string PortName + { + get => this.portNameField; + set => this.portNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public int PortNumber + { + get => this.portNumberField; + set => this.portNumberField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public string SSLEnabled + { + get => this.sSLEnabledField; + set => this.sSLEnabledField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] +public partial class CellInstanceVersionParentInstance +{ + + private string currentActiveVersionField; + + private object currentHostField; + + private long idField; + + private object infoField; + + private bool isStartedField; + + private string nameField; + + private object startTimeField; + + private bool startableField; + + private object stopTimeField; + + private string targetActiveVersionField; + + private object targetHostField; + + private string id1Field; + + /// + public string CurrentActiveVersion + { + get => this.currentActiveVersionField; + set => this.currentActiveVersionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object CurrentHost + { + get => this.currentHostField; + set => this.currentHostField = value; + } + + /// + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object Info + { + get => this.infoField; + set => this.infoField = value; + } + + /// + public bool IsStarted + { + get => this.isStartedField; + set => this.isStartedField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object StartTime + { + get => this.startTimeField; + set => this.startTimeField = value; + } + + /// + public bool Startable + { + get => this.startableField; + set => this.startableField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object StopTime + { + get => this.stopTimeField; + set => this.stopTimeField = value; + } + + /// + public string TargetActiveVersion + { + get => this.targetActiveVersionField; + set => this.targetActiveVersionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object TargetHost + { + get => this.targetHostField; + set => this.targetHostField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] +public partial class CellInstanceVersionEdaTraceHandling +{ + + private long maxParameterCollectionTimeDeltaField; + + private object mergeStrategyClassField; + + private object mergeStrategyParametersField; + + private long traceCleanupDaemonIntervalField; + + private TraceSourcePrimaryPrioritiesConnection[] traceSourcePrimaryPrioritiesField; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public long MaxParameterCollectionTimeDelta + { + get => this.maxParameterCollectionTimeDeltaField; + set => this.maxParameterCollectionTimeDeltaField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA", IsNullable = true)] + public object MergeStrategyClass + { + get => this.mergeStrategyClassField; + set => this.mergeStrategyClassField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public object MergeStrategyParameters + { + get => this.mergeStrategyParametersField; + set => this.mergeStrategyParametersField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + public long TraceCleanupDaemonInterval + { + get => this.traceCleanupDaemonIntervalField; + set => this.traceCleanupDaemonIntervalField = value; + } + + /// + [System.Xml.Serialization.XmlArray(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] + [System.Xml.Serialization.XmlArrayItem("Connection", IsNullable = false)] + public TraceSourcePrimaryPrioritiesConnection[] TraceSourcePrimaryPriorities + { + get => this.traceSourcePrimaryPrioritiesField; + set => this.traceSourcePrimaryPrioritiesField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] +public partial class TraceSourcePrimaryPrioritiesConnection +{ + + private long idField; + + private object equipmentDictionariesField; + + private EquipmentType equipmentTypeField; + + private string nameField; + + private string alternateTargetFolderField; + + private long connectionRetryIntervalField; + + private ConnectionSettings connectionSettingsField; + + private bool copySourceFolderStructureField; + + private string defaultPlaceHolderValueField; + + private bool deleteEmptySourceSubFoldersField; + + private string errorPostProcessingModeField; + + private string errorTargetFileLocationField; + + private string errorTargetFileNameField; + + private string fileAgeFilterModeField; + + private string fileAgeThresholdField; + + private long fileHandleTimeoutField; + + private long fileHandleWaitTimeField; + + private int fileScanningIntervalInSecondsField; + + private string fileScanningOptionField; + + private int idleEventWaitTimeInSecondsField; + + private string ifFileExistActionField; + + private string ifPostProcessingFailsActionField; + + private bool includeSubDirectoriesField; + + private string postProcessingModeField; + + private long postProcessingRetriesField; + + private string preProcessingModeField; + + private string skipSearchDirectoryNamesField; + + private string sourceFileFilterField; + + private string sourceFileLocationField; + + private string targetFileLocationField; + + private string targetFileNameField; + + private bool triggerOnChangedField; + + private bool triggerOnCreatedField; + + private bool useZip64ModeField; + + private string zipErrorTargetFileNameField; + + private long zipFileAmountField; + + private long zipFileSubFolderLevelField; + + private long zipFileTimeField; + + private string zipModeField; + + private string zipTargetFileNameField; + + private string id1Field; + + private string i___typeField; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + public object EquipmentDictionaries + { + get => this.equipmentDictionariesField; + set => this.equipmentDictionariesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + public EquipmentType EquipmentType + { + get => this.equipmentTypeField; + set => this.equipmentTypeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string AlternateTargetFolder + { + get => this.alternateTargetFolderField; + set => this.alternateTargetFolderField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ConnectionRetryInterval + { + get => this.connectionRetryIntervalField; + set => this.connectionRetryIntervalField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public ConnectionSettings ConnectionSettings + { + get => this.connectionSettingsField; + set => this.connectionSettingsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool CopySourceFolderStructure + { + get => this.copySourceFolderStructureField; + set => this.copySourceFolderStructureField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string DefaultPlaceHolderValue + { + get => this.defaultPlaceHolderValueField; + set => this.defaultPlaceHolderValueField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool DeleteEmptySourceSubFolders + { + get => this.deleteEmptySourceSubFoldersField; + set => this.deleteEmptySourceSubFoldersField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorPostProcessingMode + { + get => this.errorPostProcessingModeField; + set => this.errorPostProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileLocation + { + get => this.errorTargetFileLocationField; + set => this.errorTargetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ErrorTargetFileName + { + get => this.errorTargetFileNameField; + set => this.errorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeFilterMode + { + get => this.fileAgeFilterModeField; + set => this.fileAgeFilterModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileAgeThreshold + { + get => this.fileAgeThresholdField; + set => this.fileAgeThresholdField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleTimeout + { + get => this.fileHandleTimeoutField; + set => this.fileHandleTimeoutField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long FileHandleWaitTime + { + get => this.fileHandleWaitTimeField; + set => this.fileHandleWaitTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int FileScanningIntervalInSeconds + { + get => this.fileScanningIntervalInSecondsField; + set => this.fileScanningIntervalInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string FileScanningOption + { + get => this.fileScanningOptionField; + set => this.fileScanningOptionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public int IdleEventWaitTimeInSeconds + { + get => this.idleEventWaitTimeInSecondsField; + set => this.idleEventWaitTimeInSecondsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfFileExistAction + { + get => this.ifFileExistActionField; + set => this.ifFileExistActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string IfPostProcessingFailsAction + { + get => this.ifPostProcessingFailsActionField; + set => this.ifPostProcessingFailsActionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool IncludeSubDirectories + { + get => this.includeSubDirectoriesField; + set => this.includeSubDirectoriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PostProcessingMode + { + get => this.postProcessingModeField; + set => this.postProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long PostProcessingRetries + { + get => this.postProcessingRetriesField; + set => this.postProcessingRetriesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string PreProcessingMode + { + get => this.preProcessingModeField; + set => this.preProcessingModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SkipSearchDirectoryNames + { + get => this.skipSearchDirectoryNamesField; + set => this.skipSearchDirectoryNamesField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileFilter + { + get => this.sourceFileFilterField; + set => this.sourceFileFilterField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string SourceFileLocation + { + get => this.sourceFileLocationField; + set => this.sourceFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileLocation + { + get => this.targetFileLocationField; + set => this.targetFileLocationField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string TargetFileName + { + get => this.targetFileNameField; + set => this.targetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnChanged + { + get => this.triggerOnChangedField; + set => this.triggerOnChangedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool TriggerOnCreated + { + get => this.triggerOnCreatedField; + set => this.triggerOnCreatedField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public bool UseZip64Mode + { + get => this.useZip64ModeField; + set => this.useZip64ModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipErrorTargetFileName + { + get => this.zipErrorTargetFileNameField; + set => this.zipErrorTargetFileNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileAmount + { + get => this.zipFileAmountField; + set => this.zipFileAmountField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileSubFolderLevel + { + get => this.zipFileSubFolderLevelField; + set => this.zipFileSubFolderLevelField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public long ZipFileTime + { + get => this.zipFileTimeField; + set => this.zipFileTimeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipMode + { + get => this.zipModeField; + set => this.zipModeField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] + public string ZipTargetFileName + { + get => this.zipTargetFileNameField; + set => this.zipTargetFileNameField = value; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances", IsNullable = false)] +public partial class EquipmentType +{ + + private long idField; + + private string nameField; + + private string versionField; + + private string id1Field; + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public long Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.FactoryEntities")] + public string Version + { + get => this.versionField; + set => this.versionField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + [System.Xml.Serialization.XmlElement("VersionExtension")] + public ExtensionsVersionExtension[] VersionExtension + { + get => this.versionExtensionField; + set => this.versionExtensionField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.FactoryE" + + "ntities.CellInstances", IsNullable = false)] +public partial class Components +{ + + private ComponentsCellComponent[] cellComponentField; + + /// + [System.Xml.Serialization.XmlElement("CellComponent")] + public ComponentsCellComponent[] CellComponent + { + get => this.cellComponentField; + set => this.cellComponentField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.EDA", IsNullable = false)] +public partial class TraceSourcePrimaryPriorities +{ + + private TraceSourcePrimaryPrioritiesConnection[] connectionField; + + /// + [System.Xml.Serialization.XmlElement("Connection")] + public TraceSourcePrimaryPrioritiesConnection[] Connection + { + get => this.connectionField; + set => this.connectionField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/EafRuntimeIfx.ManagementInterfaceIfx.File" + + "Connector.CellInstances", IsNullable = false)] +public partial class ConnectionSettings +{ + + private Setting[] settingField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Setting", Namespace = "http://schemas.datacontract.org/2004/07/Ifx.ManagementInterfaceIfx.Common.Connect" + + "ionSettings")] + public Setting[] Setting + { + get => this.settingField; + set => this.settingField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Ifx.ManagementInterfaceIfx.Common.Connect" + + "ionSettings")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Ifx.ManagementInterfaceIfx.Common.Connect" + + "ionSettings", IsNullable = false)] +public partial class Setting +{ + + private string nameField; + + private string valueField; + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public string Value + { + get => this.valueField; + set => this.valueField = value; + } +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/ConfigurationData.cs b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/ConfigurationData.cs new file mode 100644 index 0000000..6fe43f6 --- /dev/null +++ b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/ConfigurationData.cs @@ -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; } +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentDictionary.cs b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentDictionary.cs new file mode 100644 index 0000000..b426395 --- /dev/null +++ b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentDictionary.cs @@ -0,0 +1,1300 @@ +namespace Adaptation._Tests.Shared.PasteSpecialXml.EAF.XML.API.EquipmentDictionary; + +// NOTE: Generated code may require at least .NET Framework 4.5 or .NET Core/Standard 2.0. +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +[System.Xml.Serialization.XmlRoot(Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization", IsNullable = false)] +public partial class EquipmentDictionaryVersion +{ + +#pragma warning disable IDE1006 // Naming Styles + + private EquipmentDictionaryVersionAlarms alarmsField; + + private string createdByField; + + private DateTime creationDateField; + + private EquipmentDictionaryVersionDataItems dataItemsField; + + private string descriptionField; + + private string dictionaryNameField; + + private EquipmentDictionaryVersionEquipmentSettings equipmentSettingsField; + + private EquipmentDictionaryVersionEvents eventsField; + + private DateTime freezeDateField; + + private object frozenByField; + + private bool isFrozenField; + + private bool isRetiredField; + + private string nameField; + + private EquipmentDictionaryVersionObjectTypes objectTypesField; + + private EquipmentDictionaryVersionReports reportsField; + + private DateTime retireDateField; + + private object retiredByField; + + private string schemaVersionField; + + private EquipmentDictionaryVersionValidityMapDataItemToEvent validityMapDataItemToEventField; + + private string idField; + + /// + public EquipmentDictionaryVersionAlarms Alarms + { + get => this.alarmsField; + set => this.alarmsField = value; + } + + /// + public string CreatedBy + { + get => this.createdByField; + set => this.createdByField = value; + } + + /// + public DateTime CreationDate + { + get => this.creationDateField; + set => this.creationDateField = value; + } + + /// + public EquipmentDictionaryVersionDataItems DataItems + { + get => this.dataItemsField; + set => this.dataItemsField = value; + } + + /// + public string Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + public string DictionaryName + { + get => this.dictionaryNameField; + set => this.dictionaryNameField = value; + } + + /// + public EquipmentDictionaryVersionEquipmentSettings EquipmentSettings + { + get => this.equipmentSettingsField; + set => this.equipmentSettingsField = value; + } + + /// + public EquipmentDictionaryVersionEvents Events + { + get => this.eventsField; + set => this.eventsField = value; + } + + /// + public DateTime FreezeDate + { + get => this.freezeDateField; + set => this.freezeDateField = value; + } + + /// + public object FrozenBy + { + get => this.frozenByField; + set => this.frozenByField = value; + } + + /// + public bool IsFrozen + { + get => this.isFrozenField; + set => this.isFrozenField = value; + } + + /// + public bool IsRetired + { + get => this.isRetiredField; + set => this.isRetiredField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public EquipmentDictionaryVersionObjectTypes ObjectTypes + { + get => this.objectTypesField; + set => this.objectTypesField = value; + } + + /// + public EquipmentDictionaryVersionReports Reports + { + get => this.reportsField; + set => this.reportsField = value; + } + + /// + public DateTime RetireDate + { + get => this.retireDateField; + set => this.retireDateField = value; + } + + /// + public object RetiredBy + { + get => this.retiredByField; + set => this.retiredByField = value; + } + + /// + public string SchemaVersion + { + get => this.schemaVersionField; + set => this.schemaVersionField = value; + } + + /// + public EquipmentDictionaryVersionValidityMapDataItemToEvent ValidityMapDataItemToEvent + { + get => this.validityMapDataItemToEventField; + set => this.validityMapDataItemToEventField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionAlarms +{ + + private EquipmentDictionaryVersionAlarmsAlarm[] alarmField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Alarm")] + public EquipmentDictionaryVersionAlarmsAlarm[] Alarm + { + get => this.alarmField; + set => this.alarmField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionAlarmsAlarm +{ + + private object contextField; + + private string descriptionField; + + private bool isEnabledField; + + private bool isVirtualField; + + private bool isVirtualFieldSpecified; + + private string nameField; + + private object severityField; + + private int sourceIDField; + + private object textField; + + private string idField; + + /// + public object Context + { + get => this.contextField; + set => this.contextField = value; + } + + /// + public string Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + public bool IsEnabled + { + get => this.isEnabledField; + set => this.isEnabledField = value; + } + + /// + public bool IsVirtual + { + get => this.isVirtualField; + set => this.isVirtualField = value; + } + + /// + [System.Xml.Serialization.XmlIgnore()] + public bool IsVirtualSpecified + { + get => this.isVirtualFieldSpecified; + set => this.isVirtualFieldSpecified = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public object Severity + { + get => this.severityField; + set => this.severityField = value; + } + + /// + public int SourceID + { + get => this.sourceIDField; + set => this.sourceIDField = value; + } + + /// + public object Text + { + get => this.textField; + set => this.textField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionDataItems +{ + + private EquipmentDictionaryVersionDataItemsItem[] itemField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Item")] + public EquipmentDictionaryVersionDataItemsItem[] Item + { + get => this.itemField; + set => this.itemField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionDataItemsItem +{ + + private string dataTypeField; + + private string descriptionField; + + private bool isQueryableField; + + private string nameField; + + private uint sourceIDField; + + private object unitField; + + private string validityContextField; + + private string idField; + + /// + public string DataType + { + get => this.dataTypeField; + set => this.dataTypeField = value; + } + + /// + public string Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + public bool IsQueryable + { + get => this.isQueryableField; + set => this.isQueryableField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public uint SourceID + { + get => this.sourceIDField; + set => this.sourceIDField = value; + } + + /// + public object Unit + { + get => this.unitField; + set => this.unitField = value; + } + + /// + public string ValidityContext + { + get => this.validityContextField; + set => this.validityContextField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionEquipmentSettings +{ + + private EquipmentDictionaryVersionEquipmentSettingsSetting[] settingField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Setting")] + public EquipmentDictionaryVersionEquipmentSettingsSetting[] Setting + { + get => this.settingField; + set => this.settingField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionEquipmentSettingsSetting +{ + + private object contextField; + + private string dataTypeField; + + private string descriptionField; + + private string initialValueField; + + private bool initializeField; + + private string nameField; + + private uint sourceIDField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object Context + { + get => this.contextField; + set => this.contextField = value; + } + + /// + public string DataType + { + get => this.dataTypeField; + set => this.dataTypeField = value; + } + + /// + public string Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + public string InitialValue + { + get => this.initialValueField; + set => this.initialValueField = value; + } + + /// + public bool Initialize + { + get => this.initializeField; + set => this.initializeField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public uint SourceID + { + get => this.sourceIDField; + set => this.sourceIDField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionEvents +{ + + private EquipmentDictionaryVersionEventsEvent[] eventField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Event")] + public EquipmentDictionaryVersionEventsEvent[] Event + { + get => this.eventField; + set => this.eventField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionEventsEvent +{ + + private object contextField; + + private string descriptionField; + + private bool isAlwaysEnabledField; + + private bool isVirtualField; + + private string nameField; + + private string sourceIDField; + + private EquipmentDictionaryVersionEventsEventValidDataItems validDataItemsField; + + private string idField; + + /// + public object Context + { + get => this.contextField; + set => this.contextField = value; + } + + /// + public string Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + public bool IsAlwaysEnabled + { + get => this.isAlwaysEnabledField; + set => this.isAlwaysEnabledField = value; + } + + /// + public bool IsVirtual + { + get => this.isVirtualField; + set => this.isVirtualField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public string SourceID + { + get => this.sourceIDField; + set => this.sourceIDField = value; + } + + /// + public EquipmentDictionaryVersionEventsEventValidDataItems ValidDataItems + { + get => this.validDataItemsField; + set => this.validDataItemsField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionEventsEventValidDataItems +{ + + private string idField; + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypes +{ + + private EquipmentDictionaryVersionObjectTypesType[] typeField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Type")] + public EquipmentDictionaryVersionObjectTypesType[] Type + { + get => this.typeField; + set => this.typeField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesType +{ + + private EquipmentDictionaryVersionObjectTypesTypeAlarms alarmsField; + + private object baseTypeField; + + private EquipmentDictionaryVersionObjectTypesTypeDataItems dataItemsField; + + private EquipmentDictionaryVersionObjectTypesTypeEvents eventsField; + + private string nameField; + + private EquipmentDictionaryVersionObjectTypesTypeSettings settingsField; + + private string idField; + + /// + public EquipmentDictionaryVersionObjectTypesTypeAlarms Alarms + { + get => this.alarmsField; + set => this.alarmsField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object BaseType + { + get => this.baseTypeField; + set => this.baseTypeField = value; + } + + /// + public EquipmentDictionaryVersionObjectTypesTypeDataItems DataItems + { + get => this.dataItemsField; + set => this.dataItemsField = value; + } + + /// + public EquipmentDictionaryVersionObjectTypesTypeEvents Events + { + get => this.eventsField; + set => this.eventsField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public EquipmentDictionaryVersionObjectTypesTypeSettings Settings + { + get => this.settingsField; + set => this.settingsField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeAlarms +{ + + private string idField; + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeDataItems +{ + + private EquipmentDictionaryVersionObjectTypesTypeDataItemsItem[] itemField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Item")] + public EquipmentDictionaryVersionObjectTypesTypeDataItemsItem[] Item + { + get => this.itemField; + set => this.itemField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeDataItemsItem +{ + + private EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItems equipmentDataItemsField; + + private string nameField; + + private object unitField; + + private string idField; + + /// + public EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItems EquipmentDataItems + { + get => this.equipmentDataItemsField; + set => this.equipmentDataItemsField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public object Unit + { + get => this.unitField; + set => this.unitField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItems +{ + + private EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItemsItem[] itemField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Item")] + public EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItemsItem[] Item + { + get => this.itemField; + set => this.itemField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeDataItemsItemEquipmentDataItemsItem +{ + + private string refField; + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeEvents +{ + + private EquipmentDictionaryVersionObjectTypesTypeEventsEvent[] eventField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Event")] + public EquipmentDictionaryVersionObjectTypesTypeEventsEvent[] Event + { + get => this.eventField; + set => this.eventField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeEventsEvent +{ + + private EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEvents equipmentEventsField; + + private string nameField; + + private string stateModelField; + + private string idField; + + /// + public EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEvents EquipmentEvents + { + get => this.equipmentEventsField; + set => this.equipmentEventsField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public string StateModel + { + get => this.stateModelField; + set => this.stateModelField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEvents +{ + + private EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEventsEvent eventField; + + private string idField; + + /// + public EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEventsEvent Event + { + get => this.eventField; + set => this.eventField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeEventsEventEquipmentEventsEvent +{ + + private string refField; + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionObjectTypesTypeSettings +{ + + private string idField; + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReports +{ + + private EquipmentDictionaryVersionReportsReport[] reportField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Report")] + public EquipmentDictionaryVersionReportsReport[] Report + { + get => this.reportField; + set => this.reportField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReport +{ + + private EquipmentDictionaryVersionReportsReportDataItems dataItemsField; + + private bool isPreDefinedField; + + private EquipmentDictionaryVersionReportsReportLinkEvents linkEventsField; + + private string nameField; + + private EquipmentDictionaryVersionReportsReportPreLinkedEvents preLinkedEventsField; + + private object sourceIdField; + + private string idField; + + /// + public EquipmentDictionaryVersionReportsReportDataItems DataItems + { + get => this.dataItemsField; + set => this.dataItemsField = value; + } + + /// + public bool IsPreDefined + { + get => this.isPreDefinedField; + set => this.isPreDefinedField = value; + } + + /// + public EquipmentDictionaryVersionReportsReportLinkEvents LinkEvents + { + get => this.linkEventsField; + set => this.linkEventsField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public EquipmentDictionaryVersionReportsReportPreLinkedEvents PreLinkedEvents + { + get => this.preLinkedEventsField; + set => this.preLinkedEventsField = value; + } + + /// + public object SourceId + { + get => this.sourceIdField; + set => this.sourceIdField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReportDataItems +{ + + private EquipmentDictionaryVersionReportsReportDataItemsItem[] itemField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Item")] + public EquipmentDictionaryVersionReportsReportDataItemsItem[] Item + { + get => this.itemField; + set => this.itemField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReportDataItemsItem +{ + + private string refField; + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReportLinkEvents +{ + + private EquipmentDictionaryVersionReportsReportLinkEventsEvent[] eventField; + + private string idField; + + /// + [System.Xml.Serialization.XmlElement("Event")] + public EquipmentDictionaryVersionReportsReportLinkEventsEvent[] Event + { + get => this.eventField; + set => this.eventField = value; + } + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReportLinkEventsEvent +{ + + private string refField; + + /// + [System.Xml.Serialization.XmlAttribute(Form = System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "http://schemas.microsoft.com/2003/10/Serialization/")] + public string Ref + { + get => this.refField; + set => this.refField = value; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionReportsReportPreLinkedEvents +{ + + private string idField; + + /// + [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; + } +} + +/// +[Serializable()] +[System.ComponentModel.DesignerCategory("code")] +[System.Xml.Serialization.XmlType(AnonymousType = true, Namespace = "http://schemas.datacontract.org/2004/07/Eaf.Management.ConfigurationData.Equipmen" + + "tCharacterization")] +public partial class EquipmentDictionaryVersionValidityMapDataItemToEvent +{ + + private object dataItemsField; + + /// + public object DataItems + { + get => this.dataItemsField; + set => this.dataItemsField = value; + } +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentType.cs b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentType.cs new file mode 100644 index 0000000..f6bdc85 --- /dev/null +++ b/Adaptation/_Tests/Shared/PasteSpecialXml/EAF XML API/EquipmentType.cs @@ -0,0 +1,962 @@ +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. +/// +[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; + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + public EquipmentTypeVersionDictionaries Dictionaries + { + get => this.dictionariesField; + set => this.dictionariesField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public EquipmentTypeVersionParentType ParentType + { + get => this.parentTypeField; + set => this.parentTypeField = value; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[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; + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public string PackageName + { + get => this.packageNameField; + set => this.packageNameField = value; + } + + /// + public string PackageVersion + { + get => this.packageVersionField; + set => this.packageVersionField = value; + } +} + +/// +[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; + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [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; + } + + /// + [System.Xml.Serialization.XmlAttribute()] + public string i___type + { + get => this.i___typeField; + set => this.i___typeField = value; + } +} + +/// +[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; + + /// + public EquipmentTypeVersionDictionariesEquipmentTypeDictionaryReference EquipmentTypeDictionaryReference + { + get => this.equipmentTypeDictionaryReferenceField; + set => this.equipmentTypeDictionaryReferenceField = value; + } +} + +/// +[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; + + /// + public string DictionaryName + { + get => this.dictionaryNameField; + set => this.dictionaryNameField = value; + } + + /// + public string DictionaryVersion + { + get => this.dictionaryVersionField; + set => this.dictionaryVersionField = value; + } + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlArrayItem("ModelObjectParameterDefinition", IsNullable = false)] + public ParameterizedModelObjectDefinitionModelObjectParameterDefinition[] Parameters + { + get => this.parametersField; + set => this.parametersField = value; + } + + /// + public string Type + { + get => this.typeField; + set => this.typeField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public string EnumType + { + get => this.enumTypeField; + set => this.enumTypeField = value; + } + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public string Value + { + get => this.valueField; + set => this.valueField = value; + } + + /// + public string ValueType + { + get => this.valueTypeField; + set => this.valueTypeField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + [System.Xml.Serialization.XmlArrayItem("EventActionParameterDefinition", IsNullable = false)] + public EventActionSequenceDefinitionEventActionParameterDefinition[] Actions + { + get => this.actionsField; + set => this.actionsField = value; + } + + /// + public string EventType + { + get => this.eventTypeField; + set => this.eventTypeField = value; + } + + /// + public string HandledEvent + { + get => this.handledEventField; + set => this.handledEventField = value; + } + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + [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; + } +} + +/// +[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; + + /// + [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; + } +} + +/// +[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; + + /// + [System.Xml.Serialization.XmlElement("VersionExtension")] + public ExtensionsVersionExtension[] VersionExtension + { + get => this.versionExtensionField; + set => this.versionExtensionField = value; + } +} + +/// +[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; + + /// + [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; + } +} + +/// +[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; + + /// + [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; + } +} + +/// +[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; + + /// + [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; + } +} + +/// +[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; + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + [System.Xml.Serialization.XmlArrayItem("ModelObjectParameterDefinition", IsNullable = false)] + public EventActionSequenceDefinitionEventActionParameterDefinitionModelObjectParameterDefinition[] Parameters + { + get => this.parametersField; + set => this.parametersField = value; + } + + /// + public string Type + { + get => this.typeField; + set => this.typeField = value; + } + + /// + public byte Position + { + get => this.positionField; + set => this.positionField = value; + } + + /// + [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; + } +} + +/// +[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; + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object Category + { + get => this.categoryField; + set => this.categoryField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object Description + { + get => this.descriptionField; + set => this.descriptionField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object DisplayName + { + get => this.displayNameField; + set => this.displayNameField = value; + } + + /// + [System.Xml.Serialization.XmlElement(IsNullable = true)] + public object EnumType + { + get => this.enumTypeField; + set => this.enumTypeField = value; + } + + /// + public byte Id + { + get => this.idField; + set => this.idField = value; + } + + /// + public bool IsMandatory + { + get => this.isMandatoryField; + set => this.isMandatoryField = value; + } + + /// + public string Name + { + get => this.nameField; + set => this.nameField = value; + } + + /// + public byte Order + { + get => this.orderField; + set => this.orderField = value; + } + + /// + public string Value + { + get => this.valueField; + set => this.valueField = value; + } + + /// + public string ValueType + { + get => this.valueTypeField; + set => this.valueTypeField = value; + } + + /// + [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; + } +} \ No newline at end of file diff --git a/Adaptation/_Tests/Shared/UnitTesting.cs b/Adaptation/_Tests/Shared/UnitTesting.cs new file mode 100644 index 0000000..3477030 --- /dev/null +++ b/Adaptation/_Tests/Shared/UnitTesting.cs @@ -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(); + 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(); + } + +} \ No newline at end of file diff --git a/Adaptation/appsettings.Development.json b/Adaptation/appsettings.Development.json new file mode 100644 index 0000000..923c216 --- /dev/null +++ b/Adaptation/appsettings.Development.json @@ -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": "" + } + ] +} \ No newline at end of file diff --git a/Adaptation/appsettings.json b/Adaptation/appsettings.json new file mode 100644 index 0000000..bfeb1ac --- /dev/null +++ b/Adaptation/appsettings.json @@ -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": "" + } + ] +} \ No newline at end of file diff --git a/Adaptation/package.json b/Adaptation/package.json index 8247f48..cb498b4 100644 --- a/Adaptation/package.json +++ b/Adaptation/package.json @@ -1,8 +1,30 @@ { "scripts": { + "Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "build": "dotnet build --runtime win-x64 --self-contained", - "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity error", + "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\\Microsoft Visual Studio\\2022\\Professional\\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 \"..\\MET08ANLYSDIFAAST230.csproj\"", "pull": "git pull", - "garbage-collect": "git gc" + "garbage-collect": "git gc", + "AT-CreateSelfDescription.Staging.v2_43_0-MET08ANLYSDIFAAST230": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~MET08ANLYSDIFAAST230\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "AX-CreateSelfDescription.Staging.v2_43_0-SPV01_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~SPV01_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "AY-CreateSelfDescription.Staging.v2_43_0-SPV01": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_43_0 & ClassName~SPV01\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "AZ-CreateSelfDescription.Staging.v2_43_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_43_0\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BA-Extract.Staging.v2_43_0-MET08ANLYSDIFAAST230-Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles637710931421087642__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0 & ClassName~MET08ANLYSDIFAAST230 & Staging__v2_43_0__MET08ANLYSDIFAAST230__MoveMatchingFiles637710931421087642__Normal\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BB-Extract.Staging.v2_43_0-SPV01-Staging__v2_43_0__SPV01__RsM643047560320000000__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0 & ClassName~SPV01 & Staging__v2_43_0__SPV01__RsM643047560320000000__Normal\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BT-Extract.Staging.v2_43_0-MET08ANLYSDIFAAST230": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0 & ClassName~MET08ANLYSDIFAAST230\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BX-Extract.Staging.v2_43_0-SPV01_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0 & ClassName~SPV01_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BY-Extract.Staging.v2_43_0-SPV01": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0 & ClassName~SPV01\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "BZ-Extract.Staging.v2_43_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_43_0\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", + "EDA": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\So~~~~~~~~~~~~~~~urce", + "OpenInsightMetrologyViewer": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\10~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_Metrology_Si\\PDSF\\MET08ANLYSDIFAAST230\\Source", + "IQSSi": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\11~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_SPC_Si\\PDSF\\MET08ANLYSDIFAAST230\\Source", + "OpenInsight": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\12~~~~~~~~~~~~~~~\\messa01ec.ec.local\\APPS\\Metrology\\MET08ANLYSDIFAAST230\\Source", + "OpenInsightMetrologyViewerAttachments": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\13~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_Metrology_Si\\PDSF\\MET08ANLYSDIFAAST230\\Attachment", + "APC": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\14~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_APC\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\Source", + "SPaCe": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\15~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_SPC_Si\\PDSF\\MET08ANLYSDIFAAST230\\PollPath", + "Processed": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\16~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_Characterization_Si\\PDSF\\MET08ANLYSDIFAAST230\\Source", + "Archive": "\\\\messv02ecc1.ec.local\\EC_EDA\\Staging\\PDSF\\MET08ANLYSDIFAAST230\\17~~~~~~~~~~~~~~~\\messv02ecc1.ec.local\\EC_Characterization_Si\\PDSF\\MET08ANLYSDIFAAST230\\Archive" } } \ No newline at end of file diff --git a/FileHandlers/FileRead.cs b/FileHandlers/FileRead.cs index 74cc743..5b367bb 100644 --- a/FileHandlers/FileRead.cs +++ b/FileHandlers/FileRead.cs @@ -1,95 +1,350 @@ -using Eaf.Core.Smtp; -using Adaptation.Shared.Metrology; +using Adaptation.Eaf.Management.ConfigurationData.CellAutomation; +using Adaptation.FileHandlers; +using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration; +using Adaptation.Shared; +using Adaptation.Shared.Methods; using Eaf.Core; +using Eaf.Core.Smtp; +using Eaf.EquipmentCore.DataCollection.Reporting; +using Eaf.EquipmentCore.SelfDescription.ElementDescription; +using Eaf.EquipmentCore.SelfDescription.EquipmentStructure; +using Eaf.EquipmentCore.SelfDescription.ParameterTypes; using Ifx.Eaf.EquipmentConnector.File.Component.Reader; +using Ifx.Eaf.EquipmentConnector.File.SelfDescription; using log4net; using Shared; using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using System.Text; using System.Text.Json; -using System.Linq; +using System.Text.Json.Serialization; +using System.Threading; -namespace MET08ANLYSDIFAAST230.FileHandlers +namespace MET08ANLYSDIFAAST230.FileHandlers; + +public partial class FileRead : FileReaderHandler, ISMTP { - public partial class FileRead : FileReaderHandler + private readonly ILog _Log; + private IFileRead _FileRead; + private EquipmentEvent _EquipmentEvent; + private readonly bool _UseCyclicalForDescription; + private FilePathGenerator _FilePathGeneratorForError; + private FilePathGenerator _FilePathGeneratorForTarget; + private readonly List _EquipmentParameters; + private static readonly Dictionary> _DummyRuns; + + static FileRead() => _DummyRuns = new Dictionary>(); + + public FileRead() { + if (FileParameter is null) + FileParameter = new Dictionary(); + _FileRead = null; + _UseCyclicalForDescription = false; + _Log = LogManager.GetLogger(typeof(FileRead)); + _EquipmentParameters = new List(); + } - private Adaptation.FileHandlers.FileRead _FileRead; - - public FileRead() + public override void CreateSelfDescription() + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry")); + try { - _Log = LogManager.GetLogger(typeof(FileRead)); - _FileRead = new Adaptation.FileHandlers.FileRead(); + if (Equipment is null) + throw new Exception(); + CreateSelfDescription(methodBase); + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); } - - public override bool Extract(string reportFullPath, string eventName) + catch (Exception ex) { - MethodBase methodBase = new StackFrame().GetMethod(); - _Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}")); - Tuple> extractResults = null; - try + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + long breakAfter = DateTime.Now.AddSeconds(30).Ticks; + for (short i = 0; i < short.MaxValue; i++) { - extractResults = _FileRead.GetExtractResult(reportFullPath, eventName); - TriggerEvents(reportFullPath, extractResults); - _FileRead.Move(reportFullPath, extractResults); - FilePathGeneratorInfoMove(reportFullPath, extractResults); - _FileRead.WaitForThread(); - _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); - return true; + if (DateTime.Now.Ticks > breakAfter) + break; + Thread.Sleep(500); } - catch (Exception ex) + throw; + } + } + + public override bool Extract(string reportFullPath, string eventName) + { + MethodBase methodBase = new StackFrame().GetMethod(); + _Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}")); + Tuple> extractResults = null; + try + { + extractResults = _FileRead.GetExtractResult(reportFullPath, eventName); + TriggerEvents(extractResults); + _FileRead.Move(extractResults); + FilePathGeneratorInfoMove(extractResults); + _FileRead.WaitForThread(); + _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); + return true; + } + catch (Exception ex) + { + _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); + _FileRead.Move(extractResults, exception: ex); + FilePathGeneratorInfoMove(extractResults, exception: ex); + return false; + } + } + + private void Send(EmailMessage emailMessage) + { + ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + if (smtp is not null) + smtp.Send(emailMessage); + } + + void ISMTP.SendLowPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.Low); + Send(emailMessage); + } + + void ISMTP.SendHighPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.High); + Send(emailMessage); + } + + void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) + { + EmailMessage emailMessage = new(subject, body, MailPriority.Normal); + Send(emailMessage); + } + + private void AddParameterRangeAndEvent() + { + string description; + bool allowNull = false; + EquipmentParameter equipmentParameter; + JsonProperty[] jsonProperties = _FileRead.GetDefault(); + Dictionary keyValuePairs = _FileRead.GetDisplayNamesJsonElement(); + Dictionary parameterTypeDefinitions = new(); + FileConnectorParameterTypeDefinitionProvider fileConnectorParameterTypeDefinitionProvider = new(); + foreach (ParameterTypeDefinition parameterTypeDefinition in fileConnectorParameterTypeDefinitionProvider.GetAllParameterTypeDefinition()) + { + switch (parameterTypeDefinition.Name) { - _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); - _FileRead.Move(reportFullPath, extractResults, exception: ex); - FilePathGeneratorInfoMove(reportFullPath, extractResults, exception: ex); - return false; + case nameof(String): + parameterTypeDefinitions.Add(JsonValueKind.String, parameterTypeDefinition); + break; + case nameof(Double): + parameterTypeDefinitions.Add(JsonValueKind.Number, parameterTypeDefinition); + break; + case nameof(Boolean): + parameterTypeDefinitions.Add(JsonValueKind.True, parameterTypeDefinition); + parameterTypeDefinitions.Add(JsonValueKind.False, parameterTypeDefinition); + break; + default: + break; } } - - public Tuple> ReExtract(string searchDirectory, string sourceFileFilter) + foreach (JsonProperty jsonProperty in jsonProperties) { - Tuple> results = _FileRead.ReExtract(searchDirectory, sourceFileFilter); - if (!(results?.Item2 is null)) + if (jsonProperty.Value.ValueKind == JsonValueKind.Object && !parameterTypeDefinitions.ContainsKey(JsonValueKind.Object)) { - TriggerEvents(_FileRead.Logistics.ReportFullPath, results); - _FileRead.Move(_FileRead.Logistics.ReportFullPath, results); - FilePathGeneratorInfoMove(_FileRead.Logistics.ReportFullPath, results); + StructuredType structuredType = new(nameof(StructuredType), string.Empty, new List()); + parameterTypeDefinitions.Add(JsonValueKind.Object, structuredType); + Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType); } - return results; + if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind)) + throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!")); } - - private void FilePathGeneratorInfoMove(string reportFullPath, Tuple> extractResults, Exception exception = null) + foreach (JsonProperty jsonProperty in jsonProperties) { - bool isErrorFile = !(exception is null); - object filePathGeneratorInfo = GetFilePathGeneratorInfo(reportFullPath, isErrorFile); - Tuple tuple = _FileRead.GetOpenInsightTuple(); - if (filePathGeneratorInfo is null || !(filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator)) - OIGaNViewer.WebClientDownloadString(tuple.Item1, tuple.Item2, reportFullPath, isErrorFile, string.Empty); + if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull) + throw new Exception(); + if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name)) + description = string.Empty; + else + description = keyValuePairs[jsonProperty.Name].Split('|')[0]; + equipmentParameter = new EquipmentParameter(jsonProperty.Name, parameterTypeDefinitions[jsonProperty.Value.ValueKind], description); + _EquipmentParameters.Add(equipmentParameter); + } + _ = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_EquipmentParameters); + _EquipmentEvent = new EquipmentEvent(_FileRead.EventName, _FileRead.GetEventDescription(), _EquipmentParameters); + _ = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent); + } + + private void CreateSelfDescription(MethodBase methodBase) + { + string cellInstanceName; + string equipmentTypeName = string.Empty; + string equipmentDictionaryName = string.Empty; + EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item; + if (Backbone.Instance?.CellName is null) + cellInstanceName = string.Empty; + else + cellInstanceName = Backbone.Instance.CellName; + string cellInstanceConnectionName = equipmentElement.Name; + FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration); + string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName; + IList modelObjectParameters = Mapper.Map(ConfiguredParameters); + _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: true); + if (_FileRead.IsEvent) + AddParameterRangeAndEvent(); + } + + private object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) + { + FilePathGeneratorInfo result; + FilePathGenerator filePathGeneratorOriginal; + if (Configuration is null) + result = null; + else + { + if (isErrorFile) + { + if (_FilePathGeneratorForError is null) + _FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true); + filePathGeneratorOriginal = _FilePathGeneratorForError; + } else { - OIGaNViewer.WebClientDownloadString(tuple.Item1, tuple.Item2, reportFullPath, isErrorFile, filePathGenerator.To); - string[] exceptionLines = _FileRead.Shared1124(reportFullPath, extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception); - if (isErrorFile) + if (_FilePathGeneratorForTarget is null) + _FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false); + filePathGeneratorOriginal = _FilePathGeneratorForTarget; + } + result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter); + } + return result; + } + + private void FilePathGeneratorInfoMove(Tuple> extractResults, Exception exception = null) + { + bool isErrorFile = exception is not null; + object filePathGeneratorInfo = GetFilePathGeneratorInfo(_FileRead.ReportFullPath, isErrorFile); + if (filePathGeneratorInfo is not null and FilePathGeneratorInfo filePathGenerator) + { + string[] exceptionLines = _FileRead.Move(extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception); + if (isErrorFile) + { + try { - try - { - StringBuilder stringBuilder = new StringBuilder(); - foreach (string item in exceptionLines) - stringBuilder.Append("<").Append(item).AppendLine(">"); - ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); - EmailMessage emailMessage = new EmailMessage(string.Concat("Exception:", _ConfigDataBase.EquipmentElementName, _ConfigDataBase.FileConnectorConfiguration?.SourceDirectoryCloaking), stringBuilder.ToString(), MailPriority.High); - smtp.Send(emailMessage); - } - catch (Exception) { } + StringBuilder stringBuilder = new(); + foreach (string item in exceptionLines) + _ = stringBuilder.Append("<").Append(item).AppendLine(">"); + ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType().SingleOrDefault(); + EmailMessage emailMessage = new(_FileRead.ExceptionSubject, stringBuilder.ToString(), MailPriority.High); + smtp.Send(emailMessage); } + catch (Exception) { } } } + } + private List GetParameterValues(List headerNames, JsonElement[] jsonElements, int i) + { + List results = new(); + if (_UseCyclicalForDescription && i > 0) + throw new Exception(); + object value; + List list; + JsonProperty[] jsonProperties = jsonElements[i].EnumerateObject().ToArray(); + if (jsonProperties.Length != _EquipmentParameters.Count) + throw new Exception(); + for (int p = 0; p < jsonProperties.Length; p++) + { + if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperties[p].Name)) + value = jsonProperties[p].Value.ToString(); + else + { + list = new List(); + for (int z = 0; z < jsonElements.Length; z++) + list.Add(new object[] { z, jsonElements[z].GetProperty(jsonProperties[p].Name).ToString() }); + value = list; + } + results.Add(new ParameterValue(_EquipmentParameters[p], value, DateTime.Now)); + } + return results; + } + + private void TriggerEvents(Tuple> extractResults) + { + List headerNames; + List parameters; + if (!_UseCyclicalForDescription) + headerNames = null; + else + headerNames = _FileRead.GetHeaderNames(); + for (int i = 0; i < extractResults.Item3.Length; i++) + { + if (_EquipmentEvent is not null) + { + _Log.Debug(string.Concat("TriggerEvent - {", _FileRead.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); + parameters = GetParameterValues(headerNames, extractResults.Item3, i); + if (_EquipmentEvent is not null) + Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); + if (_UseCyclicalForDescription) + break; + } + } + } + + public Tuple> ReExtract(string json) + { + Tuple> results; + string cellInstanceName; + if (!json.Contains(nameof(cellInstanceName))) + throw new Exception(); + string equipmentTypeName; + if (!json.Contains(nameof(equipmentTypeName))) + throw new Exception(); + string equipmentDictionaryName; + if (!json.Contains(nameof(equipmentDictionaryName))) + throw new Exception(); + string cellInstanceConnectionName; + if (!json.Contains(nameof(cellInstanceConnectionName))) + throw new Exception(); + if (!json.Contains(nameof(FileConnectorConfiguration))) + throw new Exception(); + if (!json.Contains(nameof(IList))) + throw new Exception(); + string parameterizedModelObjectDefinitionType; + if (!json.Contains(nameof(parameterizedModelObjectDefinitionType))) + throw new Exception(); + Dictionary> dummyRuns = new(); + Dictionary fileParameter = new(); + MethodBase methodBase = new StackFrame().GetMethod(); + JsonElement jsonElement = JsonSerializer.Deserialize(json); + cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString(); + equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString(); + equipmentDictionaryName = jsonElement.GetProperty(nameof(equipmentDictionaryName)).ToString(); + cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString(); + JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration)); + parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString(); + if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object) + throw new Exception(); + JsonSerializerOptions jsonSerializerOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } }; + FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions); + JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList)); + if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array) + throw new Exception(); + IList modelObjectParameters = JsonSerializer.Deserialize>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions); + _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: false); + results = _FileRead.ReExtract(); + if (results?.Item2 is null) + throw new Exception(); + else + { + TriggerEvents(results); + _FileRead.Move(results); + FilePathGeneratorInfoMove(results); + } + return results; } } +// 2022-02-15 -> FileRead \ No newline at end of file diff --git a/FileHandlers/FileReadShared.cs b/FileHandlers/FileReadShared.cs deleted file mode 100644 index be36f09..0000000 --- a/FileHandlers/FileReadShared.cs +++ /dev/null @@ -1,249 +0,0 @@ -using Adaptation.Shared.Metrology; -using Eaf.Core; -using Eaf.EquipmentCore.DataCollection.Reporting; -using Eaf.EquipmentCore.SelfDescription.ElementDescription; -using Eaf.EquipmentCore.SelfDescription.EquipmentStructure; -using Eaf.Management.ConfigurationData.CellAutomation; -using Ifx.Eaf.EquipmentConnector.File.Configuration; -using log4net; -using Shared; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text.Json; -using System.Threading; - -namespace MET08ANLYSDIFAAST230.FileHandlers -{ - - public partial class FileRead - { - -#pragma warning disable CS0169 - private readonly ILog _Log; - private Description _Description; - private ConfigDataBase _ConfigDataBase; - private EquipmentEvent _EquipmentEvent; - private FilePathGenerator _FilePathGeneratorForError; - private FilePathGenerator _FilePathGeneratorForTarget; -#pragma warning restore CS0169 - - public override void CreateSelfDescription() - { - MethodBase methodBase = new StackFrame().GetMethod(); - _Log.Debug(string.Concat(methodBase.Name, " - Entry")); - try - { - if (Equipment is null) - throw new Exception(); - string cellInstanceName; - if (Backbone.Instance?.CellName is null) - cellInstanceName = string.Empty; - else - cellInstanceName = Backbone.Instance.CellName; - if (cellInstanceName.Contains("-IO")) - cellInstanceName = cellInstanceName.Replace("-IO", string.Empty); - EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item; - Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration fileConnectorConfiguration = Map(Configuration); - IList modelObjectParameterDefinitions = Map(ConfiguredParameters); - _ConfigDataBase = _FileRead.GetConfigDataBase(methodBase, cellInstanceName, equipmentElement.Name, fileConnectorConfiguration, modelObjectParameterDefinitions, eafHosted: !(Equipment is null)); - if (Configuration.SourceFileLocation != _ConfigDataBase.FileConnectorConfiguration.SourceFileLocation) - Configuration.SourceFileLocation = _ConfigDataBase.FileConnectorConfiguration.SourceFileLocation; - _Description = new Description(_FileRead, _ConfigDataBase, Equipment); - _FileRead.Shared0749(); - if (FileParameter is null) - FileParameter = new Dictionary(); - _FileRead.Shared1301(FileParameter, fileConnectorConfiguration); - if (!(Equipment is null) && _ConfigDataBase.IsEvent) - { - if (_Description.ParameterTypeDefinitions.Any()) - { - foreach (Eaf.EquipmentCore.SelfDescription.ParameterTypes.ParameterTypeDefinition item in _Description.ParameterTypeDefinitions) - { - Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(item); - } - } - Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_Description.EquipmentParameters); - _EquipmentEvent = new EquipmentEvent(_ConfigDataBase.GetEventName(), _ConfigDataBase.GetEventDescription(), _Description.EquipmentParameters); - Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent); - } - _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit")); - } - catch (Exception ex) - { - _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace)); - long breakAfter = DateTime.Now.AddSeconds(30).Ticks; - for (short i = 0; i < short.MaxValue; i++) - { - if (DateTime.Now.Ticks > breakAfter) - break; - Thread.Sleep(500); - } - throw; - } - } - - public object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile) - { - FilePathGeneratorInfo result; - FilePathGenerator filePathGeneratorOriginal; - if (Configuration is null) - result = null; - else - { - if (isErrorFile) - { - if (_FilePathGeneratorForError is null) - _FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true); - filePathGeneratorOriginal = _FilePathGeneratorForError; - } - else - { - if (_FilePathGeneratorForTarget is null) - _FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false); - filePathGeneratorOriginal = _FilePathGeneratorForTarget; - } - result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter); - } - return result; - } - - private Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration Map(FileConnectorConfiguration configuration) - { - Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration result = new Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration - { - AlternateTargetFolder = configuration.AlternateTargetFolder, - ConnectionRetryInterval = configuration.ConnectionRetryInterval, - ConnectionSettings = new List(), - CopySourceFolderStructure = configuration.CopySourceFolderStructure, - DefaultPlaceHolderValue = configuration.DefaultPlaceHolderValue, - //DeleteAbandonedEmptySourceSubFolders = configuration.DeleteAbandonedEmptySourceSubFolders, - DeleteEmptySourceSubFolders = configuration.DeleteEmptySourceSubFolders, - ErrorPostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.ErrorPostProcessingMode, - ErrorTargetFileLocation = configuration.ErrorTargetFileLocation, - ErrorTargetFileName = configuration.ErrorTargetFileName, - FileAgeFilterMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileAgeFilterEnum)configuration.FileAgeFilterMode, - FileAgeThreshold = configuration.FileAgeThreshold, - //FileHandlers = configuration.FileHandlers, - FileHandleTimeout = (long)configuration.FileHandleTimeout, - FileHandleWaitTime = configuration.FileHandleWaitTime, - FileScanningIntervalInSeconds = configuration.FileScanningIntervalInSeconds, - FileScanningOption = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileScanningOptionEnum)configuration.FileScanningOption, - FolderAgeCheckIndividualSubFolders = configuration.FolderAgeCheckIndividualSubFolders, - FolderAgeThreshold = configuration.FolderAgeThreshold, - //FolderOperationsSubFolderLevel = configuration.FolderOperationsSubFolderLevel, - IdleEventWaitTimeInSeconds = (long)configuration.IdleEventWaitTimeInSeconds, - IfFileExistAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfFileExistEnum)configuration.IfFileExistAction, - IfPostProcessingFailsAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfPostProcessingFailsEnum)configuration.IfPostProcessingFailsAction, - IncludeSubDirectories = configuration.IncludeSubDirectories, - PostProcessingRetries = configuration.PostProcessingRetries, - PreProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PreProcessingModeEnum)configuration.PreProcessingMode, - PostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.PostProcessingMode, - SourceDirectoryCloaking = configuration.SourceDirectoryCloaking, - SourceFileFilter = configuration.SourceFileFilter, - SourceFileFilters = configuration.SourceFileFilters, - SourceFileLocation = configuration.SourceFileLocation, - TargetFileLocation = configuration.TargetFileLocation, - TargetFileName = configuration.TargetFileName, - TriggerOnChanged = configuration.TriggerOnChanged, - TriggerOnCreated = configuration.TriggerOnCreated, - UseZip64Mode = configuration.UseZip64Mode, - ZipErrorTargetFileName = configuration.ZipErrorTargetFileName, - ZipFileAmount = configuration.ZipFileAmount, - ZipFileSubFolderLevel = configuration.ZipFileSubFolderLevel, - ZipFileTime = configuration.ZipFileTime, - ZipMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.ZipModeEnum)configuration.ZipMode, - ZipTargetFileName = configuration.ZipTargetFileName, - }; - foreach (Ifx.Eaf.Common.Configuration.ConnectionSetting connectionSetting in configuration.ConnectionSettings) - result.ConnectionSettings.Add(new Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting(connectionSetting.Name, connectionSetting.Value)); - return result; - } - - private IList Map(IList configuredParameters) - { - List results = new List(); - Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType modelObjectParameterType; - for (int i = 0; i < configuredParameters.Count; i++) - { - modelObjectParameterType = (Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType)configuredParameters[i].ValueType; - results.Add(new Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition() { Id = i, Name = configuredParameters[i].Name, Value = configuredParameters[i].Value, ValueType = modelObjectParameterType, EnumType = modelObjectParameterType.ToString() }); - } - return results; - } - - public ConfigDataBase ReflectionCreateSelfDescriptionV2(string json) - { - ConfigDataBase result = _FileRead.ReflectionCreateSelfDescriptionV2(json); - _ConfigDataBase = result; - _Description = new Description(_FileRead, result, Equipment); - return result; - } - - private void TriggerEvents(string reportFullPath, Tuple> extractResults) - { - List parameters; - int count = extractResults.Item2.Value.GetArrayLength(); - for (int i = 0; i < count; i++) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); - parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, i); - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); - if (_ConfigDataBase.UseCyclicalForDescription) - break; - } - if (_ConfigDataBase.IsDatabaseExportToIPDSF && count > 0) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); - parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, null); - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); - } - } - - private void TriggerEvents(string reportFullPath, Tuple> extractResults, Dictionary eventDataList, int count) - { - const string DATA_LIST_KEY = "DataList"; - const int RESULT_CODE_SUCCESS = 0; - const string RESULT_CODE_KEY = "ReturnCode"; - const string RESULT_EMAIL_FAILURE_TYPE = "ReturnEmailFailureType"; - const string RESULT_EMAIL_FAILURE_NONE = "EmailFailureNone"; - const string RESULT_TEXT_KEY = "ReturnText"; - List parameters; - for (int i = 0; i < count; i++) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", i, " of ", count)); - //parameters = _Description.GetParameterValues(this, Equipment, extractResults.Item2, count, i); - // add the final results fields to the data dictionary - Dictionary finalDictionary = new Dictionary - { - [RESULT_CODE_KEY] = RESULT_CODE_SUCCESS, - [RESULT_TEXT_KEY] = "success", - [RESULT_EMAIL_FAILURE_TYPE] = RESULT_EMAIL_FAILURE_NONE, - [DATA_LIST_KEY] = eventDataList - }; - // trigger File Read event - //Equipment.DataCollection.TriggerEvent(mFileReadEvent, new List() { new ParameterValue(mMyParameter, finalDictionary) }); - // - parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, i, keyValuePairs: finalDictionary); - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); - if (_ConfigDataBase.UseCyclicalForDescription) - break; - } - if (_ConfigDataBase.IsDatabaseExportToIPDSF && count > 0) - { - _Log.Debug(string.Concat("TriggerEvent - {", reportFullPath, "} ", null, " of ", count)); - parameters = _Description.GetParameterValues(_FileRead, Equipment, extractResults.Item2.Value, null); - if (!(_EquipmentEvent is null)) - Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters); - } - } - - } - -} \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..801ba2f --- /dev/null +++ b/Jenkinsfile @@ -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 = 'MET08ANLYSDIFAAST230' +@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() + } + } +} diff --git a/MET08ANLYSDIFAAST230.csproj b/MET08ANLYSDIFAAST230.csproj index 757e276..0f3274b 100644 --- a/MET08ANLYSDIFAAST230.csproj +++ b/MET08ANLYSDIFAAST230.csproj @@ -5,13 +5,16 @@ Debug AnyCPU {8137A87C-D510-47A8-AA6A-6E5878B2C17D} - 9.0 + 10.0 Library Properties MET08ANLYSDIFAAST230 MET08ANLYSDIFAAST230 - v4.7.2 + v4.8 + win-x86 512 + + SAK SAK SAK @@ -93,8 +96,17 @@ - - + + + + + + + + + + + @@ -105,88 +117,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - 5.2.1 - - 2.36.0 + 2.43.0 - 5.0.1 + 6.0.3 - - - - - + \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 1ef850a..c77f4ae 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.36.0.0")] -[assembly: AssemblyFileVersion("2.36.0.0")] +[assembly: AssemblyVersion("2.43.0.0")] +[assembly: AssemblyFileVersion("2.43.0.0")] diff --git a/Shared/Description.cs b/Shared/Description.cs deleted file mode 100644 index 839cfbb..0000000 --- a/Shared/Description.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Adaptation.Shared.Metrology; -using Eaf.Core; -using Eaf.EquipmentCore.Control; -using Eaf.EquipmentCore.DataCollection.Reporting; -using Eaf.EquipmentCore.SelfDescription.ElementDescription; -using Eaf.EquipmentCore.SelfDescription.ParameterTypes; -using Ifx.Eaf.EquipmentConnector.File.SelfDescription; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace Shared -{ - - public class Description - { - - public enum RowColumn - { - Test = 1000, - Count, - Index - } - - public enum LogisticsColumn - { - EventName = 2000, - NullData, - JobID, - Sequence, - MesEntity, - ReportFullPath, - ProcessJobID, - MID - } - - public enum Param - { - String = 0, - Integer = 2, - Double = 3, - Boolean = 4, - StructuredType = 5 - } - - internal const string FileFound = "FileFound"; - - - public List EquipmentParameters { get; private set; } - public List ParameterTypeDefinitions { get; private set; } - - private readonly bool _UseCyclical; - private readonly List _HeaderNames; - private readonly Dictionary _KeyIndexPairs; - private readonly ParameterTypeDefinition _StructuredType; - private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider; - - public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl) - { - _KeyIndexPairs = new Dictionary(); - _HeaderNames = configDataBase.GetHeaderNames(logic); - _UseCyclical = configDataBase.UseCyclicalForDescription; - _StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List()); - _FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider(); - EquipmentParameters = new List(); - ParameterTypeDefinitions = new List { _StructuredType }; - Dictionary>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false); - List results = GetParameterValues(equipmentControl, keyValuePairsCollection); - } - - private List GetParameterValues(IEquipmentControl equipmentControl, Dictionary>> keyValuePairsCollection) - { - List results = new List(); - Enum param; - object value; - Enum[] @params; - string description; - List list; - EquipmentParameter equipmentParameter; - ParameterTypeDefinition parameterTypeDefinition; - bool addToEquipmentParameters = !EquipmentParameters.Any(); - foreach (KeyValuePair>> keyValuePair in keyValuePairsCollection) - { - if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key)) - continue; - @params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray(); - if (@params.Length != 1) - throw new Exception(); - if (keyValuePair.Value[0].Item2 != keyValuePair.Key) - throw new Exception(); - param = @params[0]; - if (!addToEquipmentParameters) - equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]]; - else - { - description = keyValuePair.Value[0].Item3; - _KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count()); - if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key))) - parameterTypeDefinition = _StructuredType; - else - parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString()); - equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description); - EquipmentParameters.Add(equipmentParameter); - } - if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key)) - value = keyValuePair.Value[0].Item4; - else - { - list = new List(); - for (int i = 0; i < keyValuePair.Value.Count; i++) - list.Add(new object[] { i, keyValuePair.Value[i].Item4 }); - value = list; - } - if (equipmentControl is null || !(param is Param.StructuredType)) - results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now)); - else - results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value)); - } - return results; - } - - public List GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary keyValuePairs = null) - { - List results = new List(); - if (_UseCyclical && (i is null || i.Value > 0)) - throw new Exception(); - if (jsonElement.ValueKind != JsonValueKind.Array) - throw new Exception(); - Enum param; - Tuple tuple; - JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray(); - Dictionary>> keyValuePairsCollection = new Dictionary>>(); - for (int r = i.Value; r < jsonElements.Length; r++) - { - foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject()) - { - if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array) - { - param = Param.StructuredType; - //jValue = jObject.Value("Item1"); - throw new NotImplementedException("Item1"); - } - else - { - switch (jsonProperty.Value.ValueKind) - { - case JsonValueKind.String: param = Param.String; break; - case JsonValueKind.Number: param = Param.Double; break; - case JsonValueKind.True: - case JsonValueKind.False: param = Param.Boolean; break; - case JsonValueKind.Null: param = Param.String; break; - default: param = Param.StructuredType; break; - } - } - tuple = new Tuple(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString()); - if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name)) - keyValuePairsCollection.Add(jsonProperty.Name, new List>()); - keyValuePairsCollection[jsonProperty.Name].Add(tuple); - } - if (!_UseCyclical) - break; - } - results = GetParameterValues(equipmentControl, keyValuePairsCollection); - return results; - } - - public static string GetCellName() - { - string result; - if (Backbone.Instance?.CellName is null) - result = string.Empty; - else - result = Backbone.Instance.CellName; - if (result.Contains("-IO")) - result = result.Replace("-IO", string.Empty); - return result; - } - - } - -} diff --git a/Shared/FilePathGenerator.cs b/Shared/FilePathGenerator.cs index 0a441f6..da97777 100644 --- a/Shared/FilePathGenerator.cs +++ b/Shared/FilePathGenerator.cs @@ -1,35 +1,20 @@ -using Ifx.Eaf.EquipmentConnector.File.Component; -using Ifx.Eaf.EquipmentConnector.File.Configuration; using System.Collections.Generic; +using Ifx.Eaf.EquipmentConnector.File.Component; +using Ifx.Eaf.EquipmentConnector.File.Configuration; -namespace Shared +namespace Shared; + +public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator { - public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator - { + public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } - public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } + public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) : base(config, customPattern) => FileConnectorConfiguration = config; - public FilePathGenerator(FileConnectorConfiguration config, Dictionary customPattern = null) : base(config, customPattern) - { - FileConnectorConfiguration = config; - } + public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) : base(config, file, isErrorFile, customPattern) => FileConnectorConfiguration = config; - public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary customPattern = null) : base(config, file, isErrorFile, customPattern) - { - FileConnectorConfiguration = config; - } + public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) => FileConnectorConfiguration = config; - public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) - { - FileConnectorConfiguration = config; - } - - public string GetSubFolderPath() - { - return SubFolderPath; - } - - } + public string GetSubFolderPath() => SubFolderPath; } diff --git a/Shared/FilePathGeneratorInfo.cs b/Shared/FilePathGeneratorInfo.cs index e44626b..8d5e287 100644 --- a/Shared/FilePathGeneratorInfo.cs +++ b/Shared/FilePathGeneratorInfo.cs @@ -1,67 +1,63 @@ -using System.IO; +using System.IO; -namespace Shared +namespace Shared; + +public class FilePathGeneratorInfo { - public class FilePathGeneratorInfo + public string To { get; protected set; } + public string From { get; protected set; } + public bool IsErrorFile { get; protected set; } + public string SubFolderPath { get; protected set; } + public string FirstDirectory { get; protected set; } + public string ReportFullPath { get; protected set; } + public string ResolvedFileLocation { get; protected set; } + + public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary fileParameter) { - - public string To { get; protected set; } - public string From { get; protected set; } - public bool IsErrorFile { get; protected set; } - public string SubFolderPath { get; protected set; } - public string FirstDirectory { get; protected set; } - public string ReportFullPath { get; protected set; } - public string ResolvedFileLocation { get; protected set; } - - public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary fileParameter) + ReportFullPath = reportFullPath; + IsErrorFile = isErrorFile; + if (originalFilePathGenerator is null || originalFilePathGenerator is not FilePathGenerator original) { - ReportFullPath = reportFullPath; - IsErrorFile = isErrorFile; - if (originalFilePathGenerator is null || !(originalFilePathGenerator is FilePathGenerator)) - { - FirstDirectory = string.Empty; - ResolvedFileLocation = string.Empty; - To = string.Empty; - From = string.Empty; - } - else - { - string directorySeparatorChar = Path.DirectorySeparatorChar.ToString(); - FilePathGenerator original = (FilePathGenerator)originalFilePathGenerator; - FilePathGenerator filePathGenerator = new FilePathGenerator(original.FileConnectorConfiguration, reportFullPath, isErrorFile); - SubFolderPath = filePathGenerator.GetSubFolderPath(); - if (string.IsNullOrEmpty(SubFolderPath)) - FirstDirectory = SubFolderPath; - else - FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0]; - ResolvedFileLocation = filePathGenerator.GetTargetFolder(); - if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath)) - To = string.Empty; - else if (string.IsNullOrEmpty(SubFolderPath)) - To = ResolvedFileLocation; - else - To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory); -#if (true) - if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) - original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA"; - if (!(fileParameter is null) && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) - { - foreach (var keyValuePair in fileParameter) - To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value); - } -#endif - if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar)) - From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory); - else - From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory); - if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar)) - To = string.Concat(To, Path.DirectorySeparatorChar); - else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar)) - To = To.Remove(To.Length - 1, 1); - } + FirstDirectory = string.Empty; + ResolvedFileLocation = string.Empty; + To = string.Empty; + From = string.Empty; + } + else + { + string directorySeparatorChar = Path.DirectorySeparatorChar.ToString(); + FilePathGenerator filePathGenerator = new(original.FileConnectorConfiguration, reportFullPath, isErrorFile); + SubFolderPath = filePathGenerator.GetSubFolderPath(); + if (string.IsNullOrEmpty(SubFolderPath)) + FirstDirectory = SubFolderPath; + else + FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0]; + ResolvedFileLocation = filePathGenerator.GetTargetFolder(); + if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath)) + To = string.Empty; + else if (string.IsNullOrEmpty(SubFolderPath)) + To = ResolvedFileLocation; + else + To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory); +#if (true) + if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA"; + if (fileParameter is not null && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) + { + foreach (System.Collections.Generic.KeyValuePair keyValuePair in fileParameter) + To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value); + } +#endif + if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar)) + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory); + else + From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory); + if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar)) + To = string.Concat(To, Path.DirectorySeparatorChar); + else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar)) + To = To.Remove(To.Length - 1, 1); } - } } diff --git a/Shared/Mapper.cs b/Shared/Mapper.cs new file mode 100644 index 0000000..fe5c923 --- /dev/null +++ b/Shared/Mapper.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using Eaf.Management.ConfigurationData.CellAutomation; +using Ifx.Eaf.EquipmentConnector.File.Configuration; + +namespace Shared; + +public static class Mapper +{ + + internal static Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration Map(FileConnectorConfiguration configuration) + { + Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration result = new() + { + AlternateTargetFolder = configuration.AlternateTargetFolder, + ConnectionRetryInterval = configuration.ConnectionRetryInterval, + ConnectionSettings = new List(), + CopySourceFolderStructure = configuration.CopySourceFolderStructure, + DefaultPlaceHolderValue = configuration.DefaultPlaceHolderValue, + //DeleteAbandonedEmptySourceSubFolders = configuration.DeleteAbandonedEmptySourceSubFolders, + DeleteEmptySourceSubFolders = configuration.DeleteEmptySourceSubFolders, + ErrorPostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.ErrorPostProcessingMode, + ErrorTargetFileLocation = configuration.ErrorTargetFileLocation, + ErrorTargetFileName = configuration.ErrorTargetFileName, + FileAgeFilterMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileAgeFilterEnum)configuration.FileAgeFilterMode, + FileAgeThreshold = configuration.FileAgeThreshold, + //FileHandlers = configuration.FileHandlers, + FileHandleTimeout = (long)configuration.FileHandleTimeout, + FileHandleWaitTime = configuration.FileHandleWaitTime, + FileScanningIntervalInSeconds = configuration.FileScanningIntervalInSeconds, + FileScanningOption = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileScanningOptionEnum)configuration.FileScanningOption, + FolderAgeCheckIndividualSubFolders = configuration.FolderAgeCheckIndividualSubFolders, + FolderAgeThreshold = configuration.FolderAgeThreshold, + //FolderOperationsSubFolderLevel = configuration.FolderOperationsSubFolderLevel, + IdleEventWaitTimeInSeconds = (long)configuration.IdleEventWaitTimeInSeconds, + IfFileExistAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfFileExistEnum)configuration.IfFileExistAction, + IfPostProcessingFailsAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfPostProcessingFailsEnum)configuration.IfPostProcessingFailsAction, + IncludeSubDirectories = configuration.IncludeSubDirectories, + PostProcessingRetries = configuration.PostProcessingRetries, + PreProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PreProcessingModeEnum)configuration.PreProcessingMode, + PostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.PostProcessingMode, + SourceDirectoryCloaking = configuration.SourceDirectoryCloaking, + SourceFileFilter = configuration.SourceFileFilter, + SourceFileFilters = configuration.SourceFileFilters, + SourceFileLocation = configuration.SourceFileLocation, + TargetFileLocation = configuration.TargetFileLocation, + TargetFileName = configuration.TargetFileName, + TriggerOnChanged = configuration.TriggerOnChanged, + TriggerOnCreated = configuration.TriggerOnCreated, + UseZip64Mode = configuration.UseZip64Mode, + ZipErrorTargetFileName = configuration.ZipErrorTargetFileName, + ZipFileAmount = configuration.ZipFileAmount, + ZipFileSubFolderLevel = configuration.ZipFileSubFolderLevel, + ZipFileTime = configuration.ZipFileTime, + ZipMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.ZipModeEnum)configuration.ZipMode, + ZipTargetFileName = configuration.ZipTargetFileName, + }; + foreach (Ifx.Eaf.Common.Configuration.ConnectionSetting connectionSetting in configuration.ConnectionSettings) + result.ConnectionSettings.Add(new Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting(connectionSetting.Name, connectionSetting.Value)); + return result; + } + + internal static IList Map(IList configuredParameters) + { + List results = new(); + Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType modelObjectParameterType; + for (int i = 0; i < configuredParameters.Count; i++) + { + modelObjectParameterType = (Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType)configuredParameters[i].ValueType; + results.Add(new Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition() { Id = i, Name = configuredParameters[i].Name, Value = configuredParameters[i].Value, ValueType = modelObjectParameterType, EnumType = modelObjectParameterType.ToString() }); + } + return results; + } + +}