29 Commits

Author SHA1 Message Date
525d54f392 Not Tested
json in process-data-standard-format

process-data-standard-format with HeaderId and SubgroupId

process-data-standard-format with pipes

UniqueId replacement for attachments

Write input PDSF in output after EOF

ProcessDataStandardFormat over Tuple

MoveMatchingFiles to use ProcessDataStandardFormatMapping
2025-05-22 09:38:11 -07:00
fd853ddcd4 Infineon.EAF.Runtime v2.59.0 2025-02-21 13:13:56 -07:00
188f69fb62 Infineon.EAF.Runtime 2.49.3 2023-09-07 21:49:03 -07:00
870ff2c2c8 Infineon.EAF.Runtime 2.49.3 2023-09-07 21:43:25 -07:00
b13f0ed089 Infineon.EAF.Runtime 2.49.3 2023-08-02 09:49:18 -07:00
420f5313b0 Infineon.EAF.Runtime 2.49.3 2023-08-02 08:23:44 -07:00
84a7db6100 Back to x64 2023-07-24 10:30:49 -07:00
4491e3fc42 Save ProcessDataStandardFormat to EC_Metrology_Si
IDescription.GetDescriptions with body
Viewer support
tasks.json
kanbn initialize
WSRequest alignment
2023-07-20 16:11:09 -07:00
cb5c059f50 v2.49.2 2023-05-22 18:39:19 -07:00
b9e74f1bac Better error message 2023-05-16 12:58:45 -07:00
fce0aaeb24 SRP2100 = 53, //Largest 2023-05-08 09:23:09 -07:00
3e66678065 AssemblyVersion 2023-04-24 16:19:10 -07:00
2d38427bb2 connectionCount IV 2023-04-22 19:12:34 -07:00
f554a0ad7a connectionCount III 2023-04-22 15:19:30 -07:00
61f851db59 connectionCount II 2023-04-22 15:14:59 -07:00
d43e5f00a8 connectionCount 2023-04-22 13:54:06 -07:00
3a9413deb3 #pragma warning disable IDE0060 2023-04-22 09:18:12 -07:00
2ff1342f5a MesEntity Placeholder 2023-04-22 08:35:14 -07:00
f9296dc252 Infineon.EAF.Runtime 2.49.0 2023-04-13 12:06:39 -07:00
da5afebe03 Not verified 2023-04-13 12:02:10 -07:00
baeed42d37 Assembly Version 2023-02-23 12:18:27 -07:00
6609772a05 nuget ^ 2023-02-14 10:35:24 -07:00
d250651c28 PackageReference arrangement 2023-02-06 07:43:49 -07:00
cb9386b283 dotnet tool 2023-01-30 19:32:18 -07:00
03bbc36802 Bug in yml 2023-01-27 12:45:20 -07:00
79ef3c88e4 #if DEBUG 2023-01-24 10:29:47 -07:00
23d89c85bc #if !DEBUG 2023-01-24 09:51:37 -07:00
b3c970216c #if (!DEBUG) 2023-01-24 09:46:11 -07:00
a180f65069 2023-01-24 2023-01-24 09:06:42 -07:00
37 changed files with 2288 additions and 1659 deletions

11
.gitignore vendored
View File

@ -331,10 +331,11 @@ ASALocalRun/
## ##
## Visual Studio Code ## Visual Studio Code
## ##
.vscode/* **/.vscode/*
!.vscode/settings.json !**/.vscode/extensions.json
!.vscode/tasks.json !**/.vscode/format-report.json
!.vscode/launch.json !**/.vscode/launch.json
!.vscode/extensions.json !**/.vscode/settings.json
!**/.vscode/tasks.json
*.lnk *.lnk

172
.groovy
View File

@ -1,172 +0,0 @@
#!/usr/bin/env groovy
/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
import groovy.transform.Field
@Field String _DDrive = 'D:/'
@Field String _GitName = 'EC'
@Field String _AssemblyName = '...'
@Field String _TargetLocation = '...'
@Field String _GitCommitSeven = '...'
@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()
}
}
}

View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.1.15",
"commands": [
"reportgenerator"
]
}
}
}

View File

@ -76,12 +76,15 @@ csharp_using_directive_placement = outside_namespace
dotnet_code_quality_unused_parameters = all dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter dotnet_code_quality_unused_parameters = non_public # IDE0060: Remove unused parameter
dotnet_code_quality.CAXXXX.api_surface = private, internal dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1816.severity = none # CA1816: Call GC.SuppressFinalize correctly
dotnet_diagnostic.CA1825.severity = warning # CA1823: Avoid zero-length array allocations 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.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.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer AsSpan over Substring
dotnet_diagnostic.CA1847.severity = none # CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2"); dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary dotnet_diagnostic.IDE0005.severity = warning # Using directive is unnecessary
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049) dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)

View File

@ -0,0 +1,7 @@
.kanbn-task-data-workload {
display: none;
}
.kanbn-task-data-relation {
display: block;
color: #198038;
}

View File

@ -0,0 +1,21 @@
---
type: "kanbn"
created: 2023-07-07T15:37:56.040Z
updated: 2023-07-18T19:52:59.668Z
startedColumns:
- 'In Progress'
completedColumns:
- Done
dateFormat: mm/dd
taskTemplate: '^+^_${overdue ? ''^R'' : ''''}${name}^: ${relations ? (''\n^-^/^g'' + relations.reduce((accumulator, currentValue) => accumulator.task + currentValue.task + '' '', '''')) : ''''}'
---
# EC
## Backlog
## Todo
## In Progress
## Done

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

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

View File

@ -1,4 +1,9 @@
{ {
"[markdown]": {
"editor.wordWrap": "off"
},
"cSpell.words": [],
"coverage-gutters.coverageBaseDir": "../../../../EC/05_TestResults/TestResults/**",
"workbench.colorCustomizations": { "workbench.colorCustomizations": {
"activityBar.activeBackground": "#d791c9", "activityBar.activeBackground": "#d791c9",
"activityBar.activeBorder": "#e8eed0", "activityBar.activeBorder": "#e8eed0",

108
Adaptation/.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,108 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Nuget Clear",
"command": "dotnet",
"type": "process",
"args": [
"nuget",
"locals",
"all",
"--clear"
],
"problemMatcher": "$msCompile"
},
{
"label": "MSBuild for EAF Deployment Packages",
"command": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"type": "process",
"args": [
"/target:Build",
"/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json%3Bhttps://tfs.intra.infineon.com/tfs/FactoryIntegration/_packaging/EAF%40Local/nuget/v3/index.json%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
"../EC.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Project",
"type": "shell",
"command": "code ../EC.csproj",
"problemMatcher": []
},
{
"label": "Readme",
"type": "shell",
"command": "code ../README.md",
"problemMatcher": []
},
{
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
"type": "shell",
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
"args": [
"s",
"X",
"L:/DevOps/EAF-Mesa-Integration/EC",
"Day-Helper-2025-03-20",
"false",
"4"
],
"problemMatcher": []
},
{
"label": "Git Config",
"type": "shell",
"command": "code ../.git/config",
"problemMatcher": []
},
{
"label": "Kanbn Console",
"type": "npm",
"script": "kanbn.board",
"problemMatcher": []
},
{
"label": "Kanbn Write Boad",
"type": "shell",
"command": "& kanbn board -j | L:/Git/kanbn2md/kanbn2md.exe >.kanbn/board.md",
"problemMatcher": []
},
{
"label": "Kanbn Write json",
"type": "npm",
"script": "kanbn.board.json",
"problemMatcher": []
}
]
}

View File

@ -0,0 +1 @@
ECHO is on.

View File

@ -11,7 +11,7 @@
<LangVersion>10.0</LangVersion> <LangVersion>10.0</LangVersion>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<VSTestLogger>trx</VSTestLogger> <VSTestLogger>trx</VSTestLogger>
@ -33,49 +33,8 @@
<DefineConstants>Linux</DefineConstants> <DefineConstants>Linux</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" /> <PackageReference Include="coverlet.collector" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="6.0.0" /> <PackageReference Include="FFMpegCore" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
<PackageReference Include="System.Data.OleDb" Version="6.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.4" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.6" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FFMpegCore" Version="4.8.0" />
<PackageReference Include="Infineon.Yoda" Version="5.4.1" />
<PackageReference Include="Instances" Version="2.0.0" />
<PackageReference Include="RoboSharp" Version="1.2.8" />
<PackageReference Include="Tesseract" Version="4.1.1" />
<PackageReference Include="Tibco.Rendezvous" Version="8.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="External.Common.Logging.Core" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="External.Common.Logging" Version="3.3.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="External.log4net" Version="2.0.8"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.AWT.WinForms" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.Core" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.Media" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
@ -83,6 +42,39 @@
<PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.Util" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.OpenJDK.XML.API" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference> <PackageReference Include="IKVM.Runtime" Version="7.2.4630.5"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="Instances" Version="3.0.1" />
<PackageReference Include="log4net" Version="3.0.3"></PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.json" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="9.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.7.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.0" />
<PackageReference Include="Pdfbox" Version="1.1.1"><NoWarn>NU1701</NoWarn></PackageReference>
<PackageReference Include="RoboSharp" Version="1.6.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
<PackageReference Include="System.Data.OleDb" Version="9.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Mesa.PDF.Text.Stripper" Version="4.8.0.2"><NoWarn>NU1701</NoWarn></PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Infineon.Yoda.DotNetCore" Version="5.4.3" />
<PackageReference Include="Tibco.Rendezvous.DotNetCore" Version="8.5.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="appsettings.json"> <None Include="appsettings.json">

1
Adaptation/EC.yml Normal file
View File

@ -0,0 +1 @@
ECHO is on.

View File

@ -9,12 +9,12 @@ namespace Adaptation.FileHandlers;
public class CellInstanceConnectionName public class CellInstanceConnectionName
{ {
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, int? connectionCount)
{ {
IFileRead result = cellInstanceConnectionName switch IFileRead result = cellInstanceConnectionName switch
{ {
nameof(MapEafDrives) => new MapEafDrives.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), nameof(MapEafDrives) => new MapEafDrives.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
nameof(RijndaelEncryption) => new RijndaelEncryption.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted), nameof(RijndaelEncryption) => new RijndaelEncryption.FileRead(smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null),
_ => throw new Exception(), _ => throw new Exception(),
}; };
return result; return result;

View File

@ -18,8 +18,8 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly AppSettings _AppSettings; private readonly AppSettings _AppSettings;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted) base(new Description(), true, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
_NullData = string.Empty; _NullData = string.Empty;
@ -107,13 +107,11 @@ public class FileRead : Shared.FileRead, IFileRead
return results; return results;
} }
#pragma warning disable IDE0060
private static Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime) private static Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
#pragma warning restore IDE0060
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>()); Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
if (reportFullPath is null)
{ }
if (dateTime == DateTime.MinValue)
{ }
return results; return results;
} }

View File

@ -18,8 +18,8 @@ public class FileRead : Shared.FileRead, IFileRead
private readonly AppSettings _AppSettings; private readonly AppSettings _AppSettings;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) : public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Shared.Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted) base(new Description(), true, smtp, fileParameter, cellInstanceName, connectionCount, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, staticRuns, useCyclicalForDescription, isEAFHosted: connectionCount is null)
{ {
_MinFileLength = 10; _MinFileLength = 10;
_NullData = string.Empty; _NullData = string.Empty;

View File

@ -110,6 +110,42 @@ public class Description : IDescription, Properties.IDescription
List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData) List<IDescription> IDescription.GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData)
{ {
List<IDescription> results = new(); List<IDescription> results = new();
if (iProcessData is null || !iProcessData.Details.Any())
results.Add(GetDefault(fileRead, logistics));
else
{
string nullData;
Description description;
object configDataNullData = fileRead.NullData;
if (configDataNullData is null)
nullData = string.Empty;
else
nullData = configDataNullData.ToString();
for (int i = 0; i < iProcessData.Details.Count; i++)
{
if (iProcessData.Details[i] is null)
continue;
description = new Description
{
Test = (int)tests[i],
Count = tests.Count,
Index = i,
//
EventName = fileRead.EventName,
NullData = nullData,
JobID = fileRead.CellInstanceName,
Sequence = logistics.Sequence.ToString(),
MesEntity = logistics.MesEntity,
ReportFullPath = logistics.ReportFullPath,
ProcessJobID = logistics.ProcessJobID,
MID = logistics.MID,
//
Date = DateTime.Now.ToString(GetDateFormat()),
RDS = string.Empty,
};
results.Add(description);
}
}
return results; return results;
} }
@ -140,4 +176,6 @@ public class Description : IDescription, Properties.IDescription
return result; return result;
} }
internal static string GetDateFormat() => "MM/dd/yyyy hh:mm:ss tt";
} }

View File

@ -44,9 +44,9 @@ public class FileRead : Properties.IFileRead
protected readonly string _CellInstanceConnectionNameBase; protected readonly string _CellInstanceConnectionNameBase;
protected readonly Dictionary<string, List<long>> _DummyRuns; protected readonly Dictionary<string, List<long>> _DummyRuns;
protected readonly Dictionary<string, string> _FileParameter; protected readonly Dictionary<string, string> _FileParameter;
protected readonly Dictionary<long, List<string>> _StaticRuns;
protected readonly string _ParameterizedModelObjectDefinitionType; protected readonly string _ParameterizedModelObjectDefinitionType;
protected readonly FileConnectorConfiguration _FileConnectorConfiguration; protected readonly FileConnectorConfiguration _FileConnectorConfiguration;
protected readonly Dictionary<long, List<Metrology.WS.Results>> _StaticRuns;
protected readonly IList<ModelObjectParameterDefinition> _ModelObjectParameterDefinitions; protected readonly IList<ModelObjectParameterDefinition> _ModelObjectParameterDefinitions;
bool Properties.IFileRead.IsEvent => _IsEvent; bool Properties.IFileRead.IsEvent => _IsEvent;
@ -63,7 +63,147 @@ public class FileRead : Properties.IFileRead
string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName; string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName;
string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType; string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType;
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<string>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted) protected static string GetTupleFile<T>(Logistics logistics, List<T> descriptions, Properties.IScopeInfo scopeInfo, string duplicateDirectory, string duplicateFile) where T : Properties.IDescription
{
string result;
string rds;
string fileName;
string dateValue;
string rdsPlaceholder = "%RDS%";
string mesEntityPlaceholder = "%MesEntity%";
if (descriptions.Count == 0 || string.IsNullOrEmpty(descriptions[0].RDS))
rds = logistics.MID;
else
rds = descriptions[0].RDS;
string[] segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length == 0)
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace(rdsPlaceholder, rds).Replace(mesEntityPlaceholder, logistics.MesEntity));
else
{
segments = segments[1].Split('%');
string datePlaceholder = "%DateTime%";
dateValue = logistics.DateTimeFromSequence.ToString(segments[0]);
foreach (string segment in scopeInfo.FileName.Split('%'))
{
if (!segment.Contains(segments[0]))
continue;
datePlaceholder = string.Concat('%', segment, '%');
}
fileName = scopeInfo.FileName.Replace(rdsPlaceholder, rds).Replace(mesEntityPlaceholder, logistics.MesEntity).Replace(datePlaceholder, dateValue);
if (!duplicateFile.Contains("Viewer"))
result = Path.Combine(duplicateDirectory, fileName);
else
result = Path.Combine(duplicateDirectory, $"Viewer_{fileName}");
}
if (result.Contains('%'))
throw new Exception("Placeholder exists!");
return result;
}
protected void WaitForFileConsumption<T>(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, List<T> descriptions, string successDirectory, string duplicateDirectory, string duplicateFile, List<(Properties.IScopeInfo, string)> collection) where T : Properties.IDescription
{
bool check;
long preWait;
string tupleFile;
string tupleFileName = string.Empty;
List<string> duplicateFiles = new();
StringBuilder stringBuilder = new();
List<int> consumedFileIndices = new();
bool moreThanAnHour = _BreakAfterSeconds > 3600;
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = dateTime.AddMilliseconds(1234).Ticks;
else
preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (collection.Count == 0)
duplicateFiles.Add(duplicateFile);
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath));
foreach ((Properties.IScopeInfo scopeInfo, string text) in collection)
{
if (scopeInfo.FileName.StartsWith(@"\"))
tupleFile = scopeInfo.FileName;
else if (!scopeInfo.FileName.Contains('%'))
tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", scopeInfo.FileNameWithoutExtension, ".pdsfc");
else
tupleFile = GetTupleFile(logistics, descriptions, scopeInfo, duplicateDirectory, duplicateFile);
tupleFileName = Path.GetFileNameWithoutExtension(tupleFile).Split('.')[0];
duplicateFiles.Add(tupleFile);
if (_IsEAFHosted)
File.WriteAllText(tupleFile, text);
}
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(100);
}
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]))
{
if (string.IsNullOrEmpty(tupleFileName))
consumedFileIndices.Add(i);
else if (duplicateFiles.All(l => Path.GetFileNameWithoutExtension(l).Split('.')[0] == tupleFileName))
{
for (int j = 0; j < duplicateFiles.Count; j++)
consumedFileIndices.Add(j);
}
else
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(250);
}
}
}
protected void WaitForFileConsumption<T>(DateTime dateTime, List<T> descriptions, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> collection, string duplicateFile) where T : Properties.IDescription
{
if (!isDummyRun && _IsEAFHosted)
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, descriptions, successDirectory, duplicateDirectory, duplicateFile, collection);
else
{
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter)
break;
Thread.Sleep(500);
}
}
}
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, int? connectionCount, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, Dictionary<long, List<Metrology.WS.Results>> staticRuns, bool useCyclicalForDescription, bool isEAFHosted)
{ {
_SMTP = smtp; _SMTP = smtp;
_IsEvent = isEvent; _IsEvent = isEvent;
@ -106,7 +246,7 @@ public class FileRead : Properties.IFileRead
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent) if (string.IsNullOrEmpty(equipmentDictionaryName) && isEvent)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent) if (!string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent && connectionCount > 1)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
// if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent) // if (string.IsNullOrEmpty(equipmentDictionaryName) && !isEvent)
// throw new Exception(cellInstanceConnectionName); // throw new Exception(cellInstanceConnectionName);
@ -160,10 +300,161 @@ public class FileRead : Properties.IFileRead
return result; return result;
} }
protected void UpdateLastTicksDuration(long ticksDuration)
{
if (ticksDuration < 50000000)
ticksDuration = 50000000;
_LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667);
_Log.Info($"{new TimeSpan(ticksDuration).TotalMilliseconds} TotalMillisecond(s) to process{Environment.NewLine}{_CellInstanceConnectionName}{Environment.NewLine}<{_ReportFullPath}>");
}
internal static string GetParentParent(string value)
{
string result = Path.GetDirectoryName(Path.GetDirectoryName(value));
return result;
}
internal static List<string> GetDirectoryNames(string directory)
{
#nullable enable
List<string> results = new();
string? fileName;
string? checkDirectory = directory;
string? pathRoot = Path.GetPathRoot(directory);
string extension = Path.GetExtension(directory);
if (string.IsNullOrEmpty(pathRoot))
throw new NullReferenceException(nameof(pathRoot));
if (Directory.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
else if ((string.IsNullOrEmpty(extension) || extension.Length > 3) && !File.Exists(directory))
{
fileName = Path.GetFileName(directory);
if (!string.IsNullOrEmpty(fileName))
results.Add(fileName);
}
for (int i = 0; i < int.MaxValue; i++)
{
checkDirectory = Path.GetDirectoryName(checkDirectory);
if (string.IsNullOrEmpty(checkDirectory) || checkDirectory == pathRoot)
break;
fileName = Path.GetFileName(checkDirectory);
if (string.IsNullOrEmpty(fileName))
continue;
results.Add(fileName);
}
results.Add(pathRoot);
results.Reverse();
return results;
#nullable disable
}
internal static string GetJobIdParentDirectory(string directory)
{
string result;
if (!string.IsNullOrEmpty(Path.GetFileName(directory)))
result = Path.GetFullPath(GetParentParent(directory));
else
result = Path.GetFullPath(GetParentParent(Path.GetDirectoryName(directory)));
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
return result;
}
internal static string GetFileNameAfterUnderscoreSplit(string reportFullPath)
{
string result;
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
if (segments.Length <= 2)
result = segments[0];
else
result = string.Concat(segments[0], segments[2]);
return result;
}
internal string[] GetInProcessDirectory(string jobIdDirectory)
{
List<string> results = new();
if (!_IsEAFHosted)
results = new string[] { jobIdDirectory }.ToList();
else
{
string[] files;
string logisticsSequence = _Logistics.Sequence.ToString();
string[] directories = Directory.GetDirectories(jobIdDirectory, $"*{logisticsSequence}*", SearchOption.TopDirectoryOnly);
foreach (string directory in directories)
{
files = Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly);
if (files.Length == 0)
continue;
results.Add(directory);
}
}
if ((results is null) || results.Count != 1)
throw new Exception("Didn't find directory by logistics sequence");
return results.ToArray();
}
protected static string[] GetMatches(FileConnectorConfiguration fileConnectorConfiguration)
{
string[] segments;
string[] results = null;
foreach (string subSourceFileFilter in fileConnectorConfiguration.SourceFileFilters)
{
segments = subSourceFileFilter.Split('\\');
if (fileConnectorConfiguration.IncludeSubDirectories.Value)
results = Directory.GetFiles(fileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories);
else
results = Directory.GetFiles(fileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly);
if (results.Length != 0)
break;
}
return results;
}
protected static void NestExistingFiles(FileConnectorConfiguration fileConnectorConfiguration)
{
// if (!fileConnectorConfiguration.IncludeSubDirectories.Value && fileConnectorConfiguration.TriggerOnCreated is not null && fileConnectorConfiguration.TriggerOnCreated.Value)
if (!fileConnectorConfiguration.IncludeSubDirectories.Value)
{
string[] matches = GetMatches(fileConnectorConfiguration);
if (matches is not null && matches.Length > 0)
{
string fileName;
string nestedDirectory = Path.Combine(fileConnectorConfiguration.SourceFileLocation, DateTime.Now.Ticks.ToString());
if (!Directory.Exists(nestedDirectory))
_ = Directory.CreateDirectory(nestedDirectory);
foreach (string match in matches)
{
fileName = Path.GetFileName(match);
File.Move(match, Path.Combine(nestedDirectory, fileName));
}
}
}
}
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
{
List<Properties.IDescription> results = new();
Duplicator.Description description;
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{
if (jsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions);
results.Add(description);
}
return results;
}
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix) protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
{ {
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray(); ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
if (!results.Any()) if (results.Length == 0)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
return results; return results;
} }
@ -171,17 +462,43 @@ public class FileRead : Properties.IFileRead
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix) protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
{ {
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray(); ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
if (!results.Any()) if (results.Length == 0)
throw new Exception(cellInstanceConnectionName); throw new Exception(cellInstanceConnectionName);
return results; return results;
} }
protected void UpdateLastTicksDuration(long ticksDuration) protected void SetFileParameter(string key, string value)
{ {
if (ticksDuration < 50000000) 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, "%")))
ticksDuration = 50000000; {
_LastTicksDuration = (long)Math.Ceiling(ticksDuration * .667); if (_FileParameter.ContainsKey(key))
_Log.Info($"{new TimeSpan(ticksDuration).TotalMilliseconds} TotalMillisecond(s) to process{Environment.NewLine}{_CellInstanceConnectionName}{Environment.NewLine}<{_ReportFullPath}>"); _FileParameter[key] = value;
else
_FileParameter.Add(key, value);
}
}
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{
string directory;
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
directory = Path.Combine(_TracePath, _EquipmentType, "Target", weekDirectory, day, _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", weekDirectory, day, _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 WaitForThread(Thread thread, List<Exception> threadExceptions) protected void WaitForThread(Thread thread, List<Exception> threadExceptions)
@ -203,7 +520,7 @@ public class FileRead : Properties.IFileRead
} }
lock (threadExceptions) lock (threadExceptions)
{ {
if (threadExceptions.Any()) if (threadExceptions.Count != 0)
{ {
foreach (Exception item in threadExceptions) foreach (Exception item in threadExceptions)
_Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace)); _Log.Error(string.Concat(item.Message, Environment.NewLine, Environment.NewLine, item.StackTrace));
@ -215,212 +532,6 @@ public class FileRead : Properties.IFileRead
} }
} }
private void WriteAllLines(string to, string[] exceptionLines)
{
string fileName = string.Concat(to, @"\readme.txt");
try
{
if (!Directory.Exists(to))
_ = Directory.CreateDirectory(to);
File.WriteAllLines(fileName, exceptionLines);
}
catch (Exception ex) { _Log.Error(ex.Message); }
}
protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results;
bool isErrorFile = exception is not null;
if (!to.EndsWith(@"\"))
_ = string.Concat(to, @"\");
if (!isErrorFile)
results = Array.Empty<string>();
else
{
results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
if (!_IsDuplicator)
WriteAllLines(to, results);
}
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any())
{
string itemFile;
List<string> directories = new();
foreach (FileInfo sourceFile in extractResults.Item4)
{
if (sourceFile.FullName != _Logistics.ReportFullPath)
{
itemFile = sourceFile.FullName.Replace(from, to);
Shared1880(itemFile, directories, sourceFile, isErrorFile);
}
else if (!isErrorFile && _Logistics is not null)
Shared1811(to, sourceFile);
}
Shared0231(directories);
}
return results;
}
protected static string GetTupleFile<T>(Logistics logistics, List<T> descriptions, Properties.IScopeInfo scopeInfo, string duplicateDirectory) where T : Properties.IDescription
{
string result;
string rds;
string dateValue;
string rdsPlaceholder = "%RDS%";
if (!descriptions.Any() || string.IsNullOrEmpty(descriptions[0].RDS))
rds = logistics.MID;
else
rds = descriptions[0].RDS;
string[] segments = scopeInfo.FileName.Split(new string[] { "DateTime:" }, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length == 0)
result = string.Concat(duplicateDirectory, @"\", scopeInfo.FileNameWithoutExtension.Replace(rdsPlaceholder, rds));
else
{
segments = segments[1].Split('%');
string datePlaceholder = "%DateTime%";
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(rdsPlaceholder, rds).Replace(datePlaceholder, dateValue));
}
if (result.Contains('%'))
throw new Exception("Placeholder exists!");
return result;
}
protected void WaitForFileConsumption<T>(string sourceDirectoryCloaking, Logistics logistics, DateTime dateTime, List<T> descriptions, string successDirectory, string duplicateDirectory, string duplicateFile, List<(Properties.IScopeInfo, string)> collection) where T : Properties.IDescription
{
bool check;
long preWait;
string tupleFile;
List<string> duplicateFiles = new();
StringBuilder stringBuilder = new();
List<int> consumedFileIndices = new();
bool moreThanAnHour = _BreakAfterSeconds > 3600;
long breakAfter = dateTime.AddSeconds(_BreakAfterSeconds).Ticks;
if (_FileConnectorConfiguration?.FileHandleWaitTime is null)
preWait = dateTime.AddMilliseconds(1234).Ticks;
else
preWait = dateTime.AddMilliseconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks;
if (!collection.Any())
duplicateFiles.Add(duplicateFile);
string fileName = Path.GetFileNameWithoutExtension(logistics.ReportFullPath);
string successFile = string.Concat(successDirectory, @"\", Path.GetFileName(logistics.ReportFullPath));
foreach ((Properties.IScopeInfo scopeInfo, string text) in collection)
{
if (scopeInfo.FileName.StartsWith(@"\"))
tupleFile = scopeInfo.FileName;
else if (!scopeInfo.FileName.Contains('%'))
tupleFile = string.Concat(duplicateDirectory, @"\", fileName, "_", scopeInfo.FileNameWithoutExtension, ".pdsfc");
else
tupleFile = GetTupleFile(logistics, descriptions, scopeInfo, duplicateDirectory);
duplicateFiles.Add(tupleFile);
if (_IsEAFHosted)
File.WriteAllText(tupleFile, text);
}
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > preWait)
break;
Thread.Sleep(500);
}
if (!moreThanAnHour)
{
for (short z = 0; z < short.MaxValue; z++)
{
try
{
check = string.IsNullOrEmpty(successDirectory) || File.Exists(successFile);
if (check)
{
consumedFileIndices.Clear();
for (int i = 0; i < duplicateFiles.Count; i++)
{
if (!File.Exists(duplicateFiles[i]))
consumedFileIndices.Add(i);
}
if (consumedFileIndices.Count == duplicateFiles.Count)
break;
}
}
catch (Exception) { }
if (DateTime.Now.Ticks > breakAfter)
{
for (int i = 0; i < duplicateFiles.Count; i++)
{
if (File.Exists(duplicateFiles[i]))
{
try
{ File.Delete(duplicateFiles[i]); }
catch (Exception) { }
_ = stringBuilder.Append('<').Append(duplicateFiles[i]).Append("> ");
}
}
throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder));
}
Thread.Sleep(500);
}
}
}
protected void SetFileParameter(string key, string value)
{
if (_FileConnectorConfiguration is null || _FileConnectorConfiguration.TargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.TargetFileName.Contains(string.Concat("%", key, "%")) || _FileConnectorConfiguration.ErrorTargetFileName.Contains(string.Concat("%", key, "%")))
{
if (_FileParameter.ContainsKey(key))
_FileParameter[key] = value;
else
_FileParameter.Add(key, value);
}
}
protected void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true)
{
string key;
if (!includeLogisticsSequence)
key = "LotID";
else
key = "LotIDWithLogisticsSequence";
string value = string.Concat(_Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
SetFileParameter(key, value);
}
protected void SetFileParameterLotID(string value, bool includeLogisticsSequence = true)
{
string key;
if (!includeLogisticsSequence)
key = "LotID";
else
{
key = "LotIDWithLogisticsSequence";
value = string.Concat(value, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
}
SetFileParameter(key, value);
}
protected void WritePDSF(IFileRead fileRead, JsonElement[] jsonElements)
{
string directory;
if (!_CellInstanceConnectionName.StartsWith(_CellInstanceName) && _CellInstanceConnectionNameBase == _EquipmentType)
directory = Path.Combine(_TracePath, _EquipmentType, "Target", _CellInstanceName, _CellInstanceConnectionName);
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
if (_Logistics.TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
try
{ File.SetLastWriteTime(file, _Logistics.DateTimeFromSequence); }
catch (Exception) { }
}
}
protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults) protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults)
{ {
if (!_IsEAFHosted) if (!_IsEAFHosted)
@ -439,80 +550,49 @@ public class FileRead : Properties.IFileRead
} }
} }
protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs) protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{ {
object value; string[] results;
string description; bool isErrorFile = exception is not null;
List<object[]> list; if (!to.EndsWith(@"\"))
for (int i = 0; i < extractResults.Item3.Length; i++) _ = string.Concat(to, @"\");
{ if (!isErrorFile)
_Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); results = Array.Empty<string>();
foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
value = jsonProperty.Value.ToString();
else
{
list = new List<object[]>();
for (int z = 0; z < extractResults.Item3.Length; z++)
list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() });
value = list;
}
}
if (_UseCyclicalForDescription)
break;
}
}
protected Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation))
results = null;
else else
{ {
string[] segments; results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
string[] matches = null; if (!_IsDuplicator)
foreach (string subSourceFileFilter in _FileConnectorConfiguration.SourceFileFilters) WriteAllLines(to, results);
}
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Count != 0)
{
string itemFile;
List<string> directories = new();
foreach (FileInfo sourceFile in extractResults.Item4)
{ {
segments = subSourceFileFilter.Split('\\'); if (sourceFile.FullName != _Logistics.ReportFullPath)
if (_FileConnectorConfiguration.IncludeSubDirectories.Value) {
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.AllDirectories); itemFile = sourceFile.FullName.Replace(from, to);
else Shared1880(itemFile, directories, sourceFile, isErrorFile);
matches = Directory.GetFiles(_FileConnectorConfiguration.SourceFileLocation, segments.Last(), SearchOption.TopDirectoryOnly); }
if (matches.Any()) else if (!isErrorFile && _Logistics is not null)
break; Shared1811(to, sourceFile);
}
if (matches is null || !matches.Any())
results = null;
else
{
_ReportFullPath = matches[0];
results = fileRead.GetExtractResult(_ReportFullPath, _EventName);
if (!_IsEAFHosted)
TriggerEvents(results, headerNames, keyValuePairs);
} }
Shared0231(directories);
} }
return results; return results;
} }
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements) private void WriteAllLines(string to, string[] exceptionLines)
{ {
List<Properties.IDescription> results = new(); string fileName = string.Concat(to, @"\readme.txt");
Duplicator.Description description; try
JsonSerializerOptions jsonSerializerOptions = new() { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
foreach (JsonElement jsonElement in jsonElements)
{ {
if (jsonElement.ValueKind != JsonValueKind.Object) if (!Directory.Exists(to))
throw new Exception(); _ = Directory.CreateDirectory(to);
description = JsonSerializer.Deserialize<Duplicator.Description>(jsonElement.ToString(), jsonSerializerOptions); File.WriteAllLines(fileName, exceptionLines);
results.Add(description);
} }
return results; catch (Exception ex) { _Log.Error(ex.Message); }
} }
private void Shared1880(string itemFile, List<string> directories, FileInfo sourceFile, bool isErrorFile) private void Shared1880(string itemFile, List<string> directories, FileInfo sourceFile, bool isErrorFile)
@ -544,6 +624,9 @@ public class FileRead : Properties.IFileRead
case FileConnectorConfiguration.PostProcessingModeEnum.Delete: case FileConnectorConfiguration.PostProcessingModeEnum.Delete:
File.Delete(sourceFile.FullName); File.Delete(sourceFile.FullName);
break; break;
case FileConnectorConfiguration.PostProcessingModeEnum.None:
File.Move(sourceFile.FullName, itemFile);
break;
default: default:
throw new Exception(); throw new Exception();
} }
@ -555,11 +638,12 @@ public class FileRead : Properties.IFileRead
if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength) if (!_IsDuplicator && _FileConnectorConfiguration.SourceFileFilter != "*" && sourceFile.Exists && sourceFile.Length < _MinFileLength)
{ {
string directoryName = Path.GetFileName(to); string directoryName = Path.GetFileName(to);
string jobIdDirectory = Path.GetDirectoryName(to); string jobIdDirectory = GetJobIdDirectory(to);
DateTime dateTime = DateTime.Now.AddMinutes(-15); DateTime dateTime = DateTime.Now.AddMinutes(-15);
string day = $"{_Logistics.DateTimeFromSequence:yyyy-MM-dd}";
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00"); string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}{@"\"}{_Logistics.DateTimeFromSequence:yyyy-MM-dd}"; string weekDirectory = $"{_Logistics.DateTimeFromSequence:yyyy}_Week_{weekOfYear}";
string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName); string destinationDirectory = Path.Combine(jobIdDirectory, "_ Ignore 100 bytes", weekDirectory, day, directoryName);
if (!Directory.Exists(destinationDirectory)) if (!Directory.Exists(destinationDirectory))
_ = Directory.CreateDirectory(destinationDirectory); _ = Directory.CreateDirectory(destinationDirectory);
File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name)); File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name));
@ -570,13 +654,13 @@ public class FileRead : Properties.IFileRead
{ {
if (!checkDirectory.Contains('_')) if (!checkDirectory.Contains('_'))
continue; continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Length != 0)
continue; continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any()) if (Directory.GetFiles(checkDirectory, "*", SearchOption.TopDirectoryOnly).Length != 0)
continue; continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Any()) if (Directory.GetDirectories(checkDirectory, "*", SearchOption.AllDirectories).Length != 0)
continue; continue;
if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Any()) if (Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories).Length != 0)
continue; continue;
if (new DirectoryInfo(checkDirectory).CreationTime > dateTime) if (new DirectoryInfo(checkDirectory).CreationTime > dateTime)
continue; continue;
@ -584,6 +668,52 @@ public class FileRead : Properties.IFileRead
} }
} }
catch (Exception) { throw; } catch (Exception) { throw; }
DeleteEmptyTopDirectories(jobIdDirectory);
}
}
private string GetJobIdDirectory(string path)
{
string result;
List<string> directoryNames = GetDirectoryNames(path);
if (!directoryNames.Contains(_Logistics.JobID))
result = Path.GetDirectoryName(path);
else
{
result = string.Empty;
foreach (string directoryName in directoryNames)
{
result = Path.Combine(result, directoryName);
if (directoryName == _Logistics.JobID)
break;
}
}
return result;
}
private static void DeleteEmptyTopDirectories(string rootDirectory)
{
if (Directory.Exists(rootDirectory))
{
string[] files;
string[] directories;
string[] subDirectories = Directory.GetDirectories(rootDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string subDirectory in subDirectories)
{
files = Directory.GetFiles(subDirectory, "*", SearchOption.AllDirectories);
if (files.Length > 0)
continue;
directories = Directory.GetDirectories(subDirectory, "*", SearchOption.TopDirectoryOnly);
if (directories.Length > 0)
continue;
try
{ Directory.Delete(subDirectory); }
catch (UnauthorizedAccessException)
{
new DirectoryInfo(subDirectory).Attributes = FileAttributes.Normal;
Directory.Delete(subDirectory);
}
}
} }
} }
@ -593,72 +723,87 @@ public class FileRead : Properties.IFileRead
{ {
foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct()) foreach (string directory in (from l in directories orderby l.Split('\\').Length descending select l).Distinct())
{ {
if (Directory.Exists(directory) && !Directory.GetFiles(directory).Any()) if (Directory.Exists(directory) && Directory.GetFiles(directory).Length == 0)
Directory.Delete(directory); Directory.Delete(directory);
} }
} }
} }
protected void WaitForFileConsumption<T>(DateTime dateTime, List<T> descriptions, bool isDummyRun, string successDirectory, string duplicateDirectory, List<(Properties.IScopeInfo, string)> collection, string duplicateFile) where T : Properties.IDescription protected void SetFileParameterLotID(string value, bool includeLogisticsSequence = true)
{ {
if (!isDummyRun && _IsEAFHosted) string key;
WaitForFileConsumption(_FileConnectorConfiguration.SourceDirectoryCloaking, _Logistics, dateTime, descriptions, successDirectory, duplicateDirectory, duplicateFile, collection); if (!includeLogisticsSequence)
key = "LotID";
else else
{ {
long breakAfter = DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileHandleWaitTime.Value).Ticks; key = "LotIDWithLogisticsSequence";
for (short i = 0; i < short.MaxValue; i++) value = string.Concat(value, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
}
SetFileParameter(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 Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(IFileRead fileRead, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (!Directory.Exists(_FileConnectorConfiguration.SourceFileLocation))
results = null;
else
{
string[] matches = GetMatches(_FileConnectorConfiguration);
if (matches is null || matches.Length == 0)
results = null;
else
{ {
if (!_IsEAFHosted || DateTime.Now.Ticks > breakAfter) _ReportFullPath = matches[0];
break; results = fileRead.GetExtractResult(_ReportFullPath, _EventName);
Thread.Sleep(500); if (!_IsEAFHosted)
TriggerEvents(results, headerNames, keyValuePairs);
} }
} }
}
internal static string GetJobIdParentDirectory(string directory)
{
string result;
if (!string.IsNullOrEmpty(Path.GetFileName(directory)))
result = Path.GetFullPath(GetParentParent(directory));
else
result = Path.GetFullPath(GetParentParent(Path.GetDirectoryName(directory)));
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
return result;
}
internal string[] GetInProcessDirectory(string jobIdDirectory)
{
string[] results;
if (!_IsEAFHosted)
results = new string[] { jobIdDirectory };
else
{
string logisticsSequence = _Logistics.Sequence.ToString();
results = Directory.GetDirectories(jobIdDirectory, string.Concat(_Logistics.MID, '*', logisticsSequence, '*'), SearchOption.TopDirectoryOnly);
}
if ((results is null) || results.Length != 1)
throw new Exception("Didn't find directory by logistics sequence");
return results; return results;
} }
internal static string GetFileNameAfterUnderscoreSplit(string reportFullPath) protected void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, List<string> headerNames, Dictionary<string, string> keyValuePairs)
{ {
string result; object value;
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_'); string segments;
if (segments.Length <= 2) string description;
result = segments[0]; List<object[]> list;
else for (int i = 0; i < extractResults.Item3.Length; i++)
result = string.Concat(segments[0], segments[2]); {
return result; _Log.Debug(string.Concat("TriggerEvent - {", _Logistics.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
} foreach (JsonProperty jsonProperty in extractResults.Item3[i].EnumerateObject())
{
internal static string GetParentParent(string value) if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.TryGetValue(jsonProperty.Name, out segments))
{ description = string.Empty;
string result = Path.GetDirectoryName(Path.GetDirectoryName(value)); else
return result; description = segments.Split('|')[0];
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperty.Name))
value = jsonProperty.Value.ToString();
else
{
list = new List<object[]>();
for (int z = 0; z < extractResults.Item3.Length; z++)
list.Add(new object[] { z, extractResults.Item3[z].GetProperty(jsonProperty.Name).ToString() });
value = list;
}
}
if (_UseCyclicalForDescription)
break;
}
} }
} }
// 2022-06-08 -> Shared - FileRead // 2025-03-25 -> Shared - FileRead

View File

@ -35,6 +35,9 @@ public class Logistics : ILogistics
public long Sequence => _Sequence; public long Sequence => _Sequence;
public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence; public double TotalSecondsSinceLastWriteTimeFromSequence => _TotalSecondsSinceLastWriteTimeFromSequence;
private static string DefaultMesEntity(DateTime dateTime) =>
string.Concat(dateTime.Ticks, "_MES_ENTITY");
public Logistics(IFileRead fileRead) public Logistics(IFileRead fileRead)
{ {
DateTime dateTime = DateTime.Now; DateTime dateTime = DateTime.Now;
@ -51,7 +54,7 @@ public class Logistics : ILogistics
_Logistics2 = new List<Logistics2>(); _Logistics2 = new List<Logistics2>();
} }
public Logistics(IFileRead fileRead, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null) public Logistics(IFileRead fileRead, long tickOffset, string reportFullPath, bool useSplitForMID, int? fileInfoLength = null)
{ {
if (string.IsNullOrEmpty(fileRead.CellInstanceName)) if (string.IsNullOrEmpty(fileRead.CellInstanceName))
throw new Exception(); throw new Exception();
@ -59,7 +62,7 @@ public class Logistics : ILogistics
throw new Exception(); throw new Exception();
_NullData = fileRead.NullData; _NullData = fileRead.NullData;
_FileInfo = new(reportFullPath); _FileInfo = new(reportFullPath);
DateTime dateTime = _FileInfo.LastWriteTime; DateTime dateTime = new(_FileInfo.LastWriteTime.Ticks + tickOffset);
if (fileInfoLength.HasValue && _FileInfo.Length < fileInfoLength.Value) if (fileInfoLength.HasValue && _FileInfo.Length < fileInfoLength.Value)
dateTime = dateTime.AddTicks(-1); dateTime = dateTime.AddTicks(-1);
_JobID = fileRead.CellInstanceName; _JobID = fileRead.CellInstanceName;
@ -84,14 +87,14 @@ public class Logistics : ILogistics
_Logistics2 = new List<Logistics2>(); _Logistics2 = new List<Logistics2>();
} }
public Logistics(string reportFullPath, string logistics) internal Logistics(string reportFullPath, ProcessDataStandardFormat processDataStandardFormat)
{ {
string key; string key;
DateTime dateTime; DateTime dateTime;
string[] segments; string[] segments;
_FileInfo = new(reportFullPath); _FileInfo = new(reportFullPath);
_Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); _Logistics1 = processDataStandardFormat.Logistics.ToList();
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1")) if (Logistics1.Count == 0 || !Logistics1[0].StartsWith("LOGISTICS_1"))
{ {
_NullData = null; _NullData = null;
_JobID = "null"; _JobID = "null";
@ -190,8 +193,6 @@ public class Logistics : ILogistics
} }
} }
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal void Update(string mid, string processJobID) internal void Update(string mid, string processJobID)
{ {
_MID = mid; _MID = mid;

View File

@ -16,7 +16,7 @@ public class ScopeInfo : Properties.IScopeInfo
public string QueryFilter { get; private set; } public string QueryFilter { get; private set; }
public string FileNameWithoutExtension { get; private set; } public string FileNameWithoutExtension { get; private set; }
public ScopeInfo(Test test, string fileName, string queryFilter = "", string title = "", string html = "") public ScopeInfo(Test test, string fileName, string queryFilter = "", string title = "", string html = "", string extraExtension = "")
{ {
Enum = test; Enum = test;
Test = test; Test = test;

View File

@ -2,18 +2,29 @@
public partial class WS public partial class WS
{ {
public class Attachment public class Attachment
{ {
public string UniqueId { get; set; } #nullable enable
public string DestinationFileName { get; set; }
public string SourceFileName { get; set; }
public Attachment(string uniqueId, string destinationFileName, string sourceFileName) public long HeaderId { get; set; }
public string UniqueId { get; set; }
public string SubGroupId { get; set; }
public string AttachmentId { get; set; }
public string SourceFileName { get; set; }
public string HeaderIdDirectory { get; set; }
public string DestinationFileName { get; set; }
public Attachment(Results? results, string headerIdDirectory, string uniqueId, string destinationFileName, string sourceFileName)
{ {
UniqueId = uniqueId; UniqueId = uniqueId;
DestinationFileName = destinationFileName;
SourceFileName = sourceFileName; SourceFileName = sourceFileName;
HeaderIdDirectory = headerIdDirectory;
DestinationFileName = destinationFileName;
AttachmentId = System.Guid.NewGuid().ToString();
HeaderId = results?.HeaderId is null ? -1 : results.HeaderId.Value;
SubGroupId = results?.SubgroupId is null ? string.Empty : results.SubgroupId.Value.ToString();
} }
} }

View File

@ -1,27 +1,75 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization;
namespace Adaptation.Shared.Metrology; namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
// this class represents the response from the Inbound API endpoint
public class Results 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 #nullable enable
public long HeaderID { get; set; }
// if false, this collection will contain a list of errors [JsonConstructor]
public List<string> Errors { get; set; } public Results(List<string>? errors,
long? headerId,
long? subgroupId,
bool? success,
List<string>? warnings)
{
Errors = errors;
Success = success;
HeaderId = headerId;
Warnings = warnings;
SubgroupId = subgroupId;
}
// this collection will contain a list of warnings, they will not prevent data from being saved [JsonPropertyName("errors")] public List<string>? Errors { get; set; }
public List<string> Warnings { get; set; } [JsonPropertyName("headerID")] public long? HeaderId { get; set; }
[JsonPropertyName("subgroupId")] public long? SubgroupId { get; set; }
[JsonPropertyName("success")] public bool? Success { get; set; }
[JsonPropertyName("warnings")] public List<string>? Warnings { get; set; }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, ResultsSourceGenerationContext.Default.Results);
return result;
}
internal static Results Get(Results results, long? subgroupId) =>
new(results.Errors, results.HeaderId, subgroupId, results.Success, results.Warnings);
internal static Results Get(string resultsJson, Exception e)
{
Results results;
Exception? exception = e;
List<string> errors = new();
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
errors.Add(resultsJson);
errors.Add(stringBuilder.ToString());
results = new(errors: errors,
headerId: null,
subgroupId: null,
success: false,
warnings: new());
return results;
}
// this is just a helper function to make displaying the results easier
public override string ToString() => JsonSerializer.Serialize(this, GetType());
} }
}
[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(WS.Results))]
internal partial class ResultsSourceGenerationContext : JsonSerializerContext
{
} }

View File

@ -10,9 +10,11 @@ namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
public static (string, Results) SendData(string url, object payload, int timeoutSeconds = 120) #nullable enable
public static (string, Results) SendData(string url, long sequence, string directory, object payload, int timeoutSeconds = 120)
{ {
Results results = new(); Results? wsResults = null;
string resultsJson = string.Empty; string resultsJson = string.Empty;
try try
{ {
@ -30,84 +32,83 @@ public partial class WS
}; };
HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result; HttpResponseMessage httpResponseMessage = httpClient.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRead).Result;
resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result; resultsJson = httpResponseMessage.Content.ReadAsStringAsync().Result;
results = JsonSerializer.Deserialize<Results>(resultsJson); wsResults = JsonSerializer.Deserialize(resultsJson, ResultsSourceGenerationContext.Default.Results);
if (wsResults is null)
throw new NullReferenceException(nameof(wsResults));
string checkDirectory = Path.Combine(directory, $"-{wsResults.HeaderId}");
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
File.WriteAllText(Path.Combine(checkDirectory, $"{sequence}.json"), json);
} }
if (!results.Success) if (wsResults.Success is null || !wsResults.Success.Value)
results.Errors.Add(results.ToString()); wsResults.Errors?.Add(wsResults.ToString());
} }
catch (Exception e) catch (Exception e)
{ { wsResults ??= Results.Get(resultsJson, e); }
Exception exception = e; return new(resultsJson, wsResults);
StringBuilder stringBuilder = new();
while (exception is not null)
{
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
results.Errors ??= new List<string>();
results.Errors.Add(stringBuilder.ToString());
}
return new(resultsJson, results);
} }
// this method is a wrapper for attaching a file to either a header or data record public static void AttachFile(string url, Attachment attachment, int timeoutSeconds = 60)
// 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(); using HttpClient httpClient = new();
string requestUrl = url + "/attachment?headerid=" + attachToHeaderId.ToString(); string json = JsonSerializer.Serialize(attachment);
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); httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
StringContent httpContent = new(json, Encoding.UTF8, "application/json");
MultipartFormDataContent multipartFormDataContent = new(); HttpResponseMessage httpResponseMessage = httpClient.PostAsync($"{url}/attachment", httpContent).Result;
ByteArrayContent byteArrayContent = new(fileContents); if (!httpResponseMessage.IsSuccessStatusCode)
byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); {
string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
multipartFormDataContent.Add(byteArrayContent, "attachment", fileName); throw new Exception($"Attachment failed: {resultBody}");
}
HttpResponseMessage httpResponseMessage = httpClient.PostAsync(requestUrl, multipartFormDataContent).Result;
if (httpResponseMessage.IsSuccessStatusCode)
return;
string resultBody = httpResponseMessage.Content.ReadAsStringAsync().Result;
throw new Exception("Attachment failed: " + resultBody);
} }
public static void AttachFiles(string url, long headerID, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null) public static void AttachFiles(string url, List<Attachment>? headerAttachments = null, List<Attachment>? dataAttachments = null)
{ {
string directory;
try try
{ {
string? directoryName;
if (headerAttachments is not null) if (headerAttachments is not null)
{ {
foreach (Attachment attachment in headerAttachments) foreach (Attachment attachment in headerAttachments)
AttachFile(url, headerID, "", File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); {
directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory);
if (string.IsNullOrEmpty(directoryName))
continue;
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
}
} }
if (dataAttachments is not null) if (dataAttachments is not null)
{ {
foreach (Attachment attachment in dataAttachments) foreach (Attachment attachment in dataAttachments)
AttachFile(url, headerID, attachment.UniqueId, File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName); {
directoryName = Path.GetDirectoryName(attachment.HeaderIdDirectory.Replace("Header", "Data"));
if (string.IsNullOrEmpty(directoryName))
continue;
directory = Path.Combine(directoryName, attachment.AttachmentId) ?? throw new Exception();
if (!Directory.Exists(directory))
_ = Directory.CreateDirectory(directory);
File.Copy(attachment.SourceFileName, Path.Combine(directory, attachment.DestinationFileName), overwrite: true);
}
}
if (headerAttachments is not null)
{
foreach (Attachment attachment in headerAttachments)
AttachFile(url, attachment);
}
if (dataAttachments is not null)
{
foreach (Attachment attachment in dataAttachments)
AttachFile(url, attachment);
} }
//MessageBox.Show(r.ToString()); //MessageBox.Show(r.ToString());
} }
catch (Exception e) catch (Exception e)
{ {
Exception exception = e; Exception? exception = e;
StringBuilder stringBuilder = new(); StringBuilder stringBuilder = new();
while (exception is not null) while (exception is not null)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
using System.Collections.ObjectModel;
namespace Adaptation.Shared;
public class ProcessDataStandardFormatMapping
{
public ReadOnlyCollection<string> BackfillColumns { get; private set; }
public ReadOnlyCollection<int> ColumnIndices { get; private set; }
public ReadOnlyCollection<string> IgnoreColumns { get; private set; }
public ReadOnlyCollection<string> IndexOnlyColumns { get; private set; }
public ReadOnlyDictionary<string, string> KeyValuePairs { get; private set; }
public ReadOnlyCollection<string> NewColumnNames { get; private set; }
public ReadOnlyCollection<string> OldColumnNames { get; private set; }
public ProcessDataStandardFormatMapping(ReadOnlyCollection<string> backfillColumns,
ReadOnlyCollection<int> columnIndices,
ReadOnlyCollection<string> ignoreColumns,
ReadOnlyCollection<string> indexOnlyColumns,
ReadOnlyDictionary<string, string> keyValuePairs,
ReadOnlyCollection<string> newColumnNames,
ReadOnlyCollection<string> oldColumnNames)
{
BackfillColumns = backfillColumns;
ColumnIndices = columnIndices;
IgnoreColumns = ignoreColumns;
IndexOnlyColumns = indexOnlyColumns;
KeyValuePairs = keyValuePairs;
NewColumnNames = newColumnNames;
OldColumnNames = oldColumnNames;
}
}

View File

@ -21,7 +21,7 @@ public enum Test
Denton = 9, Denton = 9,
DiffusionLength = 45, DiffusionLength = 45,
GRATXTCenter = 51, GRATXTCenter = 51,
GRATXTEdge = 52, //Largest GRATXTEdge = 52,
GrowthRateXML = 50, GrowthRateXML = 50,
Hall = 10, Hall = 10,
HgCV = 23, HgCV = 23,
@ -38,6 +38,7 @@ public enum Test
RPMPLRatio = 17, RPMPLRatio = 17,
RPMXY = 15, RPMXY = 15,
SP1 = 8, SP1 = 8,
SRP2100 = 53, //Largest
Tencor = 7, Tencor = 7,
UV = 35, UV = 35,
VerificationLehighton = 14, VerificationLehighton = 14,

View File

@ -0,0 +1,49 @@
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
namespace Adaptation._Tests.CreateSelfDescription.Production.v2_59_0;
[TestClass]
public class EC : EAFLoggingUnitTesting
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static string DummyRoot { get; private set; }
internal static EC EAFLoggingUnitTesting { get; private set; }
static EC() => DummyRoot = @"\\mesfs.infineon.com\EC_Characterization_Si\Dummy";
public EC() : base(DummyRoot, testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public EC(TestContext testContext) : base(DummyRoot, testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
EAFLoggingUnitTesting ??= new EC(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()
{
EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose();
}
}

View File

@ -40,7 +40,7 @@ public class EC : EAFLoggingUnitTesting
[ClassCleanup()] [ClassCleanup()]
public static void ClassCleanup() public static void ClassCleanup()
{ {
EAFLoggingUnitTesting.Logger?.LogInformation("Cleanup"); EAFLoggingUnitTesting?.Logger?.LogInformation("Cleanup");
EAFLoggingUnitTesting?.Dispose(); EAFLoggingUnitTesting?.Dispose();
} }

View File

@ -0,0 +1,21 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Adaptation._Tests.Extract.Production.v2_59_0;
[TestClass]
public class EC
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Production.v2_59_0.EC _EC;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Production.v2_59_0.EC.ClassInitialize(testContext);
_EC = CreateSelfDescription.Production.v2_59_0.EC.EAFLoggingUnitTesting;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@ public class LoggingUnitTesting : UnitTesting, IDisposable
base(testContext, declaringType) base(testContext, declaringType)
{ {
_LoggerFactory = new LoggerFactory(); _LoggerFactory = new LoggerFactory();
if (testContext is null || declaringType is null) if (testContext is null || declaringType is null || _IsEnvironment is null)
{ {
_ConfigurationRoot = null; _ConfigurationRoot = null;
_DefaultLogLevel = null; _DefaultLogLevel = null;

View File

@ -29,40 +29,45 @@ public class UnitTesting
{ {
string waitFor = "\"WaitFor\":"; string waitFor = "\"WaitFor\":";
string projectDirectory = GetProjectDirectory(testContext); string projectDirectory = GetProjectDirectory(testContext);
_TestContextPropertiesAsJson = JsonSerializer.Serialize(testContext.Properties, new JsonSerializerOptions { WriteIndented = true }); if (string.IsNullOrEmpty(projectDirectory))
_HasWaitForProperty = _TestContextPropertiesAsJson.Contains(waitFor); _IsEnvironment = null;
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode"); else
if (!Directory.Exists(vsCodeDirectory))
_ = Directory.CreateDirectory(vsCodeDirectory);
string launchText = GetLaunchText();
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
if (_HasWaitForProperty)
{ {
for (int i = 0; i < int.MaxValue; i++) _TestContextPropertiesAsJson = JsonSerializer.Serialize(testContext.Properties, new JsonSerializerOptions { WriteIndented = true });
_HasWaitForProperty = _TestContextPropertiesAsJson.Contains(waitFor);
string vsCodeDirectory = Path.Combine(projectDirectory, ".vscode");
if (!Directory.Exists(vsCodeDirectory))
_ = Directory.CreateDirectory(vsCodeDirectory);
string launchText = GetLaunchText();
File.WriteAllText(Path.Combine(vsCodeDirectory, "launch.json"), launchText);
if (_HasWaitForProperty)
{ {
if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"Debugger.IsAttached\"") || Debugger.IsAttached) for (int i = 0; i < int.MaxValue; i++)
break; {
Thread.Sleep(500); if (!_TestContextPropertiesAsJson.Contains($"{waitFor} \"Debugger.IsAttached\"") || Debugger.IsAttached)
break;
Thread.Sleep(500);
}
} }
} MethodBase methodBase = declaringType.GetMethod(testContext.TestName);
MethodBase methodBase = declaringType.GetMethod(testContext.TestName); if (methodBase is not null)
if (methodBase is not null)
{
TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
if (testCategoryAttribute is not null)
{ {
foreach (string testCategory in testCategoryAttribute.TestCategories) TestCategoryAttribute testCategoryAttribute = methodBase.GetCustomAttribute<TestCategoryAttribute>();
_IsEnvironment = new IsEnvironment(testCategory); if (testCategoryAttribute is not null)
{
foreach (string testCategory in testCategoryAttribute.TestCategories)
_IsEnvironment = new IsEnvironment(testCategory);
}
} }
_IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
} }
_IsEnvironment ??= new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
} }
} }
internal static string GetProjectDirectory(TestContext testContext) internal static string GetProjectDirectory(TestContext testContext)
{ {
string result; string result;
string[] checkFiles = null; string[] checkFiles;
result = Path.GetDirectoryName(testContext.DeploymentDirectory); result = Path.GetDirectoryName(testContext.DeploymentDirectory);
for (int i = 0; i < int.MaxValue; i++) for (int i = 0; i < int.MaxValue; i++)
{ {
@ -73,8 +78,6 @@ public class UnitTesting
break; break;
result = Path.GetDirectoryName(result); result = Path.GetDirectoryName(result);
} }
if (string.IsNullOrEmpty(result) || checkFiles is null || !checkFiles.Any())
throw new Exception(result);
return result; return result;
} }

View File

@ -0,0 +1,91 @@
using Adaptation._Tests.Shared;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
namespace Adaptation._Tests.Static;
[TestClass]
public class EC : LoggingUnitTesting, IDisposable
{
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static EC LoggingUnitTesting { get; private set; }
public EC() : base(testContext: null, declaringType: null)
{
if (LoggingUnitTesting is null)
throw new Exception();
}
public EC(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext) => LoggingUnitTesting ??= new EC(testContext);
[ClassCleanup()]
public static void ClassCleanup()
{
LoggingUnitTesting?.Logger?.LogInformation("Cleanup");
LoggingUnitTesting?.Dispose();
}
[TestMethod]
public void TestDateTime()
{
DateTime dateTime = DateTime.Now;
Assert.IsTrue(dateTime.ToString("M/d/yyyy h:mm:ss tt") == dateTime.ToString());
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Production()
{
MethodBase methodBase = new StackFrame().GetMethod();
StringBuilder results = new();
(string cellInstanceName, string cellInstanceVersionName)[] collection = new (string, string)[]
{
new("EC", "v2.59.0"),
};
string production = "http://messa08ec.infineon.com:9003/CellInstanceServiceV2";
Shared.PasteSpecialXml.EAF.XML.API.CellInstance.CellInstanceVersion cellInstanceVersion;
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
foreach ((string cellInstanceName, string cellInstanceVersionName) in collection)
{
cellInstanceVersion = AdaptationTesting.GetCellInstanceVersion($"{production}/{cellInstanceName}/{cellInstanceVersionName}/configuration");
_ = results.AppendLine($"{cellInstanceName}\t{cellInstanceVersionName}\t{cellInstanceVersion.EdaConnection.PortNumber}");
}
string sourceDirectory = "D:/Tmp/cellInstanceVersion.EdaConnection.PortNumber";
if (!Directory.Exists(sourceDirectory))
_ = Directory.CreateDirectory(sourceDirectory);
File.WriteAllText(Path.Combine(sourceDirectory, $"{methodBase.Module.Name}-{methodBase.ReflectedType.Name}-{methodBase.Name}.tsv"), results.ToString());
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void CellInstanceVersionEdaConnectionPortNumber()
{
MethodBase methodBase = new StackFrame().GetMethod();
StringBuilder results = new();
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] files = Directory.GetFiles("D:/Tmp", "*.tsv", SearchOption.TopDirectoryOnly);
foreach (string file in files)
_ = results.Append(File.ReadAllText(file));
File.WriteAllText($"D:/Tmp/all.tsv", results.ToString());
LoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -1,14 +1,8 @@
{ {
"scripts": { "scripts": {
"Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "Alpha": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"nuget-clear": "dotnet nuget locals all --clear", "kanbn.board": "kanbn board",
"build": "dotnet build --runtime win-x64 --self-contained", "kanbn.board.json": "kanbn board -j > .kanbn/board.json",
"build-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-nuget-And-Package-Management": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/",
"build-All-Sources": "dotnet build --runtime win-x64 --self-contained --source https://api.nuget.org/v3/index.json --source https://packagemanagement.eu.infineon.com:4430/api/v2/ --source https://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json --source http://192.168.0.73:5002/v3/index.json",
"dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn",
"MSBuild": "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe\" /target:Build /restore:True /p:RestoreSources=https://api.nuget.org/v3/index.json%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://tfs.intra.infineon.com/tfs/ManufacturingIT/_packaging/eaf/nuget/v3/index.json /detailedsummary /consoleloggerparameters:PerformanceSummary;ErrorsOnly; /property:Configuration=Debug;TargetFrameworkVersion=v4.8 ../MET08RESIMAPCDE.csproj",
"pull": "git pull",
"garbage-collect": "git gc" "garbage-collect": "git gc"
} }
} }

View File

@ -11,7 +11,8 @@
<RootNamespace>EC</RootNamespace> <RootNamespace>EC</RootNamespace>
<AssemblyName>EC</AssemblyName> <AssemblyName>EC</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier Condition="'$(Configuration)' == 'Debug'">win-x86</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(Configuration)' == 'Release'">win</RuntimeIdentifier>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -139,6 +140,7 @@
<Compile Include="Adaptation\Shared\Logistics.cs" /> <Compile Include="Adaptation\Shared\Logistics.cs" />
<Compile Include="Adaptation\Shared\Logistics2.cs" /> <Compile Include="Adaptation\Shared\Logistics2.cs" />
<Compile Include="Adaptation\Shared\ProcessDataStandardFormat.cs" /> <Compile Include="Adaptation\Shared\ProcessDataStandardFormat.cs" />
<Compile Include="Adaptation\Shared\ProcessDataStandardFormatMapping.cs" />
<Compile Include="Adaptation\Shared\Properties\IProcessData.cs" /> <Compile Include="Adaptation\Shared\Properties\IProcessData.cs" />
<Compile Include="Adaptation\Shared\RijndaelEncryption.cs" /> <Compile Include="Adaptation\Shared\RijndaelEncryption.cs" />
<Compile Include="Adaptation\Shared\Test.cs" /> <Compile Include="Adaptation\Shared\Test.cs" />
@ -150,10 +152,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.EAF.Runtime"> <PackageReference Include="Infineon.EAF.Runtime">
<Version>2.47.0</Version> <Version>2.59.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="System.Text.Json"> <PackageReference Include="System.Text.Json">
<Version>6.0.3</Version> <Version>8.0.3</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting"> <PackageReference Include="Microsoft.Extensions.Hosting">
<Version>6.0.3</Version> <Version>6.0.3</Version>

View File

@ -37,7 +37,7 @@ public partial class FileRead : FileReaderHandler, ISMTP
private FilePathGenerator _FilePathGeneratorForTarget; private FilePathGenerator _FilePathGeneratorForTarget;
private readonly List<EquipmentParameter> _EquipmentParameters; private readonly List<EquipmentParameter> _EquipmentParameters;
private static readonly Dictionary<string, List<long>> _DummyRuns; private static readonly Dictionary<string, List<long>> _DummyRuns;
private static readonly Dictionary<long, List<string>> _StaticRuns; private static readonly Dictionary<long, List<Adaptation.Shared.Metrology.WS.Results>> _StaticRuns;
static FileRead() static FileRead()
{ {
@ -165,7 +165,7 @@ public partial class FileRead : FileReaderHandler, ISMTP
Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType); Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType);
} }
if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind)) if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind))
throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!")); throw new Exception(string.Concat('<', jsonProperty.Name, "> {", jsonProperty.Value.ValueKind, "} is not mapped!"));
} }
foreach (JsonProperty jsonProperty in jsonProperties) foreach (JsonProperty jsonProperty in jsonProperties)
{ {
@ -197,7 +197,7 @@ public partial class FileRead : FileReaderHandler, ISMTP
FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration); FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration);
string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName; string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName;
IList<ModelObjectParameterDefinition> modelObjectParameters = Mapper.Map(ConfiguredParameters); IList<ModelObjectParameterDefinition> modelObjectParameters = Mapper.Map(ConfiguredParameters);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _StaticRuns, _UseCyclicalForDescription, isEAFHosted: true); _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _StaticRuns, _UseCyclicalForDescription, connectionCount: null);
if (_FileRead.IsEvent) if (_FileRead.IsEvent)
AddParameterRangeAndEvent(); AddParameterRangeAndEvent();
} }
@ -338,7 +338,7 @@ public partial class FileRead : FileReaderHandler, ISMTP
if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array) if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array)
throw new Exception(); throw new Exception();
IList<ModelObjectParameterDefinition> modelObjectParameters = JsonSerializer.Deserialize<IList<ModelObjectParameterDefinition>>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions); IList<ModelObjectParameterDefinition> modelObjectParameters = JsonSerializer.Deserialize<IList<ModelObjectParameterDefinition>>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _StaticRuns, _UseCyclicalForDescription, isEAFHosted: false); _FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _StaticRuns, _UseCyclicalForDescription, connectionCount: null);
results = _FileRead.ReExtract(); results = _FileRead.ReExtract();
if (results?.Item2 is null) if (results?.Item2 is null)
throw new Exception(); throw new Exception();

172
Jenkinsfile vendored
View File

@ -1,172 +0,0 @@
#!/usr/bin/env groovy
/* groovylint-disable CompileStatic, ConsecutiveStringConcatenation, DuplicateNumberLiteral, DuplicateStringLiteral, LineLength, NestedBlockDepth, NoDef, VariableTypeRequired */
import groovy.transform.Field
@Field String _DDrive = 'D:/'
@Field String _GitName = 'EC'
@Field String _AssemblyName = '...'
@Field String _TargetLocation = '...'
@Field String _GitCommitSeven = '...'
@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()
}
}
}

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.47.0.0")] [assembly: AssemblyVersion("2.59.0.0")]
[assembly: AssemblyFileVersion("2.47.0.0")] [assembly: AssemblyFileVersion("2.59.0.0")]