9 Commits

Author SHA1 Message Date
Simone Terzi 972e9d9c49 Sviluppo Test 2019-08-09 15:50:12 +02:00
Simone Terzi 82b34d6e22 Sviluppo Test 2019-08-08 15:44:45 +02:00
Simone Terzi 27a5a8f111 Sviluppo Test 2019-08-07 15:41:26 +02:00
Simone Terzi c41964222c Sviluppo test... 2019-08-06 15:51:33 +02:00
Simone Terzi 3d82b58326 Sviluppo test 2019-08-05 15:40:48 +02:00
Simone Terzi 81bc796ab5 Sviluppo Test 2019-08-02 15:52:46 +02:00
Simone Terzi 620962cb1e Svilupppo Test (RedisSampler) 2019-08-01 15:52:50 +02:00
Simone Terzi 55bbc80a3d Merge remote-tracking branch 'origin/UnitTesting' into UnitTesting 2019-07-31 15:54:08 +02:00
Simone Terzi 8a9c6f477f Sviluppo test 2019-07-31 15:53:54 +02:00
93 changed files with 6532 additions and 10667 deletions
-153
View File
@@ -1,153 +0,0 @@
variables:
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
NEXUS_PATH: 'OPC-UA-REDIS/SOUR'
APP_NAME: 'SOUR'
SOL_NAME: 'SOUR'
VERS_MAIN: '1.2'
NEW_REL: ''
OUTPUT_DIR: ''
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
}
echo $hasSource
# helper x fix version number
.version-fix: &version-fix
- |
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date format yyMM)+"."+$CI_PIPELINE_IID
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
echo "Set vers: $env:NEW_REL"
# helper pulizia files zip
.cleanup-zip: &cleanup-zip
- |
$env:OUTPUT_DIR = "Releases\" + $CI_COMMIT_BRANCH + "\*"
if ((Test-Path $env:OUTPUT_DIR))
{
Remove-Item $env:OUTPUT_DIR -Force -Recurse -ErrorAction Ignore
}
echo "Clening ZIP dir: $env:OUTPUT_DIR"
# helper creazione files zip
.zipper: &zipper
- |
$7zipPath = $env:ProgramFiles+"\7-Zip\7z.exe"
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
throw "7 zip file '$7zipPath' not found"
}
Set-Alias 7zip $7zipPath
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$Source = "$env:APP_NAME\bin\*"
7zip a -tzip $Target $Source
echo "called ZIP $Source --> $Target"
# helper creazione hash files
.hashBuild: &hashBuild
- |
$Target = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$MD5 = Get-FileHash $Target -Algorithm MD5
$SHA1 = Get-FileHash $Target -Algorithm SHA1
New-Item $Target".md5"
New-Item $Target".sha1"
$MD5.Hash | Set-Content -Path $Target".md5"
$SHA1.Hash | Set-Content -Path $Target".sha1"
echo "Created HASH files for $Target"
# helper x send su NEXUS
.nexusUpload: &nexusUpload
- |
Set-Alias mCurl C:\Windows\system32\curl.exe
$currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH;
$VersNumb = $env:NEW_REL
echo "Curr Version: $VersNumb"
$FileManIn="VersGen\manifest.xml"
$FileManOut=$env:APP_NAME +"\Resources\manifest.xml"
$FileCLogIn="VersGen\ChangeLog.html"
$FileCLogOut=$env:APP_NAME +"\Resources\ChangeLog.html"
echo "Manifest path: $FileManOut"
echo "ChangeLog path: $FileCLogOut"
if($CI_COMMIT_BRANCH -eq "master")
{
$version = "stable"
}
else
{
$version = "unstable"
}
$manData = Get-Content $FileManIn
$manData = $manData -replace "1.0.0.0", $VersNumb
$manData = $manData -replace "{{DIRNAME}}", $env:NEXUS_PATH
$manData = $manData -replace "{{BRANCHNAME}}", "$version/LAST"
$manData = $manData -replace "{{PACKNAME}}", $env:APP_NAME
Set-Content -Path $FileManOut -Value $manData
$clogData = Get-Content $FileCLogIn
$clogData = $clogData -replace "{{CURRENT-REL}}", $VersNumb
Set-Content -Path $FileCLogOut -Value $clogData
$File2Send = Get-ChildItem("Releases\$CI_COMMIT_BRANCH\*")
ForEach ($File in $File2Send) {
$FileName = Split-Path $File -leaf
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName"
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName"
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
}
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileManOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml"
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileManOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
echo "mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileCLogOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html"
mCurl -s -u GitLab:$NEXUS_PASSWD --upload-file $FileCLogOut https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
# $File2Send = "Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/LAST/$env:APP_NAME-$version.zip
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$CI_COMMIT_BRANCH/ARCHIVE/$VersNumb/$env:APP_NAME-$version.zip
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".md5" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".md5
# mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File2Send".sha1" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip".sha1"
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
stages:
- build
- deploy
PUB:Build:
stage: build
tags:
- win
#variables:
# - APP_NAME: 'PUB'
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore $env:SOL_NAME.sln' # path alla solution corrente
- *version-fix
script:
- '& "$env:MSBUILD_PATH" src\$env:APP_NAME\$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
PUB:Deploy:
stage: deploy
tags:
- win
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore $env:SOL_NAME.sln' # path alla solution corrente
- *version-fix
- *cleanup-zip
script:
- '& "$env:MSBUILD_PATH" src\$env:APP_NAME\$env:APP_NAME.csproj -target:Build /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=bin/ /verbosity:minimal /m'
- *zipper
- *hashBuild
- *nexusUpload
needs: ["PUB:Build"]
Vendored
-169
View File
@@ -1,169 +0,0 @@
pipeline {
agent none
environment {
EMAIL_RECIPIENTS = 'samuele@steamware.net'
}
stages {
stage('Checkout') {
agent any
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=291']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'SOUR'
}
}
script {
currentBuild.displayName = "${env.versionNumber}"
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("DEMO") || env.BRANCH_NAME.contains("UnitTesting")) {
currentBuild.description = "TEST ${env.versionNumber}"
}
else {
currentBuild.description = "BUILD ${env.versionNumber}"
}
}
/* CAMBIO numero versione in file sorgente!!! */
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
}
}
stage('Build') {
agent any
steps {
script {
// calcolo il config...
if (env.BRANCH_NAME == "develop") {
env.config = "Debug"
}
else if (env.BRANCH_NAME == "master") {
env.config = "Release"
}
// compilo installers in base al BRANCH...
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") {
// CAMBIO numero versione in file sorgente!!!
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// restore nuget packages
bat "e:\\nuget.exe restore ${WORKSPACE}\\src\\SOUR.sln"
// BUILD Develop!
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR/SOUR.csproj -target:Build /p:Configuration=${env.config} /p:Platform=\"x86\" /p:OutputPath=bin/${env.config}/ /m"
}
else {
echo 'NON faccio test di Build se non per BRANCH DEVELOP...'
}
}
}
}
stage('Test') {
steps {
echo 'Testing.. 2 be done...'
}
}
stage('Deploy') {
agent any
steps {
// in primis compilo a seconda del branch... TUTTO tranne develop...
script {
// calcolo il config...
if (env.BRANCH_NAME == "develop") {
env.config = "Debug"
env.classifier = "unstable"
}
else if (env.BRANCH_NAME == "master") {
env.config = "Release"
env.classifier = ""
}
// procedo solo se NON si tratta di commit in ramo UnitTesting...
if (env.BRANCH_NAME != "UnitTesting") {
// CAMBIO numero versione in file sorgente!!!
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// restore nuget packages
bat "e:\\nuget.exe restore ${WORKSPACE}\\src\\SOUR.sln"
// BUILD!
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR/SOUR.csproj -target:Build /p:Configuration=${env.config} /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
// creo installer MSI...
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR.Setup/SOUR.Setup.wixproj /p:Configuration=${env.config} /p:ProdVersion=${env.versionNumber} /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
}
else
{
echo 'Nessun Deploy x UnitTesting'
}
}
// ora mi occupo delle operazioni di invio a NEXUS...
script {
if (env.BRANCH_NAME != "UnitTesting") {
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'https',
nexusUrl: 'repository.scmgroup.com',
//groupId: 'SOUR',
version: "${env.versionNumber}",
repository: 'mconnect-raw',
credentialsId: 'b1dcea22-0d35-4092-80a1-973e6be41c78',
artifacts: [
[artifactId: 'SOUR',
classifier: "${env.classifier}",
file: "src\\SOUR.Setup\\bin\\SOUR.msi",
type: 'msi']
]
)
}
}
}
}
}
post {
success {
sendSlack("Successful", "good")
}
failure {
sendSlack("Failed", "danger")
}
unstable {
sendSlack("Unstable", "warning")
}
}
}
@NonCPS
def getChangeString() {
MAX_MSG_LEN = 100
def changeString = ""
echo "Gathering SCM changes"
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
truncated_msg = entry.msg.take(MAX_MSG_LEN)
changeString += " - ${truncated_msg} [${entry.author}]\n"
}
}
if (!changeString) {
changeString = " - Nessuna Modifica"
}
return changeString
}
def sendEmail(status) {
mail (
to: "$EMAIL_RECIPIENTS",
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n")
}
// Funzione x invio slack
def sendSlack(status, colorCode) {
slackSend (
color: colorCode,
channel: "#sour-dev",
message: "${env.JOB_NAME} ${env.versionNumber} | " + status + ": Build ${env.BUILD_NUMBER}\n\n" +
"Modifiche:\n " + getChangeString() + "\n\n Verifica build: <${env.BUILD_URL}|Apri>" + "\n"
)
}
+1 -26
View File
@@ -6,8 +6,6 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
- [SOUR (SCM OPC-UA REDIS)](#sour-scm-opc-ua-redis)
- [Organizzazione documenti e codice](#organizzazione-documenti-e-codice)
- [MQTT](#mqtt)
- [MSI installer](#msi-installer)
- [Versioni](#versioni)
## Organizzazione documenti e codice
@@ -16,35 +14,13 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| images | Files supporto documentazione |
| LogConversion | Gestione conversione traccaito di LOG SOUR in formato leggibile per MSIM (superato da versioni > 1.*) |
| Rilasci | Folder dei rilasci (in versione release/debug) del server SOUR, IN PHASE OUT con impiego del nuovo server NEXUS |
| Rilasci | Folder dei rilasci (in versione release/debug) del server SOUR |
| Specifiche.pdf | File contenente le specifiche di interfaccia per SOUR (che devono essere note ai vari Adapters) e tutte le definizioni a livello di interfaccia |
| Specifiche.md | File sorgente (in formato Markdown) delle specifiche |
| src | Folder contenente i sorgenti di SOUR |
| TestClients | Client di riferimento per testing funzionalità OPC-UA |
| Utility | script ed utility varie |
| Varie | Documentazioni ed esempi a corredo |
| Video | Brevi demo dell'utilizzo |
## MQTT
Dalla versione 2.2 è attivo un broker di pubblicazione MQTT verso il cloud.
Condizioni necessarie al funzionamento:
- Non sia presente la chiave di vet in REDIS all'indirizzo `SOUR:GwHw:Vers`, se vuoto/nullo = nessun veto, se presente il numero di versioni (o anceh solo una stringa non vuota) riferita al Gateway Hw viene inibito il funzionamento della sezione MQTT
- macchina attivata con SDK (quindi disponibili le informaizoni di user e pwd per il broker)
## MSI installer
Aggiunto il progetto di generazione installer con wix, il processo jenkis crea l'installer come ultimo step di deploy
Modalità di installaizone file installer msi:
```powershell
SOUR.Setup.msi INSTALLFOLDER=C:\IOT\SOUR /quiet
```
## Versioni
@@ -52,4 +28,3 @@ SOUR.Setup.msi INSTALLFOLDER=C:\IOT\SOUR /quiet
| ------ | ---------- | --------------------------------------------------------------------------------------------------------- |
| <= 1.2 | 2018.12.06 | Documento impiegato epr definizione specifiche SOUR |
| >= 1.3 | 2018.12.06 | Documento suddiviso tra organizzaizone progetto (corrente) e specifiche progetto SOUR (Specifiche.md/pdf) |
| >= 2.2 | 2019.08.02 | Aggiunta MQTT server embedded, generazione installer msi |
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -34
View File
@@ -12,15 +12,12 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
- [Requisiti per installazione](#requisiti-per-installazione)
- [Regole di Naming](#regole-di-naming)
- [Schemi di dettaglio](#schemi-di-dettaglio)
- [Riferimenti importanti](#riferimenti-importanti)
- [MQTT](#mqtt)
- [MSI installer](#msi-installer)
- [Elementi della soluzione](#elementi-della-soluzione)
- [SPECIALIZED ADAPTER --> REDIS SERVER](#specialized-adapter----redis-server)
- [OPC-UA SERVER --> REDIS SERVER](#opc-ua-server----redis-server)
- [DataModel](#datamodel)
- [Riferimenti per il server OPC-UA](#riferimenti-per-il-server-opc-ua)
- [Modalità di funzionamento SOUR](#modalit%c3%a0-di-funzionamento-sour)
- [Modalità di funzionamento SOUR](#modalit%C3%A0-di-funzionamento-sour)
- [Dettaglio struttura memoria DB del server REDIS](#dettaglio-struttura-memoria-db-del-server-redis)
- [Adapter - Adp](#adapter---adp)
- [Adapter - AdpConf](#adapter---adpconf)
@@ -30,7 +27,7 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
- [Adapter - MConnect](#adapter---mconnect)
- [Dettaglio protocollo comunicazione HMI - Maestro Connect](#dettaglio-protocollo-comunicazione-hmi---maestro-connect)
- [Aspetti tecnici salienti](#aspetti-tecnici-salienti)
- [Schema Funzionalità](#schema-funzionalit%c3%a0)
- [Schema Funzionalità](#schema-funzionalit%C3%A0)
- [**ChannelsIN**: notifica info dal Cloud / richiesta esecuzione task -> HMI](#channelsin-notifica-info-dal-cloud--richiesta-esecuzione-task---hmi)
- [Caso duso ChannelsIN:DataError](#caso-duso-channelsindataerror)
- [Caso duso ChannelsIN:AlertHMI](#caso-duso-channelsinalerthmi)
@@ -65,10 +62,6 @@ Le versioni rilasciate della documentazione e del server SOUR sono le seguenti:
| 1.2.6 | 2018.12.06 | Completata documentazione area REDIS e aggiornamento server (1.2.1812.185) |
| 1.3.1 | 2019.01.31 | Implementata gestione nuovi parametri in DataModel per SampleGroup, DeadBand, VisibilityGroup --> testing con FANUC/SIEMENS ed adapter CMS (1.3.1901.195) |
| 1.3.2 | 2019.02.03 | Review documentazione x definizione modelli tracciati JSON per log eventi/allarmi/produzione su base riunione 2018.01.30 (1.3.1902.196) |
| 1.4 | 2019.02.18 | Cambio Namespace, fix gestione allarmi |
| 2.0 | 2019.03.08 | Prima release 2.0 stabile |
| 2.1 | 2019.04.12 | modifica comportamento in avvio per sincronizzazione allarmi, sincronizzazione variabili e proprietà |
| 2.2 | 2019.08.01 | Prima release 2.2 con MQTT, fix comportamento invio allarmi 8gestione memoria persistente precedente invio stato allarmi), nuovo installer MSI |
<div style="page-break-after: always;"></div>
@@ -193,31 +186,6 @@ A valle di questo si trova il server REDIS che persiste le informaizone e fa da
<div style="page-break-after: always;"></div>
## Riferimenti importanti
Alcune note importatnti riguardo l'installer MSI di SOUR e il broker MQTT embedded in SOUR
### MQTT
Dalla versione 2.2 è attivo un broker di pubblicazione MQTT verso il cloud.
Condizioni necessarie al funzionamento:
- Non sia presente la chiave di vet in REDIS all'indirizzo `SOUR:GwHw:Vers`, se vuoto/nullo = nessun veto, se presente il numero di versioni (o anceh solo una stringa non vuota) riferita al Gateway Hw viene inibito il funzionamento della sezione MQTT
- macchina attivata con SDK (quindi disponibili le informaizoni di user e pwd per il broker)
### MSI installer
Aggiunto il progetto di generazione installer con wix, il processo jenkis crea l'installer come ultimo step di deploy
Modalità di installaizone file installer msi:
```powershell
SOUR.Setup.msi INSTALLFOLDER=C:\IOT\SOUR /quiet
```
## Elementi della soluzione
Di seguito sono indicati i vari elementi in gioco nel sistema e le specifiche di impiego e funzionamento.
BIN
View File
Binary file not shown.
-7
View File
@@ -1,7 +0,0 @@
------------------------------------------------
- Check e todo's
------------------------------------------------
OK - Inserire Costura Fody x fare ILMerge di dll + assembly vari x SOUR
- Verifica distinzione caso release e debug: https://tech.trailmax.info/2014/01/bundling-all-your-assemblies-into-one-or-alternative-to-ilmerge/
- Continuare costruzione MSI con WIX con soli files di assembly merged...
File diff suppressed because it is too large Load Diff
+6 -7
View File
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpcUaCommon</RootNamespace>
<AssemblyName>OpcUaCommon</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
@@ -35,14 +35,14 @@
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MQTTnet, Version=3.0.8.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.3.0.8\lib\net461\MQTTnet.dll</HintPath>
<Reference Include="MQTTnet, Version=3.0.5.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.3.0.5\lib\net461\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=3.0.8.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.3.0.8\lib\net452\MQTTnet.Extensions.ManagedClient.dll</HintPath>
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=3.0.5.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.3.0.5\lib\net452\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -77,7 +77,6 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\ConsolePrinter.cs" />
<Compile Include="Services\CryptoUtils.cs" />
<Compile Include="Services\DataRecorder.cs" />
<Compile Include="Services\IPrinter.cs" />
<Compile Include="Services\LogPrinter.cs" />
-154
View File
@@ -1,154 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace OpcUaCommon.Services
{
/// <summary>
/// utils x cifrature passeword e Crypto functionality in genere
/// </summary>
public static class CryptoUtils
{
#region Public Methods
/// <summary>
/// Decifra un messaggio AES
/// </summary>
/// <param name="Message"></param>
/// <param name="Passphrase"></param>
/// <returns></returns>
public static string DecryptString(string Message, string Passphrase)
{
string answ = Message;
byte[] Results = null;
UTF8Encoding UTF8 = new UTF8Encoding();
// Step 1. faccio hash per ottenere la Key a 128 bit + l'InitVector a 256 bit
// - MD5 hash generator --> 128 bit byte array
// - Sha256 hash generator --> 256 bit byte array
MD5CryptoServiceProvider MD5HashProv = new MD5CryptoServiceProvider();
SHA256CryptoServiceProvider Sha256HashProv = new SHA256CryptoServiceProvider();
byte[] AESKey = Sha256HashProv.ComputeHash(UTF8.GetBytes(Passphrase));
byte[] AESIV = MD5HashProv.ComputeHash(UTF8.GetBytes(Passphrase));
// Step 2. Crea oggett AESCryptoServiceProvider
AesCryptoServiceProvider AESAlgorithm = new AesCryptoServiceProvider();
// Step 3. Setup del dencoder
AESAlgorithm.Key = AESKey;
AESAlgorithm.IV = AESIV;
// Step 4. Conversione della stringa in ingresso in un byte[]
byte[] DataToDecrypt = null;
try
{
DataToDecrypt = Convert.FromBase64String(Message);
}
catch
{ }
if (DataToDecrypt != null)
{
// Step 5. Attempt to decrypt the string
try
{
ICryptoTransform Decryptor = AESAlgorithm.CreateDecryptor();
Results = Decryptor.TransformFinalBlock(DataToDecrypt, 0, DataToDecrypt.Length);
}
finally
{
// Clear the TripleDes and Hashprovider services of any sensitive information
AESAlgorithm.Clear();
MD5HashProv.Clear();
Sha256HashProv.Clear();
}
// Step 6. Return the decrypted string in UTF8 format
answ = UTF8.GetString(Results);
}
return answ;
}
/// <summary>
/// Cifra un messaggio con AES
/// </summary>
/// <param name="Message">Messaggio da cifrare (la password)</param>
/// <param name="Passphrase">Stringa usate per generare le key/IV da 128/256bit</param>
/// <returns></returns>
public static string EncryptString(string Message, string Passphrase)
{
byte[] Results;
UTF8Encoding UTF8 = new UTF8Encoding();
// Step 1. faccio hash per ottenere la Key a 128 bit + l'InitVector a 256 bit
// - MD5 hash generator --> 128 bit byte array
// - Sha256 hash generator --> 256 bit byte array
MD5CryptoServiceProvider MD5HashProv = new MD5CryptoServiceProvider();
SHA256CryptoServiceProvider Sha256HashProv = new SHA256CryptoServiceProvider();
byte[] AESKey = Sha256HashProv.ComputeHash(UTF8.GetBytes(Passphrase));
byte[] AESIV = MD5HashProv.ComputeHash(UTF8.GetBytes(Passphrase));
// Step 2. Crea oggett AESCryptoServiceProvider
AesCryptoServiceProvider AESAlgorithm = new AesCryptoServiceProvider();
// Step 3. Setup dell'encoder
AESAlgorithm.Key = AESKey;
AESAlgorithm.IV = AESIV;
// Step 4. Conversione della stringa in ingresso in un byte[]
byte[] DataToEncrypt = UTF8.GetBytes(Message);
// Step 5. Attempt to encrypt the string
try
{
ICryptoTransform Encryptor = AESAlgorithm.CreateEncryptor();
Results = Encryptor.TransformFinalBlock(DataToEncrypt, 0, DataToEncrypt.Length);
}
finally
{
// ripulisce il provider di ogni informazione sensibile
AESAlgorithm.Clear();
MD5HashProv.Clear();
Sha256HashProv.Clear();
}
// Step 6. Restitusice stringa cifrata come una "base64 encoded string"
return Convert.ToBase64String(Results);
}
/// <summary>
/// Genera una password valida
/// </summary>
/// <param name="userName"></param>
/// <param name="passphrase"></param>
/// <returns></returns>
public static string generatePwd(string userName, string passphrase)
{
// Check preliminare della "master password"
return EncryptString(userName, passphrase);
}
/// <summary>
/// Effettua validazione password
/// </summary>
/// <param name="userName"></param>
/// <param name="password"></param>
/// <param name="passphrase"></param>
/// <returns></returns>
public static bool validateUserPwd(string userName, string password, string passphrase)
{
// Check preliminare della "master password"
bool answ = (userName == "scmAdmin" && password == "1PasswordDavveroDifficil3!");
// verifico password avanzata
if (!answ)
{
string plainText = DecryptString(password, passphrase);
answ = (userName == plainText);
}
return answ;
}
#endregion Public Methods
}
}
+358 -478
View File
@@ -6,507 +6,387 @@ using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
namespace OpcUaCommon.Services
{
public class MQTT_Client
{
/// <summary>
/// Enum stati allarmi
/// Classe di configurazione per accesso MQTT
/// "plugId": "dev-5c86dced371e9e980142167d", "auth_password": "9c4173da75"
/// </summary>
public enum alarmState
public class confData
{
Active,
Inactive
/// <summary>
/// Determina se sia abilitato o meno il protocollo
/// </summary>
public bool isEnabled = false;
/// <summary>
/// Base NameSpace (se manca lo aggiunge al channel in fase di invio...
/// </summary>
public string baseNS { get; set; } = "data/";
/// <summary>
/// URL del brooker
/// api.cloudplugs.com
/// </summary>
public string broker_address { get; set; }
/// <summary>
/// PORT del broker
/// </summary>
public int port_broker { get; set; }
/// <summary>
/// Tempo di attesa prima di tentare una auto-reconnect (in ms)
/// </summary>
public int autoReconnectDelayMs { get; set; }
/// <summary>
/// User - da API mconnect
/// "plugId": "dev-5c86dced371e9e980142167d"
/// </summary>
public string usr_broker { get; set; }
/// <summary>
/// Password - da API mconnect
/// "auth_password": "9c4173da75"
/// </summary>
public string pwd_broker { get; set; }
}
/// <summary>
/// Configurazione attiva
/// </summary>
protected confData _currConf;
/// <summary>
/// Obj factory MQTT
/// </summary>
protected MqttFactory factory;
/// <summary>
/// Opzioni di connessione (managed client)
/// </summary>
protected ManagedMqttClientOptions options;
/// <summary>
/// Client MQTT (managed)
/// </summary>
protected IManagedMqttClient mqttClientMan;
/// <summary>
/// Cancellation token
/// </summary>
protected System.Threading.CancellationToken cancellationToken;
/// <summary>
/// Classe del contenuto DATA dell'oggetto (base)
/// Inizializzazione obj gestione MQTT
/// </summary>
public class alarmPayload : dataPayload
/// <param name="currConfig"></param>
public MQTT_Client(confData currConfig)
{
#region Public Properties
/// <summary>
/// Stato corrente della condition
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public alarmState activeState { get; set; } = alarmState.Inactive;
/// <summary>
/// Chiave univoca allarme (CODICE|SEVERITY)
/// </summary>
public string conditionName { get; set; } = "";
/// <summary>
/// K rappresenta il channel della condition
/// </summary>
public string eventType { get; set; } = "AlarmConditionType";
/// <summary>
/// K rappresenta il channel della condition
/// </summary>
public string k { get; set; } = "";
/// <summary>
/// rappresenta la severity della condition (0..1000) calcolata in automatico dalla condition name (dopo il simbolo pipe "|")
/// </summary>
public string severity
{
get
{
string answ = "0";
int idx = conditionName.IndexOf("|");
if (idx > 0)
{
try
{
answ = conditionName.Substring(idx + 1);
}
catch
{ }
}
return answ;
}
}
#endregion Public Properties
// salvo config
_currConf = currConfig;
mqttClientMan = new MqttFactory().CreateManagedMqttClient();
}
/// <summary>
/// Classe del contenuto DATA dell'oggetto (base)
/// Avvio del client MQTT
/// </summary>
public class dataPayload
public async Task startAsync()
{
#region Public Properties
// preparo token cancellazione
cancellationToken = new System.Threading.CancellationToken();
/// <summary>
/// ts = timestamp server
/// </summary>
public string ts { get; set; } = DTUtils.timestamp;
Guid newGuid = Guid.NewGuid();
string clientId = $"SOUR-SRG-{newGuid}";
/// <summary>
/// v = value
/// </summary>
public string v { get; set; } = "";
#endregion Public Properties
// Setup and start del client MQTT managed.
options = new ManagedMqttClientOptionsBuilder()
.WithAutoReconnectDelay(TimeSpan.FromMilliseconds(_currConf.autoReconnectDelayMs))
.WithClientOptions(new MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer(_currConf.broker_address, _currConf.port_broker)
.WithCredentials(_currConf.usr_broker, _currConf.pwd_broker)
//.WithTls()
.Build())
.Build();
// avvio client MQTT
await mqttClientMan.StartAsync(options);
}
public class MQTT_Client
{
#region Private Fields
private readonly IPrinter _printer;
#endregion Private Fields
#region Protected Fields
/// <summary>
/// Configurazione attiva
/// </summary>
protected confData _currConf;
/// <summary>
/// Cancellation token
/// </summary>
protected System.Threading.CancellationToken cancellationToken;
/// <summary>
/// Obj factory MQTT
/// </summary>
protected MqttFactory factory;
/// <summary>
/// Client MQTT (managed)
/// </summary>
protected IManagedMqttClient mqttClientMan;
/// <summary>
/// Opzioni di connessione (managed client)
/// </summary>
protected ManagedMqttClientOptions options;
#endregion Protected Fields
#region Public Constructors
/// <summary>
/// Inizializzazione obj gestione MQTT
/// </summary>
/// <param name="currConfig"></param>
/// <param name="printer"></param>
public MQTT_Client(confData currConfig, IPrinter printer)
{
// salvo config
_currConf = currConfig;
_printer = printer;
mqttClientMan = new MqttFactory().CreateManagedMqttClient();
}
#endregion Public Constructors
#region Protected Methods
/// <summary>
/// COntrolla se il channel contenga il valore baseNS da config, altrimenti aggiunge...
/// </summary>
/// <param name="channel"></param>
/// <returns></returns>
protected string fixChannel(string channel)
{
// verifico se aggiungere o meno il baseNS...
string answ = channel.StartsWith(_currConf.baseNS) ? channel : _currConf.baseNS + channel;
// fix in caso ci fossero ":" al psoto di "/"...
answ = answ.Replace(":", "/");
return answ;
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// Formatta il payload in modo che sia un JSon valido x gli allarmi da trasmettere...
/// </summary>
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
/// <param name="alrmState">Stato dell'allarme</param>
/// <param name="baseNS">Componente NS da togliere nel valore "K" del payload dell'allarme</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public static string createAlarmPayload(string channel, string conditionKey, string conditionValue, alarmState alrmState, string baseNS, int? ttlSec)
{
string jsonData = "";
// se ttl null --> imposto default 100 gg
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
// se ttl < 0 --> imposto null (never expiry...)
ttlSec = ttlSec < 0 ? null : ttlSec;
// preparo oggetto
mqttConditionPayload currData = new mqttConditionPayload()
{
data = new alarmPayload()
{
k = channel.Replace(baseNS, ""),
v = conditionValue,
conditionName = conditionKey,
activeState = alrmState
},
ttl = ttlSec,
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
};
// serializzo
jsonData = JsonConvert.SerializeObject(currData);
// restituisco!
return jsonData;
}
/// <summary>
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
/// </summary>
/// <param name="valore">Valore da inviare</param>
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
/// <returns></returns>
public static string createValuePayload(string valore, int? ttlSec)
{
string jsonData = "";
// se ttl null --> imposto default 100 gg
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
// se ttl < 0 --> imposto null (never expiry...)
ttlSec = ttlSec < 0 ? null : ttlSec;
// preparo oggetto
mqttValuePayload currData = new mqttValuePayload()
{
data = new dataPayload()
{
v = valore
},
ttl = ttlSec,
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
};
// serializzo
jsonData = JsonConvert.SerializeObject(currData);
// restituisco!
return jsonData;
}
/// <summary>
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
/// </summary>
/// <param name="valore">Valore da inviare</param>
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
/// <param name="EventDT">Data-ora dell'evento da creare</param>
/// <returns></returns>
public static string createValuePayload(string valore, int? ttlSec, DateTime EventDT)
{
string jsonData = "";
// se ttl null --> imposto default 100 gg
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
// se ttl < 0 --> imposto null (never expiry...)
ttlSec = ttlSec < 0 ? null : ttlSec;
// preparo oggetto
mqttValuePayload currData = new mqttValuePayload()
{
data = new dataPayload()
{
v = valore
},
ttl = ttlSec,
at = DTUtils.dtAtMqtt(EventDT)
};
// serializzo
jsonData = JsonConvert.SerializeObject(currData);
// restituisco!
return jsonData;
}
/// <summary>
/// Invia 1:1 le stringhe di payload ricevute
/// </summary>
/// <param name="rowList">Array di linee da registrare</param>
public void Send(List<string> rowList)
{
// spacchetta i payload
foreach (var item in rowList)
{
// e li invia 1:1...
//string jsonData = MQTT_Client.createPayload("Starting", null);
//await mqttCli.sendMessageAsync("data/SRG", jsonData);
}
}
/// <summary>
/// Invia messaggio richiesto
/// </summary>
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
/// <param name="activeState">Stato dell'allarme</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public async Task<bool> sendAlarmAsync(string channel, string conditionKey, string conditionValue, alarmState activeState, int? ttlSec)
{
bool answ = false;
// invio SOLO SE il valore è != ""...
if (conditionKey != "")
{
try
{
string payload = createAlarmPayload(channel, conditionKey, conditionValue, activeState, _currConf.baseNS, ttlSec);
// registro esito...
answ = await sendPayloadAsync($"{channel}/{conditionKey}", payload);
}
catch (Exception exc)
{
_printer.Print($"EXCEPTION during sendAlarmAsync: channel {channel} | conditionKey = {conditionKey} | conditionValue = {conditionValue} | activeState = {activeState} | TTL = {ttlSec}");
_printer.Print(exc.ToString());
}
}
else
{
// no invio se vuoto...
}
// restituico esito...
return answ;
}
/// <summary>
/// Invia messaggio richiesto
/// </summary>
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="payload">Payload da trasmettere</param>
/// <returns></returns>
public async Task<bool> sendPayloadAsync(string channel, string payload)
{
bool answ = false;
try
{
// impacchetto il messaggio
var message = new MqttApplicationMessageBuilder()
.WithTopic($"{_currConf.usr_broker}/{fixChannel(channel)}")
.WithPayload(payload)
.WithExactlyOnceQoS()
.WithRetainFlag()
.Build();
// invio in modalità async
await mqttClientMan.PublishAsync(message, cancellationToken);
// registro esito...
answ = true;
}
catch (Exception exc)
{
_printer.Print($"EXCEPTION during sendPayloadAsync: channel {channel} | payload = {payload}");
_printer.Print(exc.ToString());
}
// restituico esito...
return answ;
}
/// <summary>
/// Invia messaggio richiesto
/// </summary>
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="valore">Valore da trasmettere</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public async Task<bool> sendValueAsync(string channel, string valore, int? ttlSec)
{
bool answ = false;
// invio SOLO SE il valore è != ""...
if (!string.IsNullOrEmpty(valore))
{
try
{
string payload = createValuePayload(valore, ttlSec);
// registro esito...
answ = await sendPayloadAsync(channel, payload);
}
catch (Exception exc)
{
_printer.Print($"EXCEPTION during sendValueAsync: channel {channel} | valore = {valore} | TTL = {ttlSec}");
_printer.Print(exc.ToString());
}
}
else
{
// no invio se vuoto...
}
// restituico esito...
return answ;
}
/// <summary>
/// Avvio del client MQTT
/// </summary>
public async Task startAsync()
{
// preparo token cancellazione
cancellationToken = new System.Threading.CancellationToken();
Guid newGuid = Guid.NewGuid();
string clientId = $"SOUR-SRG-{newGuid}";
// Setup and start del client MQTT managed.
options = new ManagedMqttClientOptionsBuilder()
.WithAutoReconnectDelay(TimeSpan.FromMilliseconds(_currConf.autoReconnectDelayMs))
.WithClientOptions(new MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer(_currConf.broker_address, _currConf.port_broker)
.WithCredentials(_currConf.usr_broker, _currConf.pwd_broker)
//.WithTls()
.Build())
.Build();
// avvio client MQTT
await mqttClientMan.StartAsync(options);
}
#endregion Public Methods
#region Public Classes
/// <summary>
/// Classe di configurazione per accesso MQTT
/// "plugId": "dev-5c86dced371e9e980142167d", "auth_password": "9c4173da75"
/// </summary>
public class confData
{
#region Public Fields
/// <summary>
/// Determina se sia abilitato o meno il protocollo
/// </summary>
public bool isEnabled = false;
#endregion Public Fields
#region Public Properties
/// <summary>
/// Tempo di attesa prima di tentare una auto-reconnect (in ms)
/// </summary>
public int autoReconnectDelayMs { get; set; }
/// <summary>
/// Base NameSpace (se manca lo aggiunge al channel in fase di invio...
/// </summary>
public string baseNS { get; set; } = "data/";
/// <summary>
/// URL del brooker
/// api.cloudplugs.com
/// </summary>
public string broker_address { get; set; }
/// <summary>
/// PORT del broker
/// </summary>
public int port_broker { get; set; }
/// <summary>
/// Password - da API mconnect
/// "auth_password": "9c4173da75"
/// </summary>
public string pwd_broker { get; set; }
/// <summary>
/// User - da API mconnect
/// "plugId": "dev-5c86dced371e9e980142167d"
/// </summary>
public string usr_broker { get; set; }
#endregion Public Properties
}
#endregion Public Classes
}
/// <summary>
/// Classe costruzione di un payload MQTT di tipo CONDITION da serializzare
/// COntrolla se il channel contenga il valore baseNS da config, altrimenti aggiunge...
/// </summary>
public class mqttConditionPayload
/// <param name="channel"></param>
/// <returns></returns>
protected string fixChannel(string channel)
{
#region Public Properties
/// <summary>
/// ts = timestamp pubblicazione
/// </summary>
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
/// <summary>
/// Payload del messaggio MQTT
/// </summary>
public alarmPayload data { get; set; }
/// <summary>
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
/// </summary>
public int? ttl { get; set; } = 8640000;
#endregion Public Properties
// verifico se aggiungere o meno il baseNS...
string answ = channel.StartsWith(_currConf.baseNS) ? channel : _currConf.baseNS + channel;
// fix in caso ci fossero ":" al psoto di "/"...
answ = answ.Replace(":", "/");
return answ;
}
/// <summary>
/// Classe costruzione di un payload MQTT di tipo VALORE STANDARD da serializzare
/// Invia messaggio richiesto
/// </summary>
public class mqttValuePayload
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="valore">Valore da trasmettere</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public async Task<bool> sendValueAsync(string channel, string valore, int? ttlSec)
{
#region Public Properties
/// <summary>
/// ts = timestamp pubblicazione
/// </summary>
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
/// <summary>
/// Payload del messaggio MQTT
/// </summary>
public dataPayload data { get; set; }
/// <summary>
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
/// </summary>
public int? ttl { get; set; } = 8640000;
#endregion Public Properties
bool answ = false;
// invio SOLO SE il valore è != ""...
if (valore != "")
{
try
{
string payload = createValuePayload(valore, ttlSec);
// registro esito...
answ = await sendPayloadAsync(channel, payload);
}
catch
{ }
}
else
{
// no invio se vuoto...
}
// restituico esito...
return answ;
}
}
/// <summary>
/// Invia messaggio richiesto
/// </summary>
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
/// <param name="activeState">Stato dell'allarme</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public async Task<bool> sendAlarmAsync(string channel, string conditionKey, string conditionValue, alarmState activeState, int? ttlSec)
{
bool answ = false;
// invio SOLO SE il valore è != ""...
if (conditionKey != "")
{
try
{
string payload = createAlarmPayload(channel, conditionKey, conditionValue, activeState, _currConf.baseNS, ttlSec);
// registro esito...
answ = await sendPayloadAsync($"{channel}/{conditionKey}", payload);
}
catch(Exception exc)
{ }
}
else
{
// no invio se vuoto...
}
// restituico esito...
return answ;
}
/// <summary>
/// Invia messaggio richiesto
/// </summary>
/// <param name="channel">Channel su cui pubblicare</param>
/// <param name="payload">Payload da trasmettere</param>
/// <returns></returns>
public async Task<bool> sendPayloadAsync(string channel, string payload)
{
bool answ = false;
try
{
// impacchetto il messaggio
var message = new MqttApplicationMessageBuilder()
.WithTopic($"{_currConf.usr_broker}/{fixChannel(channel)}")
.WithPayload(payload)
.WithExactlyOnceQoS()
.WithRetainFlag()
.Build();
// invio in modalità async
await mqttClientMan.PublishAsync(message, cancellationToken);
// registro esito...
answ = true;
}
catch (Exception exc)
{ }
// restituico esito...
return answ;
}
/// <summary>
/// Invia 1:1 le stringhe di payload ricevute
/// </summary>
/// <param name="rowList">Array di linee da registrare</param>
public void Send(List<string> rowList)
{
// spacchetta i payload
foreach (var item in rowList)
{
// e li invia 1:1...
//string jsonData = MQTT_Client.createPayload("Starting", null);
//await mqttCli.sendMessageAsync("data/SRG", jsonData);
}
}
/// <summary>
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
/// </summary>
/// <param name="valore">Valore da inviare</param>
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
/// <returns></returns>
public static string createValuePayload(string valore, int? ttlSec)
{
string jsonData = "";
// se ttl null --> imposto default 100 gg
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
// se ttl < 0 --> imposto null (never expiry...)
ttlSec = ttlSec < 0 ? null : ttlSec;
// preparo oggetto
mqttValuePayload currData = new mqttValuePayload()
{
data = new dataPayload()
{
v = valore
},
ttl = ttlSec,
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
};
// serializzo
jsonData = JsonConvert.SerializeObject(currData);
// restituisco!
return jsonData;
}
/// <summary>
/// Formatta il payload in modo che sia un JSon valido x gli allarmi da trasmettere...
/// </summary>
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
/// <param name="activeState">Stato dell'allarme</param>
/// <param name="baseNS">Componente NS da togliere nel valore "K" del payload dell'allarme</param>
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
/// <returns></returns>
public static string createAlarmPayload(string channel, string conditionKey, string conditionValue, alarmState activeState, string baseNS, int? ttlSec)
{
string jsonData = "";
// se ttl null --> imposto default 100 gg
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
// se ttl < 0 --> imposto null (never expiry...)
ttlSec = ttlSec < 0 ? null : ttlSec;
// preparo oggetto
mqttConditionPayload currData = new mqttConditionPayload()
{
data = new alarmPayload()
{
k = channel.Replace(baseNS, ""),
v = conditionValue,
conditionName = conditionKey,
currState = activeState
},
ttl = ttlSec,
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
};
// serializzo
jsonData = JsonConvert.SerializeObject(currData);
// restituisco!
return jsonData;
}
}
/// <summary>
/// Classe costruzione di un payload MQTT di tipo VALORE STANDARD da serializzare
/// </summary>
public class mqttValuePayload
{
/// <summary>
/// ts = timestamp pubblicazione
/// </summary>
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
/// <summary>
/// Payload del messaggio MQTT
/// </summary>
public dataPayload data { get; set; }
/// <summary>
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
/// </summary>
public int? ttl { get; set; } = 8640000;
}
/// <summary>
/// Classe costruzione di un payload MQTT di tipo CONDITION da serializzare
/// </summary>
public class mqttConditionPayload
{
/// <summary>
/// ts = timestamp pubblicazione
/// </summary>
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
/// <summary>
/// Payload del messaggio MQTT
/// </summary>
public alarmPayload data { get; set; }
/// <summary>
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
/// </summary>
public int? ttl { get; set; } = 8640000;
}
/// <summary>
/// Classe del contenuto DATA dell'oggetto (base)
/// </summary>
public class dataPayload
{
/// <summary>
/// ts = timestamp server
/// </summary>
public string ts { get; set; } = DTUtils.timestamp;
/// <summary>
/// v = value
/// </summary>
public string v { get; set; } = "";
}
/// <summary>
/// Classe del contenuto DATA dell'oggetto (base)
/// </summary>
public class alarmPayload : dataPayload
{
/// <summary>
/// K rappresenta il channel della condition
/// </summary>
public string k { get; set; } = "";
/// <summary>
/// rappresenta la severity della condition (0..1000) calcolata in automatico dalla condition name (dopo il simbolo pipe "|")
/// </summary>
public string severity
{
get
{
string answ = "0";
int idx = conditionName.IndexOf("|");
if (idx > 0)
{
try
{
answ = conditionName.Substring(idx + 1);
}
catch
{ }
}
return answ;
}
}
/// <summary>
/// K rappresenta il channel della condition
/// </summary>
public string eventType { get; set; } = "AlarmConditionType";
/// <summary>
/// Chiave univoca allarme (CODICE|SEVERITY)
/// </summary>
public string conditionName { get; set; } = "";
/// <summary>
/// Stato corrente della condition
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public alarmState currState { get; set; } = alarmState.Inactive;
}
/// <summary>
/// Enum stati allarmi
/// </summary>
public enum alarmState
{
Active,
Inactive
}
}
+4 -4
View File
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net461" />
<package id="MQTTnet" version="3.0.8" targetFramework="net461" />
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.8" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="2.2.2" targetFramework="net461" />
<package id="MQTTnet" version="3.0.5" targetFramework="net461" />
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.5" targetFramework="net461" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
+7 -91
View File
@@ -13,7 +13,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
@@ -25,7 +25,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
@@ -33,7 +33,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -49,7 +49,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -77,7 +77,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -85,7 +85,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -93,7 +93,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.2.0" newVersion="4.3.2.0" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -103,90 +103,6 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Connections.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.DispatchProxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -0,0 +1,131 @@
<ModelDesign>
<Machine DefaultGenerationRate="2000">
<Property SymbolicName="ModelName" BrowseName="ModelName" DataType="ua:String" ValueRank="Scalar" Value="Morbidelli P200 - SOUR" />
<Property SymbolicName="MachineID" BrowseName="MachineID" DataType="ua:String" ValueRank="Scalar" Value="SOUR/0001" />
<Property SymbolicName="Matricola" BrowseName="Matricola" DataType="ua:String" ValueRank="Scalar" Value="SOUR/0001" />
<Property SymbolicName="ManufacturerName" BrowseName="ManufacturerName" DataType="ua:String" ValueRank="Scalar" Value="SCM" />
<Variable SymbolicName="AlarmState" BrowseName="AlarmState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
<Variable SymbolicName="EmergencyState" BrowseName="EmergencyState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
<Variable SymbolicName="ExecutionState" BrowseName="ExecutionState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
<Variable SymbolicName="HoldState" BrowseName="HoldState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[1,1]" Units="Enumeration" />
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Auto,MDI,Manual,Calibration]" Units="Enumeration" />
<Condition SymbolicName="CNC" BrowseName="CNC" DataType="ua:String" ValueRank="Scalar" type="OffNormalAlarmState" Severity="high" GenerationRate="10000" Range="[]" Units="" />
<Condition SymbolicName="PLC" BrowseName="PLC" DataType="ua:String" ValueRank="Scalar" type="OffNormalAlarmState" Severity="high" GenerationRate="5000" Range="[]" Units="" />
<Component Name="Axes">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Component Name="AxisX">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
</Component>
<Component Name="AxisY">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
</Component>
<Component Name="AxisZ">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
</Component>
<Component Name="AxisB">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
<Variable SymbolicName="CurrentAng" BrowseName="CurrentAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
<Variable SymbolicName="Revolutions" BrowseName="Revolutions" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
<Variable SymbolicName="TargetAng" BrowseName="TargetAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
</Component>
<Component Name="AxisU">
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
<Variable SymbolicName="CurrentAng" BrowseName="CurrentAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
<Variable SymbolicName="Revolutions" BrowseName="Revolutions" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
<Variable SymbolicName="TargetAng" BrowseName="TargetAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
</Component>
</Component>
<Component Name="OperatingGroups">
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
<Component Name="Heads">
<Component Name="Head_1">
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,130]" Units="Percent" />
<Variable SymbolicName="Speed" BrowseName="Speed" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="SpindleRevs" BrowseName="SpindleRevs" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="SpindleActiveDuration" BrowseName="SpindeActiveDuration" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,250]" Units="Count" />
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
</Component>
<Component Name="Head_2">
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,130]" Units="Percent" />
<Variable SymbolicName="Speed" BrowseName="Speed" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="SpindleRevs" BrowseName="SpindleRevs" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
<Variable SymbolicName="SpindleActiveDuration" BrowseName="SpindeActiveDuration" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
</Component>
</Component>
</Component>
<Component Name="VacuumPumps">
<Component Name="VacuumPump_1">
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
</Component>
<Component Name="VacuumPump_2">
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
</Component>
<Component Name="VacuumPump_3">
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
</Component>
<Component Name="VacuumPump_4">
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
</Component>
</Component>
<Component Name="Lubro">
<Component Name="Lube_1">
<Variable SymbolicName="Activations" BrowseName="Activations" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
<Variable SymbolicName="Empty" BrowseName="Empty" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
</Component>
<Component Name="Lube_2">
<Variable SymbolicName="Activations" BrowseName="Activations" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
<Variable SymbolicName="Empty" BrowseName="Empty" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
</Component>
</Component>
<Component Name="WorkingArea">
<Component Name="Area_1">
<Property SymbolicName="AreaID" BrowseName="AreaID" DataType="ua:String" ValueRank="Scalar" Value="A"/>
<Component Name="Program_1">
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Progr1,Prog2,Prog3]" Units="Enumeration" />
<Variable SymbolicName="RepsLeft" BrowseName="RepsLeft" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[1,10]" Units="Enumeration" />
<Variable SymbolicName="RepsProgrammed" BrowseName="RepsProgrammed" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[12,12]" Units="Enumeration" />
<Variable SymbolicName="ProgramState" BrowseName="ProgramState" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Exe,Loading,Alarm,Ready,Reserved]" Units="Enumeration" />
</Component>
</Component>
<Component Name="Area_2">
<Property SymbolicName="AreaID" BrowseName="AreaID" DataType="ua:String" ValueRank="Scalar" Value="A"/>
<Component Name="Program_1">
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Progr1,Prog2,Prog3]" Units="Enumeration" />
<Variable SymbolicName="RepsLeft" BrowseName="RepsLeft" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[1,10]" Units="Enumeration" />
<Variable SymbolicName="RepsProgrammed" BrowseName="RepsProgrammed" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[12,12]" Units="Enumeration" />
<Variable SymbolicName="ProgramState" BrowseName="ProgramState" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Exe,Loading,Alarm,Ready,Reserved]" Units="Enumeration" />
</Component>
</Component>
</Component>
</Machine>
</ModelDesign>
+98 -102
View File
@@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>OpcUaServer.Server</RootNamespace>
<AssemblyName>OpcUaServer.Server</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
@@ -35,16 +35,16 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.5.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
<HintPath>..\packages\Portable.BouncyCastle.1.8.5\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Connections.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Connections.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Hosting, Version=2.2.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.2.2.7\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
<Reference Include="Microsoft.AspNetCore.Hosting, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll</HintPath>
@@ -61,8 +61,8 @@
<Reference Include="Microsoft.AspNetCore.Http.Extensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Http.Extensions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Http.Features.3.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Http.Features.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.dll</HintPath>
@@ -83,59 +83,56 @@
<Reference Include="Microsoft.AspNetCore.WebUtilities, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNetCore.WebUtilities.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.3.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Extensions.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
<Reference Include="Microsoft.Extensions.ObjectPool, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.ObjectPool.2.2.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.ObjectPool, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.ObjectPool.3.0.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
<Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.PlatformAbstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.PlatformAbstractions.1.1.0\lib\net451\Microsoft.Extensions.PlatformAbstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Primitives.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
<Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Net.Http.Headers, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
@@ -144,25 +141,25 @@
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Client, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Client.dll</HintPath>
<Reference Include="Opc.Ua.Client, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Client.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Configuration, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Configuration.dll</HintPath>
<Reference Include="Opc.Ua.Configuration, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Configuration.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Core, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Core.dll</HintPath>
<Reference Include="Opc.Ua.Core, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Core.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Gds.Client.Common, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Gds.Client.Common.dll</HintPath>
<Reference Include="Opc.Ua.Gds.Client.Common, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Gds.Client.Common.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Gds.Server.Common, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Gds.Server.Common.dll</HintPath>
<Reference Include="Opc.Ua.Gds.Server.Common, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Gds.Server.Common.dll</HintPath>
</Reference>
<Reference Include="Opc.Ua.Server, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Server.dll</HintPath>
<Reference Include="Opc.Ua.Server, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Server.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -172,8 +169,8 @@
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.6.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Collections.NonGeneric, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.NonGeneric.4.3.0\lib\net46\System.Collections.NonGeneric.dll</HintPath>
@@ -182,11 +179,10 @@
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ComponentModel.Annotations.4.6.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
<HintPath>..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
@@ -196,9 +192,8 @@
<Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
</Reference>
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -219,13 +214,12 @@
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
@@ -254,20 +248,17 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Private.ServiceModel, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Private.ServiceModel.4.6.0\lib\netstandard2.0\System.Private.ServiceModel.dll</HintPath>
<Reference Include="System.Reflection.DispatchProxy, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.DispatchProxy.4.5.1\lib\net461\System.Reflection.DispatchProxy.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.DispatchProxy, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.DispatchProxy.4.6.0\lib\net461\System.Reflection.DispatchProxy.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=1.4.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.Metadata.1.7.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.5.1\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.6.0\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
@@ -280,10 +271,6 @@
<Reference Include="System.Runtime.Serialization.Xml, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Serialization.Xml.4.3.0\lib\net46\System.Runtime.Serialization.Xml.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.AccessControl, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.4.6.0\lib\net461\System.Security.AccessControl.dll</HintPath>
</Reference>
<Reference Include="System.Security.Claims, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Claims.4.3.0\lib\net46\System.Security.Claims.dll</HintPath>
</Reference>
@@ -292,8 +279,8 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Cng.4.6.0\lib\net461\System.Security.Cryptography.Cng.dll</HintPath>
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Cng.4.5.0\lib\net461\System.Security.Cryptography.Cng.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
@@ -306,27 +293,19 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Xml, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Xml.4.6.0\lib\net461\System.Security.Cryptography.Xml.dll</HintPath>
</Reference>
<Reference Include="System.Security.Permissions, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Permissions.4.6.0\lib\net461\System.Security.Permissions.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.4.6.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
<Reference Include="System.Security.Principal.Windows, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Primitives, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ServiceModel.Primitives.4.6.0\lib\net461\System.ServiceModel.Primitives.dll</HintPath>
<Reference Include="System.ServiceModel.Primitives, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.ServiceModel.Primitives.4.5.3\lib\net461\System.ServiceModel.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encodings.Web, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.4.6.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
<Reference Include="System.Text.Encodings.Web, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -341,7 +320,6 @@
<Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs">
@@ -370,15 +348,34 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\XmlNodeParser.cs" />
<Compile Include="Windows\ServerDiagnosticsCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\ServerDiagnosticsCtrl.Designer.cs">
<DependentUpon>ServerDiagnosticsCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Services\WindowsFormServerStarter.cs" />
<Compile Include="Windows\ExceptionDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\ExceptionDlg.Designer.cs">
<DependentUpon>ExceptionDlg.cs</DependentUpon>
</Compile>
<Compile Include="Windows\ServerForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\ServerForm.Designer.cs">
<DependentUpon>ServerForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="CONF\DATA\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="CONF\DATA\TracciatoXmlCnc.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Server.Config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -389,7 +386,6 @@
<Name>OpcUaCommon</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+93 -185
View File
@@ -4,201 +4,109 @@ using OpcUaCommon.Services;
using OpcUaServer.Server.Services;
using System;
using System.Collections.Generic;
using System.IdentityModel;
namespace OpcUaServer.Server
{
public class Server : StandardServer
public class Server : StandardServer
{
private ServerNodeManager _serverNodeManager;
private readonly IPrinter _printer;
private readonly string _pathXml;
private readonly ServerAuthenticationService _serverAuthenticationService;
/// <summary>
/// Evento richiesta refresh invio dellos tato attuale delel conditions
/// </summary>
public event EventHandler eh_reqRefreshCondition;
public Server(IPrinter printer, string pathXml)
{
#region Private Fields
_printer = printer;
_pathXml = pathXml;
_serverAuthenticationService = new ServerAuthenticationService(this);
}
private readonly string _pathXml;
private readonly IPrinter _printer;
private readonly ServerAuthenticationService _serverAuthenticationService;
private ServerNodeManager _serverNodeManager;
public void SetNodeValue(string nodeName, object value)
{
_serverNodeManager.SetNodeValue(nodeName, value);
}
#endregion Private Fields
public void ReportEvent(string nodeName, string eventMessage, string severity, string value, bool active)
{
_serverNodeManager.ReportEvent(nodeName, eventMessage, severity, value, active);
}
#region Public Fields
protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration)
{
_printer.Print(">>>>> Server: Creating node manager");
/// <summary>
/// Elenco dei nodi vietati ("P") per user non autenticati
/// </summary>
public static List<string> NodeVetoList = new List<string>();
#endregion Public Fields
#region Public Constructors
public Server(IPrinter printer, string pathXml)
{
_printer = printer;
_pathXml = pathXml;
_serverAuthenticationService = new ServerAuthenticationService(this);
}
#endregion Public Constructors
#region Public Events
/// <summary>
/// Evento richiesta refresh invio dellos tato attuale delel conditions
/// </summary>
public event EventHandler eh_reqRefreshCondition;
#endregion Public Events
#region Private Methods
private void SessionManager_ImpersonateUser(Session session, ImpersonateEventArgs args)
{
// check for a user name token.
_printer.Print(">>>>> Server: Authentication for session starting");
switch (args.NewIdentity)
{
case UserNameIdentityToken userNameToken:
args.Identity =
_serverAuthenticationService.VerifyPassword(userNameToken,
LoadServerProperties().ProductUri);
_printer.Print(">>>>> Server: Authentication for session userNameToken Accepted: " + args.Identity.DisplayName);
break;
case X509IdentityToken x509Token:
_serverAuthenticationService.VerifyUserTokenCertificate(x509Token.Certificate,
LoadServerProperties().ProductUri);
args.Identity = new UserIdentity(x509Token);
_printer.Print(">>>>> Server: Authentication for session X509 Token Accepted: " +
args.Identity.DisplayName);
break;
default:
_printer.Print(">>>>> Server: Authentication for session Anonymous: ");
break;
}
// 2019.04.08: aggiunta task x forzare il refresh/reinvio di TUTTE le conditions attive al momento in cui si è connesso il NUOVO client...
sendCurrCond();
}
#endregion Private Methods
#region Protected Methods
protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration)
{
_printer.Print(">>>>> Server: Creating node manager");
_serverNodeManager = new ServerNodeManager(server, configuration, _printer, new XmlNodeParser(), _pathXml);
var nodeManagers = new List<INodeManager>
_serverNodeManager = new ServerNodeManager(server, configuration, _printer, new XmlNodeParser(), _pathXml);
var nodeManagers = new List<INodeManager>
{
_serverNodeManager
};
return new MasterNodeManager(server, configuration, null, nodeManagers.ToArray());
}
protected override ServerProperties LoadServerProperties()
{
var properties = new ServerProperties
{
ManufacturerName = "Steamware",
ProductName = "Server",
ProductUri = "http://opcfoundation.org/Quickstart/ReferenceServer/v1.03",
SoftwareVersion = Utils.GetAssemblySoftwareVersion(),
BuildNumber = Utils.GetAssemblyBuildNumber(),
BuildDate = Utils.GetAssemblyTimestamp()
};
return properties;
}
protected override void OnServerStarted(IServerInternal server)
{
base.OnServerStarted(server);
server.SessionManager.ImpersonateUser += SessionManager_ImpersonateUser;
}
#endregion Protected Methods
#region Public Methods
public override ResponseHeader Browse(RequestHeader requestHeader, ViewDescription view, uint requestedMaxReferencesPerNode, BrowseDescriptionCollection nodesToBrowse, out BrowseResultCollection results, out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
OperationContext context = ValidateRequest(requestHeader, RequestType.Browse);
try
{
if (nodesToBrowse == null || nodesToBrowse.Count == 0)
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}
bool filter = false;
// return empty browse results for Anonymous users
// This logic should be further extended....
if (context.UserIdentity.TokenType == UserTokenType.Anonymous)
filter = true;
// legge gli oggetti contenuti nell'elemento richeisto
ServerInternal.NodeManager.Browse(context, view, requestedMaxReferencesPerNode, nodesToBrowse, out results, out diagnosticInfos);
// se attivato il filtro == utente anonimo
if (filter)
{
foreach (var res in results)
{
// rimuove tutto tranne status...
//res.References.RemoveAll(x => x.BrowseName.Name.StartsWith("Machine/") && x.BrowseName.Name != "Machine/Status");
//res.References.RemoveAll(x => x.NodeClass == NodeClass.Variable && (x.BrowseName.Name.StartsWith("Machine/") && x.BrowseName.Name != "Machine/Status"));
res.References.RemoveAll(x => x.BrowseName.Name.StartsWith("Machine/") && NodeVetoList.Contains(x.BrowseName.Name));
}
}
return CreateResponse(requestHeader, context.StringTable);
}
catch (ServiceResultException e)
{
lock (ServerInternal.DiagnosticsWriteLock)
{
ServerInternal.ServerDiagnostics.RejectedRequestsCount++;
if (IsSecurityError(e.StatusCode))
{
ServerInternal.ServerDiagnostics.SecurityRejectedRequestsCount++;
}
}
throw TranslateException(context, e);
}
finally
{
OnRequestComplete(context);
}
}
public void ReportEvent(string nodeName, string eventMessage, string severity, string value, bool active)
{
_serverNodeManager.ReportEvent(nodeName, eventMessage, severity, value, active);
}
public void sendCurrCond()
{
if (eh_reqRefreshCondition != null)
{
eh_reqRefreshCondition(this, new EventArgs());
}
}
public void SetNodeValue(string nodeName, object value)
{
_serverNodeManager.SetNodeValue(nodeName, value);
}
#endregion Public Methods
return new MasterNodeManager(server, configuration, null, nodeManagers.ToArray());
}
}
protected override ServerProperties LoadServerProperties()
{
var properties = new ServerProperties
{
ManufacturerName = "Steamware",
ProductName = "Server",
ProductUri = "http://opcfoundation.org/Quickstart/ReferenceServer/v1.03",
SoftwareVersion = Utils.GetAssemblySoftwareVersion(),
BuildNumber = Utils.GetAssemblyBuildNumber(),
BuildDate = Utils.GetAssemblyTimestamp()
};
return properties;
}
protected override void OnServerStarted(IServerInternal server)
{
base.OnServerStarted(server);
server.SessionManager.ImpersonateUser += SessionManager_ImpersonateUser;
}
private void SessionManager_ImpersonateUser(Session session, ImpersonateEventArgs args)
{
// check for a user name token.
_printer.Print(">>>>> Server: Authentication for session starting");
switch (args.NewIdentity)
{
case UserNameIdentityToken userNameToken:
args.Identity =
_serverAuthenticationService.VerifyPassword(userNameToken,
LoadServerProperties().ProductUri);
_printer.Print(">>>>> Server: Authentication for session userNameToken Accepted: " + args.Identity.DisplayName);
break;
case X509IdentityToken x509Token:
_serverAuthenticationService.VerifyUserTokenCertificate(x509Token.Certificate,
LoadServerProperties().ProductUri);
args.Identity = new UserIdentity(x509Token);
_printer.Print(">>>>> Server: Authentication for session X509 Token Accepted: " +
args.Identity.DisplayName);
break;
default:
_printer.Print(">>>>> Server: Authentication for session Anonymous: ");
break;
}
// 2019.04.08: aggiunta task x forzare il refresh/reinvio di TUTTE le conditions attive al momento in cui si è connesso il NUOVO client...
sendCurrCond();
}
public void sendCurrCond()
{
if(eh_reqRefreshCondition!=null)
{
eh_reqRefreshCondition(this, new EventArgs());
}
}
}
}
+1 -33
View File
@@ -1,4 +1,5 @@
using OpcUaCommon.Services;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Threading;
@@ -22,15 +23,10 @@ namespace OpcUaServer.Server
/// Dictionary dell'elenco delle condizioni passate dal server con ULTIMO stato disponibile (attiva/disattiva)
/// </summary>
protected Dictionary<string, CondHelper> currConditions;
/// <summary>
/// Elenco dei valori dei nodi (Property + Value)
/// </summary>
protected Dictionary<string, object> currNodeValues;
public ServerDecorator(IPrinter printer, string pathXml)
{
currConditions = new Dictionary<string, CondHelper>();
currNodeValues = new Dictionary<string, object>();
Server = new Server(printer, pathXml);
Server.eh_reqRefreshCondition += Server_eh_reqRefreshConditionAsync;
// conf x tempo std resend...
@@ -45,10 +41,7 @@ namespace OpcUaServer.Server
/// <param name="e"></param>
public async void Server_eh_reqRefreshConditionAsync(object sender, System.EventArgs e)
{
// attenzione con MQTT reinvia solo ULTIME VARIAZIONI ALLARMI (altri stati li considera come già inviati...)
await sendCurrentConditions();
// commentato invio valori on refresh che NON serve...
//await sendAllPropVal();
}
public async Task<string> sendCurrentConditions()
@@ -67,34 +60,9 @@ namespace OpcUaServer.Server
});
return answ;
}
/// <summary>
/// Effettua refresh di TUTTI i nodi NON conditions (proprietà, valori)
/// </summary>
/// <returns></returns>
public async Task<string> sendAllPropVal()
{
string answ = "";
await Task.Run(() =>
{
Thread.Sleep(waitResendCondition);
foreach (var item in currNodeValues)
{
// invio con ReportEvent!
Server.SetNodeValue(item.Key, item.Value);
}
});
return answ;
}
public void SetNodeValue(string nodeName, object value)
{
// se c'è elimino
if (currNodeValues.ContainsKey(nodeName))
{
currNodeValues.Remove(nodeName);
}
currNodeValues.Add(nodeName, value);
// faccio report valore!
Server.SetNodeValue(nodeName, value);
}
@@ -0,0 +1,152 @@
using System;
using System.Collections.Generic;
using Opc.Ua;
using OpcUaServer.Server.Model;
namespace OpcUaServer.Server.Services
{
public class FakeNodeParser
{
public FolderInstanceState Parse(ServerNodeManager serverNodeManager, IList<IReference> externalReferences)
{
var folderInstanceState = new FolderInstanceState();
CreateRootFolder(externalReferences, serverNodeManager, folderInstanceState);
CreateChildernNodes(folderInstanceState, serverNodeManager);
return folderInstanceState;
}
private void CreateRootFolder(IList<IReference> references, ServerNodeManager serverNodeManager, FolderInstanceState folderInstanceState)
{
var root = CreateFolder(null, "CNC", "CNC", serverNodeManager);
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
references.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
root.EventNotifier = EventNotifiers.SubscribeToEvents;
//AddRootNotifier(root);
folderInstanceState.Folder = root;
}
private BaseDataVariableState CreateVariable(NodeState parent, string path, string name, BuiltInType dataType, int valueRank, ServerNodeManager serverNodeManager)
{
return CreateVariable(parent, path, name, (uint)dataType, valueRank, serverNodeManager);
}
private void CreateChildernNodes(FolderInstanceState folderInstanceState, ServerNodeManager serverNodeManager)
{
string actuatorFolderName = "Actuator";
FolderState actuatoirFolder = CreateFolder(folderInstanceState.Folder, "/" + actuatorFolderName, actuatorFolderName, serverNodeManager);
string lubrificationFolderName = "Lubrification";
var lubrificationFolder = CreateFolder(actuatoirFolder, lubrificationFolderName, lubrificationFolderName, serverNodeManager);
Dictionary<string, Opc.Ua.BuiltInType> nodes = new Dictionary<string, BuiltInType>();
nodes.Add("Lubro_01", BuiltInType.Int32);
nodes.Add("Lubro_01_status", BuiltInType.String);
foreach (var node in nodes)
{
folderInstanceState.Variables.Add(node.Key, CreateVariable(lubrificationFolder, "/" + actuatorFolderName + "/" + node.Key, node.Key, node.Value, ValueRanks.Any, serverNodeManager));
switch (node.Value)
{
case BuiltInType.Int32:
folderInstanceState.Variables[node.Key].Value = 0;
//_variables[node.Key].OnReadValue = OnReadMyInt32Node;
break;
case BuiltInType.Float:
break;
case BuiltInType.Double:
break;
case BuiltInType.String:
folderInstanceState.Variables[node.Key].Value = "Good";
//_variables[node.Key].OnReadValue = OnReadMyStringNode;
break;
case BuiltInType.DateTime:
break;
case BuiltInType.Variant:
break;
case BuiltInType.Number:
break;
case BuiltInType.Integer:
break;
default:
break;
}
;
}
}
/// <summary>
/// Creates a new variable.
/// </summary>
private BaseDataVariableState CreateVariable(NodeState parent, string path, string name, NodeId dataType, int valueRank, ServerNodeManager serverNodeManager)
{
BaseDataVariableState variable = new BaseDataVariableState(parent)
{
SymbolicName = name,
ReferenceTypeId = Opc.Ua.ReferenceTypes.Organizes,
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
NodeId = new NodeId(path, serverNodeManager.NamespaceIndex),
BrowseName = new QualifiedName(path, serverNodeManager.NamespaceIndex),
DisplayName = new LocalizedText("en", name),
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
DataType = dataType,
ValueRank = valueRank,
AccessLevel = AccessLevels.CurrentReadOrWrite,
UserAccessLevel = AccessLevels.CurrentReadOrWrite,
Historizing = false,
StatusCode = StatusCodes.Good,
Timestamp = DateTime.UtcNow
};
if (valueRank == ValueRanks.OneDimension)
{
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
}
else if (valueRank == ValueRanks.TwoDimensions)
{
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
}
if (parent != null)
{
parent.AddChild(variable);
}
return variable;
}
private FolderState CreateFolder(NodeState parent, string path, string name, ServerNodeManager serverNodeManager)
{
var folder = new FolderState(parent)
{
SymbolicName = name,
ReferenceTypeId = ReferenceTypes.Organizes,
TypeDefinitionId = ObjectTypeIds.FolderType,
NodeId = new NodeId(path, serverNodeManager.NamespaceIndex),
BrowseName = new QualifiedName(path, serverNodeManager.NamespaceIndex),
DisplayName = new LocalizedText("en", name),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
EventNotifier = EventNotifiers.None
};
parent?.AddChild(folder);
return folder;
}
public Dictionary<string, BaseDataVariableState> Parse(ServerNodeManager serverNodeManager, IList<IReference> externalReferences, Dictionary<string, BaseDataVariableState> variables)
{
throw new NotImplementedException();
}
}
}
@@ -1,37 +1,18 @@
using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using Opc.Ua;
using OpcUaCommon.Services;
namespace OpcUaServer.Server.Services
{
public class ServerAuthenticationService
{
#region Private Fields
private readonly Server _server;
#endregion Private Fields
#region Public Constructors
public ServerAuthenticationService(Server server)
{
_server = server;
}
#endregion Public Constructors
#region Public Methods
public static string ReverseString(string s)
{
char[] array = s.ToCharArray();
Array.Reverse(array);
return new string(array);
}
public IUserIdentity VerifyPassword(UserNameIdentityToken userNameToken, string productUri)
{
var userName = userNameToken.UserName;
@@ -56,16 +37,9 @@ namespace OpcUaServer.Server.Services
// return new SystemConfigurationIdentity(new UserIdentity(userNameToken));
//}
// user / passphrase / pwd
// 9206 / 9206_6029 / lH01JCwOzgPG5zjl26p1qA==
// standard users for CTT verification
string passphrase = $"{userName}_{ReverseString(userName)}";
//bool hashUser = CryptoUtils.validateUserPwd(userName, password, passphrase);
//if ((userName == "scmAdmin" && password == "passwordDifficile"))
if (CryptoUtils.validateUserPwd(userName, password, passphrase))
return new UserIdentity(userNameToken);
if ((userName == "user1" && password == "password") ||
(userName == "user2" && password == "password1")) return new UserIdentity(userNameToken);
// construct translation object with default text.
var info = new TranslationInfo(
"InvalidPassword",
@@ -79,6 +53,7 @@ namespace OpcUaServer.Server.Services
"InvalidPassword",
productUri,
new LocalizedText(info)));
}
public void VerifyUserTokenCertificate(X509Certificate2 certificate, string productUri)
@@ -129,6 +104,5 @@ namespace OpcUaServer.Server.Services
}
}
#endregion Public Methods
}
}
@@ -155,9 +155,7 @@ namespace OpcUaServer.Server.Services
node.ConditionName.Value = value;
node.Time.Value = DateTime.UtcNow;
node.ReceiveTime.Value = node.Time.Value;
// 2019.08.07 commentato che si pianta
//node.LocalTime.Value = Utils.GetTimeZoneInfo();
node.LocalTime.Value = Utils.GetTimeZoneInfo();
// 2019.03.23 imposto forzatamente retain del valore
node.EventId.Value = Guid.NewGuid().ToByteArray();
@@ -0,0 +1,36 @@
using System;
using System.Windows.Forms;
using Opc.Ua.Configuration;
using OpcUaServer.Server.OpcUa;
using OpcUaServer.Server.Windows;
namespace OpcUaServer.Server.Services
{
public class WindowsFormServerStarter : IServerStarter
{
private readonly ApplicationInstanceBuilder _applicationInstanceBuilder;
public WindowsFormServerStarter(ApplicationInstanceBuilder applicationInstanceBuilder)
{
_applicationInstanceBuilder = applicationInstanceBuilder;
}
public void Start()
{
var application = _applicationInstanceBuilder.Build(null);
try
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
ApplicationInstance.MessageDlg = new ApplicationMessageDlg();
Application.Run(new ServerForm(application));
}
catch (Exception e)
{
ExceptionDlg.Show(application.ApplicationName, e);
}
}
}
}
+406 -442
View File
@@ -8,450 +8,414 @@ using System.Xml;
namespace OpcUaServer.Server.Services
{
public class XmlNodeParser : INodeParser
public class XmlNodeParser : INodeParser
{
public FolderInstanceState Parse(SystemContext systemContext, IEnumerable<ushort> namespaceIndexes, IList<IReference> externalReferences, string pathXml)
{
#region Public Properties
var treeInstance = new FolderInstanceState();
var xmlDocument = new XmlDocument();
xmlDocument.Load(pathXml);
public Server Server { get; }
var itemRef = xmlDocument.GetElementsByTagName("Machine");
#endregion Public Properties
var rootFolder = CreateRootFolder(itemRef, externalReferences, treeInstance, namespaceIndexes.ToArray().First());
#region Private Methods
private static int GetValueRankFromString(string valueRank)
{
var returnValue = 0;
switch (valueRank)
{
case "Scalar":
returnValue = ValueRanks.Scalar;
break;
default:
break;
}
return returnValue;
}
private void AddCondition(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
string rootName, FolderState root)
{
if (component == null || component.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var bName = rootName + "/" + symbolicName;
var baseObjectState = CreateCondition(root, bName, symbolicName, varName, component.Attributes["Type"].Value,
nameSpaceIndex);
treeInstance.Variables.Add(bName,
baseObjectState);
// verifico se l'elemento sia di quelli permessi --> metto in lista...
string VGroup = component.Attributes["VGroup"]?.Value ?? "A";
checkVisibGroup(VGroup, bName);
}
private void AddEvent(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component, string rootName, FolderState root)
{
if (component?.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
treeInstance.Variables.Add(rootName + "/" + symbolicName,
CreateEvent(root, rootName + "/" + symbolicName, symbolicName, varName, nameSpaceIndex));
}
private void AddNode(FolderInstanceState folderInstanceState, ushort nameSpaceIndex, string stringFolderName,
FolderState folder, XmlElement xmlElement)
{
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions")
{
switch (xmlElement.Name)
{
case "Property":
AddProperty(folder, xmlElement, stringFolderName, nameSpaceIndex, folderInstanceState);
break;
case "Condition":
AddCondition(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
break;
default:
AddVariable(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
break;
}
}
else
{
var varName = xmlElement.Attributes["Name"].Value;
if (xmlElement.Name == "Conditions")
{
//CreateConditions(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
}
else
{
CreateFolder(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
}
// verifico se l'elemento sia di quelli permessi --> metto in lista...
string VGroup = xmlElement.Attributes["VGroup"]?.Value ?? "A";
string bName = stringFolderName + "/" + varName;
checkVisibGroup(VGroup, bName);
}
}
private void AddProperty(BaseObjectState parent, XmlNode component, string rootName, ushort nameSpaceIndex,
FolderInstanceState treeInstance)
{
if (component.Attributes == null)
{
return;
}
PropertyState propertyState;
switch (component.Attributes["DataType"].Value)
{
case "ua:UInt32":
propertyState = parent.AddProperty<int>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Int32, ValueRanks.Scalar);
break;
case "ua:Double":
propertyState = parent.AddProperty<double>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Double, ValueRanks.Scalar);
break;
case "ua:Float":
propertyState = parent.AddProperty<float>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Float, ValueRanks.Scalar);
break;
case "ua:String":
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
DataTypeIds.String, ValueRanks.Scalar);
break;
case "ua:DateTime":
propertyState = parent.AddProperty<DateTime>(component.Attributes["SymbolicName"].Value,
DataTypeIds.DateTime, ValueRanks.Scalar);
break;
case "ua:Boolean":
propertyState = parent.AddProperty<bool>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Boolean, ValueRanks.Scalar);
break;
default:
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
DataTypeIds.String, ValueRanks.Scalar);
break;
}
propertyState.Value = component.Attributes["Value"].Value;
propertyState.NodeId = new NodeId(rootName + "/" + component.Attributes["SymbolicName"].Value, nameSpaceIndex);
propertyState.BrowseName = rootName + "/" + component.Attributes["SymbolicName"].Value;
propertyState.TypeDefinitionId = VariableTypeIds.PropertyType;
var bName = propertyState.BrowseName.Name;
var type = propertyState.DataType;
var rank = propertyState.ValueRank;
treeInstance.Variables.Add(bName,
CreateVariable(parent, bName, bName, bName, type, rank,
nameSpaceIndex));
// verifico se l'elemento sia di quelli permessi --> metto in lista...
string VGroup = component.Attributes["VGroup"]?.Value ?? "A";
checkVisibGroup(VGroup, bName);
}
private void AddVariable(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
string rootName, FolderState root)
{
//Eventi e variabili
if (component == null || component.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var dataType = component.Attributes["DataType"].Value;
var valueRank = component.Attributes["ValueRank"].Value;
var builtInType = (uint)GetBuiltInTypeFromString(dataType);
var valueRankFromString = GetValueRankFromString(valueRank);
var bName = rootName + "/" + symbolicName;
var baseDataVariableState = CreateVariable(root, bName, symbolicName, varName, builtInType, valueRankFromString,
nameSpaceIndex);
treeInstance.Variables.Add(bName,
baseDataVariableState);
// verifico se l'elemento sia di quelli permessi --> metto in lista...
string VGroup = component.Attributes["VGroup"]?.Value ?? "A";
checkVisibGroup(VGroup, bName);
}
private void checkVisibGroup(string VGroup, string BrowseName)
{
if (VGroup != "A")
{
Server.NodeVetoList.Add(BrowseName);
}
}
private BaseObjectState CreateCondition(NodeState parent, string path, string symbolicName, string name, string conditiontype, ushort nameSpaceIndex)
{
var node = new BaseObjectState(parent)
{
SymbolicName = symbolicName,
Description = name,
TypeDefinitionId = ObjectTypeIds.BaseObjectType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
ReferenceTypeId = ReferenceTypeIds.HasEventSource,
EventNotifier = EventNotifiers.SubscribeToEvents
};
//AlarmConditionState node = new AlarmConditionState(parent);
//node.SymbolicName = symbolicName;
//// add optional components.
//node.Comment = new ConditionVariableState<LocalizedText>(node);
//node.ClientUserId = new PropertyState<string>(node);
//node.AddComment = new AddCommentMethodState(node);
//node.ConfirmedState = new TwoStateVariableState(node);
//node.Confirm = new AddCommentMethodState(node);
//node.SuppressedState = new TwoStateVariableState(node);
//node.ShelvingState = new ShelvedStateMachineState(node);
//node.EnabledState = new TwoStateVariableState(node);
//node.EnabledState.TransitionTime = new PropertyState<DateTime>(node.EnabledState);
//node.EnabledState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.EnabledState);
//node.EnabledState.Create(_systemContext, null, BrowseNames.EnabledState, null, false);
//// same procedure add optional components to the ActiveState component.
//node.ActiveState = new TwoStateVariableState(node);
//node.ActiveState.TransitionTime = new PropertyState<DateTime>(node.ActiveState);
//node.ActiveState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.ActiveState);
//node.ActiveState.Create(_systemContext, null, BrowseNames.ActiveState, null, false);
//// specify reference type between the source and the alarm.
//node.ReferenceTypeId = ReferenceTypeIds.HasEventSource;
//node.EventNotifier = EventNotifiers.SubscribeToEvents;
//node.Create(
// _systemContext,
// new NodeId(path, nameSpaceIndex),
// new QualifiedName(path, nameSpaceIndex),
// new LocalizedText("en", symbolicName),
// true);
parent.AddChild(node);
// initialize event information.node
//node.EventType.Value = node.TypeDefinitionId;
//node.SourceNode.Value = new NodeId(path, nameSpaceIndex);
//node.SourceName.Value = path;
return node;
}
private BaseObjectState CreateEvent(NodeState parent, string path, string symbolicName, string name, ushort nameSpaceIndex)
{
var variable = new SystemEventState(parent)
{
SymbolicName = symbolicName,
Description = name,
ReferenceTypeId = Opc.Ua.ReferenceTypes.HasEventSource,
TypeDefinitionId = ObjectTypeIds.SystemEventType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
EventNotifier = EventNotifiers.SubscribeToEvents
};
parent?.AddChild(variable);
return variable;
}
private FolderState CreateFolder(NodeState parent, string path, string name, IEnumerable component,
string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
{
var stringFolderName = stringNome + "/" + name;
var folder = new FolderState(parent)
{
SymbolicName = name,
ReferenceTypeId = ReferenceTypes.Organizes,
TypeDefinitionId = ObjectTypeIds.FolderType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", name),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
//EventNotifier = EventNotifiers.SubscribeToEvents
};
parent?.AddChild(folder);
if (component == null)
{
return folder;
}
foreach (XmlElement xmlElement in component)
{
AddNode(folderInstanceState, nameSpaceIndex, stringFolderName, folder, xmlElement);
}
return folder;
}
private FolderState CreateRootFolder(XmlNodeList itemRef, ICollection<IReference> externalReferences, FolderInstanceState treeInstance, ushort nameSpaceIndex)
{
var rootName = "Machine";
var root = CreateFolder(null, rootName, rootName, null, null, treeInstance, nameSpaceIndex);
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
externalReferences.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
root.EventNotifier = EventNotifiers.SubscribeToEvents;
var xmlNodeList = itemRef[0]?.ChildNodes;
if (xmlNodeList == null)
{
return root;
}
foreach (XmlElement xmlElement in xmlNodeList)
{
AddNode(treeInstance, nameSpaceIndex, rootName, root, xmlElement);
}
return root;
}
private BaseDataVariableState CreateVariable(NodeState parent, string path, string symbolicName, string name, NodeId dataType, int valueRank, ushort nameSpaceIndex)
{
var variable = new BaseDataVariableState(parent)
{
SymbolicName = symbolicName,
Description = name,
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
DataType = dataType,
ValueRank = valueRank,
AccessLevel = AccessLevels.CurrentRead,
UserAccessLevel = AccessLevels.CurrentRead,
Historizing = false,
StatusCode = StatusCodes.Good,
Timestamp = DateTime.UtcNow
};
switch (valueRank)
{
case ValueRanks.OneDimension:
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
break;
case ValueRanks.TwoDimensions:
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
break;
default:
break;
}
parent?.AddChild(variable);
return variable;
}
#endregion Private Methods
#region Public Methods
//private FolderState CreateConditions(NodeState parent, string path, string name, IEnumerable component, string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
//{
// FolderState folder = CreateFolder(parent, path+ "/" + name, name, component, stringNome, folderInstanceState, nameSpaceIndex);
// folder.ReferenceTypeId = ReferenceTypeIds.HasNotifier;
// ((FolderState)parent).ReferenceTypeId = ReferenceTypeIds.HasNotifier;
// return folder;
//}
public static BuiltInType GetBuiltInTypeFromString(string dataType)
{
var returnValue = BuiltInType.Null;
switch (dataType)
{
case "ua:UInt32":
returnValue = BuiltInType.UInt32;
break;
case "ua:Double":
returnValue = BuiltInType.Double;
break;
case "ua:Float":
returnValue = BuiltInType.Float;
break;
case "ua:String":
returnValue = BuiltInType.String;
break;
case "ua:DateTime":
returnValue = BuiltInType.DateTime;
break;
case "ua:Boolean":
returnValue = BuiltInType.Boolean;
break;
default:
break;
}
return returnValue;
}
public FolderInstanceState Parse(SystemContext systemContext, IEnumerable<ushort> namespaceIndexes, IList<IReference> externalReferences, string pathXml)
{
var treeInstance = new FolderInstanceState();
var xmlDocument = new XmlDocument();
xmlDocument.Load(pathXml);
var itemRef = xmlDocument.GetElementsByTagName("Machine");
var rootFolder = CreateRootFolder(itemRef, externalReferences, treeInstance, namespaceIndexes.ToArray().First());
treeInstance.Folder = rootFolder;
foreach (var baseDataVariableState in treeInstance.Variables)
{
Console.WriteLine("NODE PATH >>>> CHIAVE {0}", baseDataVariableState.Key);
}
return treeInstance;
}
#endregion Public Methods
treeInstance.Folder = rootFolder;
foreach (var baseDataVariableState in treeInstance.Variables)
{
Console.WriteLine("NODE PATH >>>> CHIAVE {0}", baseDataVariableState.Key);
}
return treeInstance;
}
}
private FolderState CreateRootFolder(XmlNodeList itemRef, ICollection<IReference> externalReferences, FolderInstanceState treeInstance, ushort nameSpaceIndex)
{
var rootName = "Machine";
var root = CreateFolder(null, rootName, rootName, null, null, treeInstance, nameSpaceIndex);
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
externalReferences.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
root.EventNotifier = EventNotifiers.SubscribeToEvents;
var xmlNodeList = itemRef[0]?.ChildNodes;
if (xmlNodeList == null)
{
return root;
}
foreach (XmlElement xmlElement in xmlNodeList)
{
AddNode(treeInstance, nameSpaceIndex, rootName, root, xmlElement);
}
return root;
}
private void AddEvent(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component, string rootName, FolderState root)
{
if (component?.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
treeInstance.Variables.Add(rootName + "/" + symbolicName,
CreateEvent(root, rootName + "/" + symbolicName, symbolicName, varName, nameSpaceIndex));
}
private BaseObjectState CreateEvent(NodeState parent, string path, string symbolicName, string name, ushort nameSpaceIndex)
{
var variable = new SystemEventState(parent)
{
SymbolicName = symbolicName,
Description = name,
ReferenceTypeId = Opc.Ua.ReferenceTypes.HasEventSource,
TypeDefinitionId = ObjectTypeIds.SystemEventType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
EventNotifier = EventNotifiers.SubscribeToEvents
};
parent?.AddChild(variable);
return variable;
}
private void AddCondition(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
string rootName, FolderState root)
{
if (component == null || component.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var baseObjectState = CreateCondition(root, rootName + "/" + symbolicName, symbolicName, varName, component.Attributes["Type"].Value,
nameSpaceIndex);
treeInstance.Variables.Add(rootName + "/" + symbolicName,
baseObjectState);
}
private BaseObjectState CreateCondition(NodeState parent, string path, string symbolicName, string name, string conditiontype, ushort nameSpaceIndex)
{
var node = new BaseObjectState(parent)
{
SymbolicName = symbolicName,
Description = name,
TypeDefinitionId = ObjectTypeIds.BaseObjectType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
ReferenceTypeId = ReferenceTypeIds.HasEventSource,
EventNotifier = EventNotifiers.SubscribeToEvents
};
//AlarmConditionState node = new AlarmConditionState(parent);
//node.SymbolicName = symbolicName;
//// add optional components.
//node.Comment = new ConditionVariableState<LocalizedText>(node);
//node.ClientUserId = new PropertyState<string>(node);
//node.AddComment = new AddCommentMethodState(node);
//node.ConfirmedState = new TwoStateVariableState(node);
//node.Confirm = new AddCommentMethodState(node);
//node.SuppressedState = new TwoStateVariableState(node);
//node.ShelvingState = new ShelvedStateMachineState(node);
//node.EnabledState = new TwoStateVariableState(node);
//node.EnabledState.TransitionTime = new PropertyState<DateTime>(node.EnabledState);
//node.EnabledState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.EnabledState);
//node.EnabledState.Create(_systemContext, null, BrowseNames.EnabledState, null, false);
//// same procedure add optional components to the ActiveState component.
//node.ActiveState = new TwoStateVariableState(node);
//node.ActiveState.TransitionTime = new PropertyState<DateTime>(node.ActiveState);
//node.ActiveState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.ActiveState);
//node.ActiveState.Create(_systemContext, null, BrowseNames.ActiveState, null, false);
//// specify reference type between the source and the alarm.
//node.ReferenceTypeId = ReferenceTypeIds.HasEventSource;
//node.EventNotifier = EventNotifiers.SubscribeToEvents;
//node.Create(
// _systemContext,
// new NodeId(path, nameSpaceIndex),
// new QualifiedName(path, nameSpaceIndex),
// new LocalizedText("en", symbolicName),
// true);
parent.AddChild(node);
// initialize event information.node
//node.EventType.Value = node.TypeDefinitionId;
//node.SourceNode.Value = new NodeId(path, nameSpaceIndex);
//node.SourceName.Value = path;
return node;
}
private void AddVariable(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
string rootName, FolderState root)
{
//Eventi e variabili
if (component == null || component.Attributes == null)
{
return;
}
var varName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var dataType = component.Attributes["DataType"].Value;
var valueRank = component.Attributes["ValueRank"].Value;
var builtInType = (uint)GetBuiltInTypeFromString(dataType);
var valueRankFromString = GetValueRankFromString(valueRank);
var baseDataVariableState = CreateVariable(root, rootName + "/" + symbolicName, symbolicName, varName, builtInType, valueRankFromString,
nameSpaceIndex);
treeInstance.Variables.Add(rootName + "/" + symbolicName,
baseDataVariableState);
}
private FolderState CreateFolder(NodeState parent, string path, string name, IEnumerable component,
string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
{
var stringFolderName = stringNome + "/" + name;
var folder = new FolderState(parent)
{
SymbolicName = name,
ReferenceTypeId = ReferenceTypes.Organizes,
TypeDefinitionId = ObjectTypeIds.FolderType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", name),
WriteMask = AttributeWriteMask.None,
UserWriteMask = AttributeWriteMask.None,
//EventNotifier = EventNotifiers.SubscribeToEvents
};
parent?.AddChild(folder);
if (component == null)
{
return folder;
}
foreach (XmlElement xmlElement in component)
{
AddNode(folderInstanceState, nameSpaceIndex, stringFolderName, folder, xmlElement);
}
return folder;
}
//private FolderState CreateConditions(NodeState parent, string path, string name, IEnumerable component, string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
//{
// FolderState folder = CreateFolder(parent, path+ "/" + name, name, component, stringNome, folderInstanceState, nameSpaceIndex);
// folder.ReferenceTypeId = ReferenceTypeIds.HasNotifier;
// ((FolderState)parent).ReferenceTypeId = ReferenceTypeIds.HasNotifier;
// return folder;
//}
private void AddNode(FolderInstanceState folderInstanceState, ushort nameSpaceIndex, string stringFolderName,
FolderState folder, XmlElement xmlElement)
{
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions")
{
switch (xmlElement.Name)
{
case "Property":
AddProperty(folder, xmlElement, stringFolderName, nameSpaceIndex, folderInstanceState);
break;
//case "Event":
// AddEvent(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
// break;
case "Condition":
AddCondition(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
break;
default:
AddVariable(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
break;
}
}
else
{
var varName = xmlElement.Attributes["Name"].Value;
if (xmlElement.Name == "Conditions")
{
//CreateConditions(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
}
else
{
CreateFolder(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
}
}
}
public static BuiltInType GetBuiltInTypeFromString(string dataType)
{
var returnValue = BuiltInType.Null;
switch (dataType)
{
case "ua:UInt32":
returnValue = BuiltInType.UInt32;
break;
case "ua:Double":
returnValue = BuiltInType.Double;
break;
case "ua:Float":
returnValue = BuiltInType.Float;
break;
case "ua:String":
returnValue = BuiltInType.String;
break;
case "ua:DateTime":
returnValue = BuiltInType.DateTime;
break;
case "ua:Boolean":
returnValue = BuiltInType.Boolean;
break;
default:
break;
}
return returnValue;
}
private void AddProperty(BaseObjectState parent, XmlNode component, string rootName, ushort nameSpaceIndex,
FolderInstanceState treeInstance)
{
if (component.Attributes == null)
{
return;
}
PropertyState propertyState;
switch (component.Attributes["DataType"].Value)
{
case "ua:UInt32":
propertyState = parent.AddProperty<int>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Int32, ValueRanks.Scalar);
break;
case "ua:Double":
propertyState = parent.AddProperty<double>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Double, ValueRanks.Scalar);
break;
case "ua:Float":
propertyState = parent.AddProperty<float>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Float, ValueRanks.Scalar);
break;
case "ua:String":
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
DataTypeIds.String, ValueRanks.Scalar);
break;
case "ua:DateTime":
propertyState = parent.AddProperty<DateTime>(component.Attributes["SymbolicName"].Value,
DataTypeIds.DateTime, ValueRanks.Scalar);
break;
case "ua:Boolean":
propertyState = parent.AddProperty<bool>(component.Attributes["SymbolicName"].Value,
DataTypeIds.Boolean, ValueRanks.Scalar);
break;
default:
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
DataTypeIds.String, ValueRanks.Scalar);
break;
}
propertyState.Value = component.Attributes["Value"].Value;
propertyState.NodeId = new NodeId(rootName + "/" + component.Attributes["SymbolicName"].Value, nameSpaceIndex);
propertyState.BrowseName = rootName + "/" + component.Attributes["SymbolicName"].Value;
propertyState.TypeDefinitionId = VariableTypeIds.PropertyType;
var bName = propertyState.BrowseName.Name;
var type = propertyState.DataType;
var rank = propertyState.ValueRank;
treeInstance.Variables.Add(bName,
CreateVariable(parent, bName, bName, bName, type, rank,
nameSpaceIndex));
}
private static int GetValueRankFromString(string valueRank)
{
var returnValue = 0;
switch (valueRank)
{
case "Scalar":
returnValue = ValueRanks.Scalar;
break;
default:
break;
}
return returnValue;
}
private BaseDataVariableState CreateVariable(NodeState parent, string path, string symbolicName, string name, NodeId dataType, int valueRank, ushort nameSpaceIndex)
{
var variable = new BaseDataVariableState(parent)
{
SymbolicName = symbolicName,
Description = name,
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
NodeId = new NodeId(path, nameSpaceIndex),
BrowseName = new QualifiedName(path, nameSpaceIndex),
DisplayName = new LocalizedText("en", symbolicName),
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
DataType = dataType,
ValueRank = valueRank,
AccessLevel = AccessLevels.CurrentRead,
UserAccessLevel = AccessLevels.CurrentRead,
Historizing = false,
StatusCode = StatusCodes.Good,
Timestamp = DateTime.UtcNow
};
switch (valueRank)
{
case ValueRanks.OneDimension:
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
break;
case ValueRanks.TwoDimensions:
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
break;
default:
break;
}
parent?.AddChild(variable);
return variable;
}
}
}
+124
View File
@@ -0,0 +1,124 @@
using System.Windows.Forms;
namespace OpcUaServer.Server.Windows
{
partial class ExceptionDlg
{
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Codice generato da Progettazione componenti
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.BottomPN = new System.Windows.Forms.Panel();
this.ShowStackTracesCK = new System.Windows.Forms.CheckBox();
this.CloseBTN = new System.Windows.Forms.Button();
this.MainPN = new System.Windows.Forms.Panel();
this.ExceptionBrowser = new System.Windows.Forms.WebBrowser();
this.BottomPN.SuspendLayout();
this.MainPN.SuspendLayout();
this.SuspendLayout();
//
// BottomPN
//
this.BottomPN.Controls.Add(this.ShowStackTracesCK);
this.BottomPN.Controls.Add(this.CloseBTN);
this.BottomPN.Dock = System.Windows.Forms.DockStyle.Bottom;
this.BottomPN.Location = new System.Drawing.Point(0, 181);
this.BottomPN.Name = "BottomPN";
this.BottomPN.Size = new System.Drawing.Size(780, 29);
this.BottomPN.TabIndex = 1;
//
// ShowStackTracesCK
//
this.ShowStackTracesCK.AutoSize = true;
this.ShowStackTracesCK.Location = new System.Drawing.Point(3, 7);
this.ShowStackTracesCK.Name = "ShowStackTracesCK";
this.ShowStackTracesCK.Size = new System.Drawing.Size(138, 17);
this.ShowStackTracesCK.TabIndex = 1;
this.ShowStackTracesCK.Text = "Show Exception Details";
this.ShowStackTracesCK.UseVisualStyleBackColor = true;
this.ShowStackTracesCK.CheckedChanged += new System.EventHandler(this.ShowStackTracesCK_CheckedChanged);
//
// CloseBTN
//
this.CloseBTN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.CloseBTN.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CloseBTN.Location = new System.Drawing.Point(353, 3);
this.CloseBTN.Name = "CloseBTN";
this.CloseBTN.Size = new System.Drawing.Size(75, 23);
this.CloseBTN.TabIndex = 0;
this.CloseBTN.Text = "Close";
this.CloseBTN.UseVisualStyleBackColor = true;
//
// MainPN
//
this.MainPN.AutoSize = true;
this.MainPN.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.MainPN.Controls.Add(this.ExceptionBrowser);
this.MainPN.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainPN.Location = new System.Drawing.Point(0, 0);
this.MainPN.Name = "MainPN";
this.MainPN.Size = new System.Drawing.Size(780, 181);
this.MainPN.TabIndex = 1;
//
// ExceptionBrowser
//
this.ExceptionBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.ExceptionBrowser.Location = new System.Drawing.Point(0, 0);
this.ExceptionBrowser.MinimumSize = new System.Drawing.Size(20, 20);
this.ExceptionBrowser.Name = "ExceptionBrowser";
this.ExceptionBrowser.ScriptErrorsSuppressed = true;
this.ExceptionBrowser.Size = new System.Drawing.Size(780, 181);
this.ExceptionBrowser.TabIndex = 1;
//
// ExceptionDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(780, 210);
this.Controls.Add(this.MainPN);
this.Controls.Add(this.BottomPN);
this.MaximumSize = new System.Drawing.Size(4096, 4096);
this.Name = "ExceptionDlg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Exception";
this.BottomPN.ResumeLayout(false);
this.BottomPN.PerformLayout();
this.MainPN.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel BottomPN;
private System.Windows.Forms.Button CloseBTN;
private System.Windows.Forms.Panel MainPN;
private System.Windows.Forms.WebBrowser ExceptionBrowser;
private System.Windows.Forms.CheckBox ShowStackTracesCK;
public FormStartPosition StartPosition { get; private set; }
}
}
@@ -0,0 +1,185 @@
using System;
using System.Text;
using System.Windows.Forms;
using Opc.Ua;
namespace OpcUaServer.Server.Windows
{
public partial class ExceptionDlg : Form
{
public ExceptionDlg()
{
InitializeComponent();
}
private Exception m_exception;
/// <summary>
/// Replaces all special characters in the message.
/// </summary>
private string ReplaceSpecialCharacters(string message)
{
message = message.Replace("&", "&#38;");
message = message.Replace("<", "&lt;");
message = message.Replace(">", "&gt;");
message = message.Replace("\"", "&#34;");
message = message.Replace("'", "&#39;");
message = message.Replace("\r\n", "<br/>");
return message;
}
private void AddBlock(StringBuilder buffer, string text)
{
AddBlock(buffer, text, 0);
}
private void AddBlock(StringBuilder buffer, string text, int level)
{
if (!String.IsNullOrEmpty(text))
{
if (level > 0)
{
if (level == 1)
{
buffer.Append("<tr style='background-color:#990000;");
}
else if (level == 2)
{
buffer.Append("<tr style='background-color:#CC6600;");
}
else
{
buffer.Append("<tr style='background-color:#999999;");
}
buffer.Append("color:#FFFFFF;font-weight:bold;font-size:10pt;font-family:Verdana'><td>");
buffer.Append("<p>");
}
else
{
buffer.Append("<tr style='font-size:10pt;font-family:Verdana'><td>");
buffer.Append("<p>");
}
buffer.Append(ReplaceSpecialCharacters(text));
buffer.Append("</p>");
buffer.Append("</td></tr>");
}
}
private void Add(StringBuilder buffer, Exception e, bool showStackTrace)
{
AddBlock(buffer, "EXCEPTION (" + e.GetType().Name + ")", 1);
AddBlock(buffer, e.Message);
ServiceResultException sre = e as ServiceResultException;
if (sre != null)
{
ServiceResult sr = new ServiceResult(sre);
while (sr != null)
{
AddBlock(buffer, "SERVICE RESULT (" + new StatusCode(sr.Code).ToString() + ")", 2);
string text = (sr.LocalizedText != null) ? sr.LocalizedText.Text : null;
if (text != e.Message)
{
AddBlock(buffer, text);
}
AddBlock(buffer, sr.SymbolicId);
AddBlock(buffer, sr.NamespaceUri);
if (showStackTrace)
{
if (!String.IsNullOrEmpty(sre.AdditionalInfo))
{
AddBlock(buffer, "ADDITIONAL INFO (" + new StatusCode(sr.Code).ToString() + ")", 3);
AddBlock(buffer, sre.AdditionalInfo);
}
}
sr = sr.InnerResult;
}
}
if (showStackTrace)
{
AddBlock(buffer, "STACK TRACE", 3);
AddBlock(buffer, e.StackTrace);
}
}
private void Show(bool showStackTrace)
{
StringBuilder buffer = new StringBuilder();
buffer.Append("<html><body style='margin:0;width:100%'>");
//buffer.Append(ExceptionBrowser.Parent.Width);
//buffer.Append("px'>");
buffer.Append("<table border='1' style='width:100%'>");
Exception e = m_exception;
while (e != null)
{
Add(buffer, e, showStackTrace);
e = e.InnerException;
}
buffer.Append("</table>");
buffer.Append("</body></html>");
ExceptionBrowser.DocumentText = buffer.ToString();
}
/// <summary>
/// Displays the exception in a dialog.
/// </summary>
public static void Show(string caption, Exception e)
{
// check if running as a service.
if (!Environment.UserInteractive)
{
Utils.Trace(e, "Unexpected error in '{0}'.", caption);
return;
}
new ExceptionDlg().ShowDialog(caption, e);
}
/// <summary>
/// Display the exception in the dialog.
/// </summary>
public void ShowDialog(string caption, Exception e)
{
if (!String.IsNullOrEmpty(caption))
{
Text = caption;
}
m_exception = e;
ShowStackTracesCK.Checked = true;
//True in DEBUG
//ShowStackTracesCK.Checked = false;
Show(ShowStackTracesCK.Checked);
ShowDialog();
}
private void OkButton_Click(object sender, EventArgs e)
{
Close();
}
private void ShowStackTracesCK_CheckedChanged(object sender, EventArgs e)
{
Show(ShowStackTracesCK.Checked);
}
}
}
@@ -0,0 +1,359 @@
namespace OpcUaServer.Server
{
partial class ServerDiagnosticsCtrl
{
/// <summary>
/// Variabile di progettazione necessaria.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Pulire le risorse in uso.
/// </summary>
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Codice generato da Progettazione componenti
/// <summary>
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
/// il contenuto del metodo con l'editor di codice.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.MainPN = new System.Windows.Forms.SplitContainer();
this.SessionsGB = new System.Windows.Forms.GroupBox();
this.SessionsLV = new System.Windows.Forms.ListView();
this.SessionIdCH = new System.Windows.Forms.ColumnHeader();
this.SessionNameCH = new System.Windows.Forms.ColumnHeader();
this.UserNameCH = new System.Windows.Forms.ColumnHeader();
this.LastContactTimeCH = new System.Windows.Forms.ColumnHeader();
this.SubscriptionsGB = new System.Windows.Forms.GroupBox();
this.SubscriptionsLV = new System.Windows.Forms.ListView();
this.SubscriptionIdCH = new System.Windows.Forms.ColumnHeader();
this.PublishingIntervalCH = new System.Windows.Forms.ColumnHeader();
this.ItemCountCH = new System.Windows.Forms.ColumnHeader();
this.SequenceNumberCH = new System.Windows.Forms.ColumnHeader();
this.AddressPN = new System.Windows.Forms.Panel();
this.EndpointsLB = new System.Windows.Forms.Label();
this.UrlCB = new System.Windows.Forms.ComboBox();
this.StatusBAR = new System.Windows.Forms.StatusStrip();
this.ServerStatusLB = new System.Windows.Forms.ToolStripStatusLabel();
this.ServerStateLB = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.ServerTimeLB = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.sessionsLB = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.subscriptionsLB = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.itemsLB = new System.Windows.Forms.ToolStripStatusLabel();
this.UpdateTimerCTRL = new System.Windows.Forms.Timer(this.components);
this.MainPN.Panel1.SuspendLayout();
this.MainPN.Panel2.SuspendLayout();
this.MainPN.SuspendLayout();
this.SessionsGB.SuspendLayout();
this.SubscriptionsGB.SuspendLayout();
this.AddressPN.SuspendLayout();
this.StatusBAR.SuspendLayout();
this.SuspendLayout();
//
// MainPN
//
this.MainPN.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainPN.Location = new System.Drawing.Point(0, 32);
this.MainPN.Name = "MainPN";
this.MainPN.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// MainPN.Panel1
//
this.MainPN.Panel1.Controls.Add(this.SessionsGB);
this.MainPN.Panel1.Padding = new System.Windows.Forms.Padding(2);
//
// MainPN.Panel2
//
this.MainPN.Panel2.Controls.Add(this.SubscriptionsGB);
this.MainPN.Panel2.Padding = new System.Windows.Forms.Padding(2);
this.MainPN.Size = new System.Drawing.Size(532, 291);
this.MainPN.SplitterDistance = 131;
this.MainPN.TabIndex = 3;
//
// SessionsGB
//
this.SessionsGB.Controls.Add(this.SessionsLV);
this.SessionsGB.Dock = System.Windows.Forms.DockStyle.Fill;
this.SessionsGB.Location = new System.Drawing.Point(2, 2);
this.SessionsGB.Name = "SessionsGB";
this.SessionsGB.Size = new System.Drawing.Size(528, 127);
this.SessionsGB.TabIndex = 0;
this.SessionsGB.TabStop = false;
this.SessionsGB.Text = "Sessions";
//
// SessionsLV
//
this.SessionsLV.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.SessionIdCH,
this.SessionNameCH,
this.UserNameCH,
this.LastContactTimeCH});
this.SessionsLV.Dock = System.Windows.Forms.DockStyle.Fill;
this.SessionsLV.FullRowSelect = true;
this.SessionsLV.Location = new System.Drawing.Point(3, 16);
this.SessionsLV.Name = "SessionsLV";
this.SessionsLV.Size = new System.Drawing.Size(522, 108);
this.SessionsLV.TabIndex = 0;
this.SessionsLV.UseCompatibleStateImageBehavior = false;
this.SessionsLV.View = System.Windows.Forms.View.Details;
//
// SessionIdCH
//
this.SessionIdCH.Text = "SessionId";
this.SessionIdCH.Width = 101;
//
// SessionNameCH
//
this.SessionNameCH.Text = "Name";
this.SessionNameCH.Width = 90;
//
// UserNameCH
//
this.UserNameCH.Text = "User";
this.UserNameCH.Width = 90;
//
// LastContactTimeCH
//
this.LastContactTimeCH.Text = "Last Contact";
this.LastContactTimeCH.Width = 126;
//
// SubscriptionsGB
//
this.SubscriptionsGB.Controls.Add(this.SubscriptionsLV);
this.SubscriptionsGB.Dock = System.Windows.Forms.DockStyle.Fill;
this.SubscriptionsGB.Location = new System.Drawing.Point(2, 2);
this.SubscriptionsGB.Name = "SubscriptionsGB";
this.SubscriptionsGB.Size = new System.Drawing.Size(528, 152);
this.SubscriptionsGB.TabIndex = 0;
this.SubscriptionsGB.TabStop = false;
this.SubscriptionsGB.Text = "Subscriptions";
//
// SubscriptionsLV
//
this.SubscriptionsLV.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.SubscriptionIdCH,
this.PublishingIntervalCH,
this.ItemCountCH,
this.SequenceNumberCH});
this.SubscriptionsLV.Dock = System.Windows.Forms.DockStyle.Fill;
this.SubscriptionsLV.FullRowSelect = true;
this.SubscriptionsLV.Location = new System.Drawing.Point(3, 16);
this.SubscriptionsLV.Name = "SubscriptionsLV";
this.SubscriptionsLV.Size = new System.Drawing.Size(522, 133);
this.SubscriptionsLV.TabIndex = 0;
this.SubscriptionsLV.UseCompatibleStateImageBehavior = false;
this.SubscriptionsLV.View = System.Windows.Forms.View.Details;
//
// SubscriptionIdCH
//
this.SubscriptionIdCH.Text = "SubscriptionId";
this.SubscriptionIdCH.Width = 90;
//
// PublishingIntervalCH
//
this.PublishingIntervalCH.Text = "Publishing Interval";
this.PublishingIntervalCH.Width = 101;
//
// ItemCountCH
//
this.ItemCountCH.Text = "Item Count";
this.ItemCountCH.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.ItemCountCH.Width = 126;
//
// SequenceNumberCH
//
this.SequenceNumberCH.Text = "Seq No";
this.SequenceNumberCH.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AddressPN
//
this.AddressPN.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.AddressPN.Controls.Add(this.EndpointsLB);
this.AddressPN.Controls.Add(this.UrlCB);
this.AddressPN.Dock = System.Windows.Forms.DockStyle.Top;
this.AddressPN.Location = new System.Drawing.Point(0, 0);
this.AddressPN.Name = "AddressPN";
this.AddressPN.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.AddressPN.Size = new System.Drawing.Size(532, 32);
this.AddressPN.TabIndex = 0;
//
// EndpointsLB
//
this.EndpointsLB.AutoSize = true;
this.EndpointsLB.Location = new System.Drawing.Point(0, 7);
this.EndpointsLB.Name = "EndpointsLB";
this.EndpointsLB.Size = new System.Drawing.Size(113, 13);
this.EndpointsLB.TabIndex = 0;
this.EndpointsLB.Text = "Server Endpoint URLs";
this.EndpointsLB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// UrlCB
//
this.UrlCB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.UrlCB.FormattingEnabled = true;
this.UrlCB.Location = new System.Drawing.Point(119, 4);
this.UrlCB.Name = "UrlCB";
this.UrlCB.Size = new System.Drawing.Size(406, 21);
this.UrlCB.TabIndex = 1;
//
// StatusBAR
//
this.StatusBAR.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ServerStatusLB,
this.ServerStateLB,
this.toolStripStatusLabel1,
this.ServerTimeLB,
this.toolStripStatusLabel2,
this.sessionsLB,
this.toolStripStatusLabel3,
this.subscriptionsLB,
this.toolStripStatusLabel4,
this.itemsLB});
this.StatusBAR.Location = new System.Drawing.Point(0, 323);
this.StatusBAR.Name = "StatusBAR";
this.StatusBAR.Size = new System.Drawing.Size(532, 22);
this.StatusBAR.TabIndex = 1;
this.StatusBAR.Text = "statusStrip1";
//
// ServerStatusLB
//
this.ServerStatusLB.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.ServerStatusLB.Name = "ServerStatusLB";
this.ServerStatusLB.Size = new System.Drawing.Size(45, 17);
this.ServerStatusLB.Text = "Status:";
//
// ServerStateLB
//
this.ServerStateLB.Name = "ServerStateLB";
this.ServerStateLB.Size = new System.Drawing.Size(52, 17);
this.ServerStateLB.Text = "Running";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(84, 17);
this.toolStripStatusLabel1.Text = "Current Time:";
//
// ServerTimeLB
//
this.ServerTimeLB.Name = "ServerTimeLB";
this.ServerTimeLB.Size = new System.Drawing.Size(49, 17);
this.ServerTimeLB.Text = "00:00:00";
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(56, 17);
this.toolStripStatusLabel2.Text = "Sessions:";
//
// sessionsLB
//
this.sessionsLB.Name = "sessionsLB";
this.sessionsLB.Size = new System.Drawing.Size(13, 17);
this.sessionsLB.Text = "0";
//
// toolStripStatusLabel3
//
this.toolStripStatusLabel3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel3.Size = new System.Drawing.Size(84, 17);
this.toolStripStatusLabel3.Text = "Subscriptions:";
//
// subscriptionsLB
//
this.subscriptionsLB.Name = "subscriptionsLB";
this.subscriptionsLB.Size = new System.Drawing.Size(13, 17);
this.subscriptionsLB.Text = "0";
//
// toolStripStatusLabel4
//
this.toolStripStatusLabel4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
this.toolStripStatusLabel4.Size = new System.Drawing.Size(42, 17);
this.toolStripStatusLabel4.Text = "Items:";
//
// itemsLB
//
this.itemsLB.Name = "itemsLB";
this.itemsLB.Size = new System.Drawing.Size(13, 17);
this.itemsLB.Text = "0";
//
// UpdateTimerCTRL
//
this.UpdateTimerCTRL.Interval = 1000;
this.UpdateTimerCTRL.Tick += new System.EventHandler(this.UpdateTimerCTRL_Tick);
//
// ServerDiagnosticsCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.MainPN);
this.Controls.Add(this.StatusBAR);
this.Controls.Add(this.AddressPN);
this.Name = "ServerDiagnosticsCtrl";
this.Size = new System.Drawing.Size(532, 345);
this.MainPN.Panel1.ResumeLayout(false);
this.MainPN.Panel2.ResumeLayout(false);
this.MainPN.ResumeLayout(false);
this.SessionsGB.ResumeLayout(false);
this.SubscriptionsGB.ResumeLayout(false);
this.AddressPN.ResumeLayout(false);
this.AddressPN.PerformLayout();
this.StatusBAR.ResumeLayout(false);
this.StatusBAR.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.SplitContainer MainPN;
private System.Windows.Forms.GroupBox SessionsGB;
private System.Windows.Forms.ListView SessionsLV;
private System.Windows.Forms.ColumnHeader SessionIdCH;
private System.Windows.Forms.ColumnHeader SessionNameCH;
private System.Windows.Forms.ColumnHeader UserNameCH;
private System.Windows.Forms.ColumnHeader LastContactTimeCH;
private System.Windows.Forms.GroupBox SubscriptionsGB;
private System.Windows.Forms.ListView SubscriptionsLV;
private System.Windows.Forms.ColumnHeader SubscriptionIdCH;
private System.Windows.Forms.ColumnHeader PublishingIntervalCH;
private System.Windows.Forms.ColumnHeader ItemCountCH;
private System.Windows.Forms.ColumnHeader SequenceNumberCH;
private System.Windows.Forms.Panel AddressPN;
private System.Windows.Forms.Label EndpointsLB;
private System.Windows.Forms.ComboBox UrlCB;
private System.Windows.Forms.StatusStrip StatusBAR;
private System.Windows.Forms.ToolStripStatusLabel ServerStatusLB;
private System.Windows.Forms.ToolStripStatusLabel ServerStateLB;
private System.Windows.Forms.ToolStripStatusLabel ServerTimeLB;
private System.Windows.Forms.Timer UpdateTimerCTRL;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripStatusLabel sessionsLB;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.ToolStripStatusLabel subscriptionsLB;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
private System.Windows.Forms.ToolStripStatusLabel itemsLB;
}
}
@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Opc.Ua;
using Opc.Ua.Server;
namespace OpcUaServer.Server
{
public partial class ServerDiagnosticsCtrl : UserControl
{
private StandardServer m_server;
private ApplicationConfiguration m_configuration;
public ServerDiagnosticsCtrl()
{
InitializeComponent();
}
public void Initialize(StandardServer server, ApplicationConfiguration configuration)
{
m_server = server;
m_configuration = configuration;
UpdateTimerCTRL.Enabled = true;
// add the urls to the drop down.
UrlCB.Items.Clear();
foreach (EndpointDescription endpoint in m_server.GetEndpoints())
{
if (UrlCB.FindStringExact(endpoint.EndpointUrl) == -1)
{
UrlCB.Items.Add(endpoint.EndpointUrl);
}
}
if (UrlCB.Items.Count > 0)
{
UrlCB.SelectedIndex = 0;
}
}
private void UpdateTimerCTRL_Tick(object sender, EventArgs e)
{
try
{
ServerStateLB.Text = m_server.CurrentInstance.CurrentState.ToString();
ServerTimeLB.Text = String.Format("{0:HH:mm:ss}", DateTime.Now);
UpdateSessions();
sessionsLB.Text = Convert.ToString(SessionsLV.Items.Count);
UpdateSubscriptions();
subscriptionsLB.Text = Convert.ToString(SubscriptionsLV.Items.Count);
int itemTotal = 0;
for (int i = 0; i < SubscriptionsLV.Items.Count; i++)
{
itemTotal += Convert.ToInt32(SubscriptionsLV.Items[i].SubItems[2].Text);
}
itemsLB.Text = Convert.ToString(itemTotal);
}
catch (Exception)
{
// ClientUtils.HandleException(this.Text, exception);
}
}
private void UpdateSessions()
{
SessionsLV.Items.Clear();
IList<Session> sessions = m_server.CurrentInstance.SessionManager.GetSessions();
for (int ii = 0; ii < sessions.Count; ii++)
{
Session session = sessions[ii];
lock (session.DiagnosticsLock)
{
ListViewItem item = new ListViewItem(session.SessionDiagnostics.SessionName);
if (session.Identity != null)
{
item.SubItems.Add(session.Identity.DisplayName);
}
else
{
item.SubItems.Add(String.Empty);
}
item.SubItems.Add(String.Format("{0}", session.Id));
item.SubItems.Add(String.Format("{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime()));
SessionsLV.Items.Add(item);
}
}
// adjust
for (int ii = 0; ii < SessionsLV.Columns.Count; ii++)
{
SessionsLV.Columns[ii].Width = -2;
}
}
private void UpdateSubscriptions()
{
SubscriptionsLV.Items.Clear();
IList<Subscription> subscriptions = m_server.CurrentInstance.SubscriptionManager.GetSubscriptions();
for (int ii = 0; ii < subscriptions.Count; ii++)
{
Subscription subscription = subscriptions[ii];
ListViewItem item = new ListViewItem(subscription.Id.ToString());
item.SubItems.Add(String.Format("{0}", (int)subscription.PublishingInterval));
item.SubItems.Add(String.Format("{0}", subscription.MonitoredItemCount));
lock (subscription.DiagnosticsLock)
{
item.SubItems.Add(String.Format("{0}", subscription.Diagnostics.NextSequenceNumber));
}
SubscriptionsLV.Items.Add(item);
}
for (int ii = 0; ii < SubscriptionsLV.Columns.Count; ii++)
{
SubscriptionsLV.Columns[ii].Width = -2;
}
}
}
}
+146
View File
@@ -0,0 +1,146 @@

namespace OpcUaServer.Server.Windows
{
partial class ServerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.ServerDiagnosticsCTRL = new ServerDiagnosticsCtrl();
this.serverHeaderBranding1 = new HeaderBreading();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// TrayIcon
//
this.TrayIcon.Text = "TrayIcon";
this.TrayIcon.Visible = true;
this.TrayIcon.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TrayIcon_MouseMove);
this.TrayIcon.DoubleClick += new System.EventHandler(this.TrayIcon_DoubleClick);
//
// ServerDiagnosticsCTRL
//
this.ServerDiagnosticsCTRL.Dock = System.Windows.Forms.DockStyle.Fill;
this.ServerDiagnosticsCTRL.Location = new System.Drawing.Point(0, 114);
this.ServerDiagnosticsCTRL.Name = "ServerDiagnosticsCTRL";
this.ServerDiagnosticsCTRL.Size = new System.Drawing.Size(739, 368);
this.ServerDiagnosticsCTRL.TabIndex = 0;
//
// serverHeaderBranding1
//
this.serverHeaderBranding1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.serverHeaderBranding1.BackColor = System.Drawing.Color.White;
this.serverHeaderBranding1.Dock = System.Windows.Forms.DockStyle.Top;
this.serverHeaderBranding1.Location = new System.Drawing.Point(0, 24);
this.serverHeaderBranding1.MaximumSize = new System.Drawing.Size(0, 100);
this.serverHeaderBranding1.MinimumSize = new System.Drawing.Size(500, 90);
this.serverHeaderBranding1.Name = "serverHeaderBranding1";
this.serverHeaderBranding1.Padding = new System.Windows.Forms.Padding(3);
this.serverHeaderBranding1.Size = new System.Drawing.Size(739, 90);
this.serverHeaderBranding1.TabIndex = 1;
this.serverHeaderBranding1.Visible = false;
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(739, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.contentsToolStripMenuItem});
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "&Help";
//
// contentsToolStripMenuItem
//
this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem";
this.contentsToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
this.contentsToolStripMenuItem.Text = "&Contents";
this.contentsToolStripMenuItem.Click += new System.EventHandler(this.ContentsToolStripMenuItem_Click);
//
// ServerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(739, 482);
this.Controls.Add(this.ServerDiagnosticsCTRL);
this.Controls.Add(this.serverHeaderBranding1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "ServerForm";
this.Text = "Quickstart Empty Server";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ServerForm_FormClosed);
this.Resize += new System.EventHandler(this.ServerForm_Resize);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private ServerDiagnosticsCtrl ServerDiagnosticsCTRL;
private System.Windows.Forms.NotifyIcon TrayIcon;
private HeaderBreading serverHeaderBranding1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem;
}
}
@@ -0,0 +1,99 @@
using System;
using System.IO;
using System.Windows.Forms;
using Opc.Ua;
using Opc.Ua.Configuration;
using Opc.Ua.Server;
namespace OpcUaServer.Server.Windows
{
public partial class ServerForm : Form
{
private readonly StandardServer _mServer;
private readonly ApplicationConfiguration _mConfiguration;
public ServerForm()
{
InitializeComponent();
}
public ServerForm(ApplicationInstance application)
{
InitializeComponent();
_mServer = application.Server as StandardServer;
_mConfiguration = application.ApplicationConfiguration;
this.ServerDiagnosticsCTRL.Initialize(_mServer, _mConfiguration);
TrayIcon.Text = this.Text = _mConfiguration.ApplicationName;
//ComponentResourceManager resources = new ComponentResourceManager(typeof(ServerForm));
//TrayIcon.Icon = (Icon)(resources.GetObject("App.ico"));
}
private void ServerForm_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
{
Hide();
}
}
private void TrayIcon_DoubleClick(object sender, EventArgs e)
{
Show();
WindowState = FormWindowState.Normal;
}
private void ServerForm_FormClosed(object sender, FormClosedEventArgs e)
{
try
{
_mServer.Stop();
}
catch (Exception exception)
{
Utils.Trace(exception, "Error stopping server.");
}
}
private void TrayIcon_MouseMove(object sender, MouseEventArgs e)
{
try
{
TrayIcon.Text = String.Format(
"{0} [{1} {2:HH:mm:ss}]",
_mConfiguration.ApplicationName,
_mServer.CurrentInstance.CurrentState,
DateTime.Now);
}
catch (Exception exception)
{
Utils.Trace(exception, "Error getting server status.");
}
}
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Quit the application", "OPC UA", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
{
Application.Exit();
}
}
private void ContentsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "WebHelp" + Path.DirectorySeparatorChar + "index.htm");
}
catch (Exception ex)
{
MessageBox.Show("Unable to launch help documentation. Error: " + ex.Message);
}
}
}
}
+36 -40
View File
@@ -2,60 +2,59 @@
<packages>
<package id="Libuv" version="1.10.0" targetFramework="net461" />
<package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting" version="2.2.7" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Features" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Features" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNetCore.WebUtilities" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Binder" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Hosting.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.ObjectPool" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Binder" version="2.2.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="2.2.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.ObjectPool" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="OPCFoundation.NetStandard.Opc.Ua" version="1.4.354.23" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.5.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
<package id="OPCFoundation.NetStandard.Opc.Ua" version="1.4.355.26" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.5" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.6.0" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
<package id="System.Collections.NonGeneric" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net461" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
<package id="System.ComponentModel.EventBasedAsync" version="4.3.0" targetFramework="net461" />
<package id="System.Console" version="4.3.1" targetFramework="net461" />
<package id="System.Data.Common" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net461" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
@@ -65,7 +64,7 @@
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
<package id="System.Linq.Queryable" version="4.3.0" targetFramework="net461" />
@@ -80,16 +79,16 @@
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
<package id="System.Private.ServiceModel" version="4.6.0" targetFramework="net461" />
<package id="System.Private.ServiceModel" version="4.5.3" targetFramework="net461" />
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.DispatchProxy" version="4.6.0" targetFramework="net461" />
<package id="System.Reflection.DispatchProxy" version="4.5.1" targetFramework="net461" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Metadata" version="1.7.0" targetFramework="net461" />
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.TypeExtensions" version="4.6.0" targetFramework="net461" />
<package id="System.Reflection.TypeExtensions" version="4.5.1" targetFramework="net461" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.1" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net461" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
@@ -97,21 +96,18 @@
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Serialization.Xml" version="4.3.0" targetFramework="net461" />
<package id="System.Security.AccessControl" version="4.6.0" targetFramework="net461" />
<package id="System.Security.Claims" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
<package id="System.Security.Cryptography.Cng" version="4.6.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Cng" version="4.5.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
<package id="System.Security.Cryptography.Xml" version="4.6.0" targetFramework="net461" />
<package id="System.Security.Permissions" version="4.6.0" targetFramework="net461" />
<package id="System.Security.Principal" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.6.0" targetFramework="net461" />
<package id="System.ServiceModel.Primitives" version="4.6.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net461" />
<package id="System.ServiceModel.Primitives" version="4.5.3" targetFramework="net461" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Text.Encodings.Web" version="4.6.0" targetFramework="net461" />
<package id="System.Text.Encodings.Web" version="4.5.0" targetFramework="net461" />
<package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="net461" />
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
+227 -278
View File
@@ -9,285 +9,234 @@ using System.Threading.Tasks;
namespace SOUR.Core
{
public class ApplicationStarter
public class ApplicationStarter
{
private readonly IPrinter _printer;
private readonly DataRecorder _recorder;
protected MQTT_Client.confData _mqttConf;
protected MQTT_Client _mqttCli;
private readonly XmlParser _xmlParser;
private readonly string _serverConfigurationFilePath;
protected bool redisOk = false;
/// <summary>
/// FIle conf XML (da sostituire con quello scaricato da REDIS) !!!FARE!!!
/// </summary>
protected string _xmlConfigurationPath;
public ServerManagerDecorator ServerManagerDecorator { get; private set; }
/// <summary>
/// Avvio applicazione principale
/// </summary>
/// <param name="printer"></param>
/// <param name="xmlConfigurationPath"></param>
/// <param name="xmlParser"></param>
/// <param name="serverConfigurationFilePath"></param>
/// <param name="recorder"></param>
/// <param name="mqttConf"></param>
public ApplicationStarter(IPrinter printer, string xmlConfigurationPath, XmlParser xmlParser, string serverConfigurationFilePath, DataRecorder recorder, MQTT_Client.confData mqttConf)
{
#region Private Fields
_printer = printer;
_recorder = recorder;
_mqttConf = mqttConf;
_xmlConfigurationPath = xmlConfigurationPath;
_xmlParser = xmlParser;
_serverConfigurationFilePath = serverConfigurationFilePath;
private readonly IPrinter _printer;
private readonly DataRecorder _recorder;
private readonly string _serverConfigurationFilePath;
private readonly XmlParser _xmlParser;
#endregion Private Fields
#region Protected Fields
protected MQTT_Client _mqttCli;
protected MQTT_Client.confData _mqttConf;
/// <summary>
/// FIle conf XML (da sostituire con quello scaricato da REDIS) !!!FARE!!!
/// </summary>
protected string _xmlConfigurationPath;
protected bool redisOk = false;
#endregion Protected Fields
#region Public Constructors
/// <summary>
/// Avvio applicazione principale
/// </summary>
/// <param name="printer"></param>
/// <param name="xmlConfigurationPath"></param>
/// <param name="xmlParser"></param>
/// <param name="serverConfigurationFilePath"></param>
/// <param name="recorder"></param>
/// <param name="mqttConf"></param>
public ApplicationStarter(IPrinter printer, string xmlConfigurationPath, XmlParser xmlParser, string serverConfigurationFilePath, DataRecorder recorder, MQTT_Client.confData mqttConf)
{
_printer = printer;
_recorder = recorder;
_mqttConf = mqttConf;
_xmlConfigurationPath = xmlConfigurationPath;
_xmlParser = xmlParser;
_serverConfigurationFilePath = serverConfigurationFilePath;
testRedisServerConn(_printer);
int reconTOut = 1 * 1000;
// se non trova server REDIS ritenta dopo 1 sec...
while (!redisOk)
{
testRedisServerConn(printer);
Thread.Sleep(reconTOut);
}
redisPreStartup(_printer);
mqttCliPreStartup(_printer);
}
#endregion Public Constructors
#region Public Properties
public ServerManagerDecorator ServerManagerDecorator { get; private set; }
#endregion Public Properties
#region Private Methods
/// <summary>
/// Avvia in modalità async l'oggetto MQTT
/// </summary>
/// <param name="mqttCli"></param>
/// <returns></returns>
private static async Task setupMqtt(MQTT_Client mqttCli)
{
await mqttCli.startAsync();
await mqttCli.sendValueAsync("data/SRG", "STARTED", null);
}
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
{
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
}
/// <summary>
/// Avvia il componente Sampler che effettua lettura periodica da area redis
/// </summary>
/// <param name="server"></param>
/// <returns></returns>
private IRedisSampler GetSampler(ServerDecorator server)
{
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
ServerManagerDecorator = new ServerManagerDecorator(server);
return new RedisSampler(ServerManagerDecorator, _xmlConfigurationPath, _printer,
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
}
/// <summary>
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
/// </summary>
/// <param name="printer"></param>
private void mqttCliPreStartup(IPrinter printer)
{
// faccio i controlli per capire SE si possa avviare...
if (redisOk)
{
// SOLO SE indica che è enabled...
if (_mqttConf.isEnabled)
{
_mqttCli = new MQTT_Client(_mqttConf, printer);
printer.Print("***** SRG MQTT publishing server created... *****");
}
else
{
printer.Print("***** SRG MQTT NOT ENABLED - server HAS NOT BEEN created... *****");
}
}
}
/// <summary>
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
/// </summary>
/// <param name="printer"></param>
private void mqttCliStartup(IPrinter printer)
{
// faccio i controlli per capire SE si possa avviare...
if (redisOk)
{
// SOLO SE indica che è enabled...
if (_mqttConf.isEnabled)
{
setupMqtt(_mqttCli);
printer.Print("***** SRG MQTT publishing server started... *****");
}
else
{
printer.Print("***** SRG MQTT NOT ENABLED - server IS NOT starting... *****");
}
}
}
/// <summary>
/// Effettua operazioni preliminari su redis x startup (check configurazione)
/// </summary>
/// <param name="printer"></param>
private void redisPreStartup(IPrinter printer)
{
// chiamo metodo start registrazione REDIS
string srvVers = typeof(ApplicationStarter).Assembly.GetName().Version.ToString();
DataHelper.sendRedisStart(srvVers);
// recupero i primi dati da redis (versione) x dire OK
string redVal = "";
string currKey = "";
bool redOk = false;
// controllo e loggo
currKey = memLayer.man.redHash("Srv:Vers");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** REDIS SOUR SERVER vers {0} set! *****", redVal), "***** ERROR: impossible to save SOUR SERVER Version... please check Redis*****");
// verifica se ci sia chiave Versione dell' Adp...
currKey = memLayer.man.redHash("Adp:Vers");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** REDIS SOUR ADAPTER vers {0} found! *****", redVal), "***** ERROR: No SOUR ADAPTER Version found... please check adapter *****");
// Verifico se trovo XML...
currKey = memLayer.man.redHash("AdpConf:DataModel");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
// attendo di avere un file XML valido da REDIS sennò RESTO in attesa... per 10 tentativi
int reconTOut = 1 * 1000;
int numTry = memLayer.man.confReadInt("xmlReadMaxRetry");
while (!redOk)
{
// se non trova XML REDIS ritenta dopo reconTOut sec...
numTry--;
Thread.Sleep(reconTOut);
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
if (numTry <= 0 && !redOk)
{
redOk = true;
printer.Print("***** ERROR: No XML DataModel found... using previous copy *****");
}
}
// se OK --> proseguo
if (redOk)
{
if (!string.IsNullOrEmpty(redVal))
{
string dataModel = DataHelper.xmlSanitize(redVal);
File.WriteAllText(_xmlConfigurationPath, dataModel);
printer.Print("***** XML DataModel saved! *****");
}
else
{
printer.Print("***** EMPTY XML DataModel --> using old one if present! *****");
}
}
}
/// <summary>
/// Test connesisone server redis
/// </summary>
/// <param name="printer"></param>
private void testRedisServerConn(IPrinter printer)
{
// controllo se il server è connesso
if (memLayer.man.connRedis.IsConnected)
{
printer.Print("***** REDIS server connected... *****");
redisOk = true;
}
else
{
printer.Print("***** ERROR: REDIS NOT available... please check service status *****");
}
}
#endregion Private Methods
#region Protected Methods
/// <summary>
/// Effettua verifica di value, se !="" effettua log con messageOk altrimenti con messageKo
/// </summary>
/// <param name="value"></param>
/// <param name="messageOk">messaggio se OK</param>
/// <param name="messageKo">messaggio se KO</param>
protected bool tryLog(string value, string messageOk, string messageKo)
{
bool answ = false;
if (value != "" && value != null)
{
_printer.Print(messageOk);
answ = true;
}
else
{
_printer.Print(messageKo);
}
return answ;
}
#endregion Protected Methods
#region Public Methods
/// <summary>
/// Classe avvio
/// </summary>
public void Start()
{
try
{
// avvio server redis
_printer.Print("***** OPC UA XML configuration settings file loading ... *****");
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
_printer.Print("***** OPC UA Server Instance created... *****");
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
_printer.Print("***** OPC UA Server started... *****");
// avvio MQTT
mqttCliStartup(_printer);
// avvio il sampler REDIS
GetSampler(server).Start();
}
catch (Exception ex)
{
_printer.Print("**** EXCEPTION *****");
_printer.Print(ex.ToString());
//Console.ReadLine();
}
}
#endregion Public Methods
testRedisServerConn(_printer);
int reconTOut = 1 * 1000;
// se non trova server REDIS ritenta dopo 1 sec...
while (!redisOk)
{
testRedisServerConn(printer);
Thread.Sleep(reconTOut);
}
redisPreStartup(_printer);
mqttCliPreStartup(_printer);
}
/// <summary>
/// Test connesisone server redis
/// </summary>
/// <param name="printer"></param>
private void testRedisServerConn(IPrinter printer)
{
// controllo se il server è connesso
if (memLayer.man.connRedis.IsConnected)
{
printer.Print("***** REDIS server connected... *****");
redisOk = true;
}
else
{
printer.Print("***** ERROR: REDIS NOT available... please check service status *****");
}
}
/// <summary>
/// Effettua operazioni preliminari su redis x startup (check configurazione)
/// </summary>
/// <param name="printer"></param>
private void redisPreStartup(IPrinter printer)
{
// chiamo metodo start registrazione REDIS
string srvVers = typeof(ApplicationStarter).Assembly.GetName().Version.ToString();
DataHelper.sendRedisStart(srvVers);
// recupero i primi dati da redis (versione) x dire OK
string redVal = "";
string currKey = "";
bool redOk = false;
// controllo e loggo
currKey = memLayer.man.redHash("Srv:Vers");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** REDIS SOUR SERVER vers {0} set! *****", redVal), "***** ERROR: impossible to save SOUR SERVER Version... please check Redis*****");
// verifica se ci sia chiave Versione dell' Adp...
currKey = memLayer.man.redHash("Adp:Vers");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** REDIS SOUR ADAPTER vers {0} found! *****", redVal), "***** ERROR: No SOUR ADAPTER Version found... please check adapter *****");
// Verifico se trovo XML...
currKey = memLayer.man.redHash("AdpConf:DataModel");
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
// attendo di avere un file XML valido da REDIS sennò RESTO in attesa... per 10 tentativi
int reconTOut = 1 * 1000;
int numTry = memLayer.man.confReadInt("xmlReadMaxRetry");
while (!redOk)
{
// se non trova XML REDIS ritenta dopo reconTOut sec...
numTry--;
Thread.Sleep(reconTOut);
redVal = memLayer.man.getRSV(currKey);
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
if (numTry <= 0 && !redOk)
{
redOk = true;
printer.Print("***** ERROR: No XML DataModel found... using previous copy *****");
}
}
// se OK --> proseguo
if (redOk)
{
if (redVal != null && redVal != "")
{
string dataModel = DataHelper.xmlSanitize(redVal);
File.WriteAllText(_xmlConfigurationPath, dataModel);
printer.Print("***** XML DataModel saved! *****");
}
else
{
printer.Print("***** EMPTY XML DataModel --> using old one if present! *****");
}
}
}
/// <summary>
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
/// </summary>
/// <param name="printer"></param>
private void mqttCliPreStartup(IPrinter printer)
{
// faccio i controlli per capire SE si possa avviare...
if (redisOk)
{
_mqttCli = new MQTT_Client(_mqttConf);
printer.Print("***** SRG MQTT publishing server created... *****");
}
}
/// <summary>
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
/// </summary>
/// <param name="printer"></param>
private void mqttCliStartup(IPrinter printer)
{
// faccio i controlli per capire SE si possa avviare...
if (redisOk)
{
setupMqtt(_mqttCli);
printer.Print("***** SRG MQTT publishing server started... *****");
}
}
/// <summary>
/// Avvia in modalità async l'oggetto MQTT
/// </summary>
/// <param name="mqttCli"></param>
/// <returns></returns>
private static async Task setupMqtt(MQTT_Client mqttCli)
{
await mqttCli.startAsync();
await mqttCli.sendValueAsync("data/SRG", "STARTED", null);
}
/// <summary>
/// Classe avvio
/// </summary>
public void Start()
{
try
{
// avvio server redis
_printer.Print("***** OPC UA XML configuration settings file loading ... *****");
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
_printer.Print("***** OPC UA Server Instance created... *****");
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
_printer.Print("***** OPC UA Server started... *****");
// avvio MQTT
mqttCliStartup(_printer);
// avvio il sampler REDIS
GetSampler(server).Start();
}
catch (Exception ex)
{
_printer.Print("**** EXCEPTION *****");
_printer.Print(ex.ToString());
//Console.ReadLine();
}
}
/// <summary>
/// Avvia il componente Sampler che effettua lettura periodica da area redis
/// </summary>
/// <param name="server"></param>
/// <returns></returns>
private IRedisSampler GetSampler(ServerDecorator server)
{
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
ServerManagerDecorator = new ServerManagerDecorator(server);
return new RedisSampler(ServerManagerDecorator, _xmlConfigurationPath, _printer,
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
}
/// <summary>
/// Effettua verifica di value, se !="" effettua log con messageOk altrimenti con messageKo
/// </summary>
/// <param name="value"></param>
/// <param name="messageOk">messaggio se OK</param>
/// <param name="messageKo">messaggio se KO</param>
protected bool tryLog(string value, string messageOk, string messageKo)
{
bool answ = false;
if (value != "" && value != null)
{
_printer.Print(messageOk);
answ = true;
}
else
{
_printer.Print(messageKo);
}
return answ;
}
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
{
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
}
}
}
+122 -149
View File
@@ -1,160 +1,133 @@
using SOUR.Core.Services;
using System;
using System.IO;
using System.Text;
using System.Xml;
namespace SOUR.Core
{
/// <summary>
/// Classe di supporto x gestione dati
/// </summary>
public class DataHelper
{
/// <summary>
/// Classe di supporto x gestione dati
/// Formato output timestamp
/// </summary>
protected static string dataFormat = "yyyy-MM-dd\\THH:mm:ss.fffK";
// !!!TDB!!! provare questo formato ma ha 7 decimali...
//protected string dataFormat = "O";
/// <summary>
/// Timestamp formattato...
/// </summary>
public class DataHelper
protected static string timestamp
{
#region Protected Fields
/// <summary>
/// Formato output timestamp
/// </summary>
protected static string dataFormat = "yyyy-MM-dd\\THH:mm:ss.fffK";
#endregion Protected Fields
// !!!TDB!!! provare questo formato ma ha 7 decimali...
//protected string dataFormat = "O";
#region Public Fields
/// <summary>
/// TTL eventi LUNGI (5 minuto)
/// </summary>
public static int longTTL = 300;
/// <summary>
/// oggetto singleton x accesso metodi Helper (redis, XML)
/// </summary>
public static DataHelper man = new DataHelper();
/// <summary>
/// TTL eventi BREVI (15 sec)
/// </summary>
public static int shortTTL = 15;
#endregion Public Fields
#region Protected Constructors
/// <summary>
/// classe gestione accessi a Session, cache, viewstate, configuration...
/// </summary>
protected DataHelper()
{
shortTTL = memLayer.man.confReadInt("shortTTL");
if (shortTTL <= 0) shortTTL = 15;
}
#endregion Protected Constructors
#region Protected Properties
/// <summary>
/// Timestamp formattato...
/// </summary>
protected static string timestamp
{
get
{
return DateTime.UtcNow.ToString(dataFormat);
}
}
#endregion Protected Properties
#region Public Methods
/// <summary>
/// Invio eventi di tipo heartbeat/watchdog server redis
/// </summary>
public static void sendRedisHBeat()
{
string currKey = "";
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "running", shortTTL);
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp, shortTTL);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Invio eventi di tipo start server redis
/// </summary>
/// <param name="srvVers">Versione server (esplicita)</param>
public static void sendRedisStart(string srvVers)
{
string currKey = "";
// in primis resetto aree server che devo poi compilare...
memLayer.man.redFlushKey(memLayer.man.redHash("Srv*"));
// scrive versione server...
currKey = memLayer.man.redHash("Srv:Vers");
memLayer.man.setRSV(currKey, srvVers);
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "started", longTTL);
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp, shortTTL);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Invio eventi di tipo stop server redis
/// </summary>
public static void sendRedisStop()
{
string currKey = "";
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "stopped");
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Metodo di sanitizzazione XML
/// - elimina commenti
/// - formatta
/// </summary>
/// <param name="xmlOrig"></param>
/// <returns></returns>
public static string xmlSanitize(string xmlOrig)
{
string sXml = xmlOrig; // primo step: converto stringa in dox XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.LoadXml(sXml);
// ora lo parso come lista eliminando i commenti
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
foreach (XmlNode node in list)
{
node.ParentNode.RemoveChild(node);
}
// fix formattazione "riscrivendo" indentazione...
StringWriter string_writer = new StringWriter();
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
xml_text_writer.Formatting = Formatting.Indented;
xmlDoc.WriteTo(xml_text_writer);
sXml = string_writer.ToString();
// restituisco
return sXml;
}
#endregion Public Methods
get
{
return DateTime.UtcNow.ToString(dataFormat);
}
}
}
/// <summary>
/// TTL eventi BREVI (15 sec)
/// </summary>
public static int shortTTL = 15;
/// <summary>
/// TTL eventi LUNGI (5 minuto)
/// </summary>
public static int longTTL = 300;
/// <summary>
/// classe gestione accessi a Session, cache, viewstate, configuration...
/// </summary>
protected DataHelper()
{
shortTTL = memLayer.man.confReadInt("shortTTL");
if (shortTTL <= 0) shortTTL = 15;
}
/// <summary>
/// oggetto singleton x accesso metodi Helper (redis, XML)
/// </summary>
public static DataHelper man = new DataHelper();
/// <summary>
/// Invio eventi di tipo start server redis
/// </summary>
/// <param name="srvVers">Versione server (esplicita)</param>
public static void sendRedisStart(string srvVers)
{
string currKey = "";
// in primis resetto aree server che devo poi compilare...
memLayer.man.redFlushKey(memLayer.man.redHash("Srv*"));
// scrive versione server...
currKey = memLayer.man.redHash("Srv:Vers");
memLayer.man.setRSV(currKey, srvVers);
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "started", longTTL);
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp, shortTTL);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Invio eventi di tipo stop server redis
/// </summary>
public static void sendRedisStop()
{
string currKey = "";
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "stopped");
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Invio eventi di tipo heartbeat/watchdog server redis
/// </summary>
public static void sendRedisHBeat()
{
string currKey = "";
// registro status + heartbeat
currKey = memLayer.man.redHash("Srv:Status");
memLayer.man.setRSV(currKey, "running", shortTTL);
currKey = memLayer.man.redHash("Srv:Heartbeat");
memLayer.man.setRSV(currKey, timestamp, shortTTL);
// aggiunta bitmap di status: 00001111 --> 255
currKey = memLayer.man.redHash("Srv:StatBitmap");
memLayer.man.setRSV(currKey, "00001111", shortTTL);
}
/// <summary>
/// Metodo di sanitizzazione XML
/// - elimina commenti
/// - formatta
/// </summary>
/// <param name="xmlOrig"></param>
/// <returns></returns>
public static string xmlSanitize(string xmlOrig)
{
string sXml = xmlOrig;
// primo step: converto stringa in dox XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.LoadXml(sXml);
// ora lo parso come lista eliminando i commenti
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
foreach (XmlNode node in list)
{
node.ParentNode.RemoveChild(node);
}
// fix formattazione "riscrivendo" indentazione...
StringWriter string_writer = new StringWriter();
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
xml_text_writer.Formatting = Formatting.Indented;
xmlDoc.WriteTo(xml_text_writer);
sXml = string_writer.ToString();
// restituisco
return sXml;
}
}
}
+11 -11
View File
@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SOUR.Core</RootNamespace>
<AssemblyName>SOUR.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -34,10 +34,10 @@
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.0\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.0.22\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.0.601\lib\net461\StackExchange.Redis.dll</HintPath>
@@ -47,12 +47,12 @@
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.6.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.5.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
@@ -61,12 +61,12 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.6.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
<Reference Include="System.Threading.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.5.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+1 -5
View File
@@ -45,7 +45,7 @@ namespace SOUR.Core.Services
{
string singleAlarm = memLayer.man.redGetHashField(currKey, AlarmKey);
//int alrNum = 0;
if (!string.IsNullOrEmpty( singleAlarm ))
if (singleAlarm != "")
{
var splitted = AlarmKey.Split('|');
if (splitted.Length > 1)
@@ -53,10 +53,6 @@ namespace SOUR.Core.Services
answ = new EventMessage(AlarmKey, singleAlarm, splitted[1]);
}
}
else
{
answ = new EventMessage(AlarmKey, $"ALARM {AlarmKey} - key not found in currKey");
}
}
catch
{ }
+12 -16
View File
@@ -1,18 +1,14 @@
namespace SOUR.Core.Services
{
public class MemDataItem
{
#region Public Fields
public string browseName;
public bool changed;
public string currVal;
public string dataType;
public float dBand = 0;
public string elType;
public string lastVal;
public int sGroup = 3;
#endregion Public Fields
}
}
public class MemDataItem
{
public string browseName;
public string elType;
public string dataType;
public string lastVal;
public string currVal;
public int sGroup = 3;
public float dBand = 0;
public bool changed;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -4
View File
@@ -8,10 +8,7 @@ namespace SOUR.Core
private readonly List<TreeNodeInstance> _children;
public string BrowseName { get; set; }
public string DisplayName { get; set; }
/// <summary>
/// Visibilità dell'oggetto nodo d'albero
/// </summary>
public string Visibility { get; set; } = "A";
public TreeNodeInstance[] Children
+231 -234
View File
@@ -6,239 +6,236 @@ using System.Xml;
namespace SOUR.Core
{
public class XmlParser
public class XmlParser
{
private readonly IEventMessageRepository _eventMessageRepository;
public XmlParser(IEventMessageRepository eventMessageRepository)
{
#region Private Fields
private readonly IEventMessageRepository _eventMessageRepository;
#endregion Private Fields
#region Public Constructors
public XmlParser(IEventMessageRepository eventMessageRepository)
{
_eventMessageRepository = eventMessageRepository;
}
#endregion Public Constructors
#region Private Methods
private void CreateSubDictionary(string path, XmlNode component, IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes, TreeNodeInstance treeNodeInstance)
{
string redisPath = path.Replace("/", ":");
foreach (XmlElement xmlElement in component)
{
var nodeVGroup = xmlElement.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions" && xmlElement.Name != "Property")
{
var nodeName = xmlElement.Attributes["BrowseName"].Value;
var symbolicName = xmlElement.Attributes["SymbolicName"].Value;
var nodeDataType = xmlElement.Attributes["DataType"].Value;
// range NON lo richiediamo x cui controllo NULL "a monte"...
var nodeRange = component.Attributes["Range"] != null ? (component.Attributes["Range"].Value ?? "null") : "null";
//// vecchio modo che genera eccezioni se manca attributo...
//var nodeRange = xmlElement.Attributes["Range"].Value ?? "null";
var nodeUnits = xmlElement.Attributes["Units"]?.Value ?? "null";
var severity = xmlElement.Attributes["Severity"]?.Value ?? "null";
// 2019.01.29 aggiunta decodifica nuove conf XML, con valori default
var nodeSGroup = xmlElement.Attributes["SGroup"]?.Value ?? "3";
var nodeDBand = xmlElement.Attributes["DBand"]?.Value ?? "";
//var parentName = component.Attributes["Name"].Value ?? "";
if (!Enum.TryParse(xmlElement.Name, out NodePropertiesType nodePropertyType))
{
nodePropertyType = NodePropertiesType.Variable;
}
NodeProperties nodeProperties;
if (xmlElement.Name == "Condition")
{
// allarmi SEMPRE alla massima priorità...
nodeSGroup = "1";
// HARD CODED traduzione messaggi a lingua corrente... in area AdpConf...
string redAlarmPath = string.Format("{0}:{1}", redisPath, symbolicName);
var eventMessages = _eventMessageRepository.getAlarmList(redAlarmPath);
var vetoCodes = _eventMessageRepository.getVetoCodes(redAlarmPath);
nodeProperties = new ConditionNodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType, eventMessages, vetoCodes);
}
else
{
nodeProperties = new NodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType);
}
nodeNameAndBuiltInTypes.Add(path + "/" + symbolicName, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance()
{
BrowseName = path + "/" + symbolicName,
DisplayName = symbolicName,
NodePropertyType = nodeProperties.NodePropertiesType,
NodeDataType = nodeProperties.NodeDataType,
Visibility = nodeVGroup
});
}
else if (xmlElement.Name == "Property")
{
var propName = xmlElement.Attributes["BrowseName"].Value;
var propSymbolicName = xmlElement.Attributes["SymbolicName"].Value;
var propNodeDataType = xmlElement.Attributes["DataType"].Value ?? null;
string nodeSGroup = "5"; // fix a 5
var nodeProperties = new NodeProperties(propName, propNodeDataType, "", null, null, nodeSGroup, null, nodeVGroup, NodePropertiesType.Property);
var key = path.EndsWith("/") ? path + propSymbolicName : path + "/" + propSymbolicName;
nodeNameAndBuiltInTypes.Add(key, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance()
{
BrowseName = key,
DisplayName = propSymbolicName,
NodePropertyType = nodeProperties.NodePropertiesType,
NodeDataType = nodeProperties.NodeDataType,
Visibility = nodeVGroup
});
}
else
{
if (xmlElement.Name != "Property")
{
var name = xmlElement.Attributes["Name"].Value;
var treeNodeChild = new TreeNodeInstance()
{
BrowseName = path + "/" + name,
DisplayName = name,
NodePropertyType = NodePropertiesType.Folder,
NodeDataType = null,
Visibility = nodeVGroup
};
treeNodeInstance.AddChild(treeNodeChild);
CreateSubDictionary(path + "/" + name, xmlElement, nodeNameAndBuiltInTypes, treeNodeChild);
}
}
}
}
private void ParseXml(XmlDocument xmlDocument, IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes,
TreeNodeInstance treeNodeInstance)
{
var itemRef = xmlDocument.GetElementsByTagName("Machine");
string rootName = "Machine"; //itemRef[0]?.Attributes?["Name"].Value + "_" + itemRef[0]?.Attributes?["Serial"].Value;
treeNodeInstance.BrowseName = rootName;
treeNodeInstance.DisplayName = rootName;
treeNodeInstance.NodePropertyType = NodePropertiesType.Folder;
treeNodeInstance.NodeDataType = null;
var xmlNodeList = itemRef[0]?.ChildNodes;
if (xmlNodeList == null)
{
nodeNameAndBuiltInTypes = null;
return;
}
foreach (XmlNode component in xmlNodeList)
{
var stringFolderName = rootName + "/";
if (component.Name != "Component" && component.Name != "Components" && component.Name != "Property")
{
var nodeName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var nodeDataType = component.Attributes["DataType"].Value ?? null;
// range NON lo richiediamo x cui controllo NULL "a monte"...
var nodeRange = component.Attributes["Range"] != null ? (component.Attributes["Range"].Value ?? "null") : "null";
//// vecchio modo che genera eccezioni se manca attributo...
//var nodeRange = component.Attributes["Range"].Value ?? "null";
var nodeUnits = component.Attributes["Units"]?.Value ?? "null";
var severity = component.Attributes["Severity"]?.Value ?? "null";
var nodeSGroup = component.Attributes["SGroup"]?.Value ?? "3";
var nodeDBand = component.Attributes["DBand"]?.Value ?? "";
var nodeVGroup = component.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
if (!Enum.TryParse(component.Name, out NodePropertiesType nodePropertyType))
{
nodePropertyType = NodePropertiesType.Variable;
}
NodeProperties nodeProperties;
if (component.Name == "Condition")
{
// HARD CODED traduzione messaggi a lingua corrente... in area AdpConf...
string redAlarmPath = string.Format("{0}:{1}", rootName, symbolicName);
var eventMessages = _eventMessageRepository.getAlarmList(redAlarmPath);
var vetoCodes = _eventMessageRepository.getVetoCodes(redAlarmPath);
nodeProperties = new ConditionNodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType, eventMessages, vetoCodes);
}
else
{
nodeProperties = new NodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType);
}
treeNodeInstance.AddChild(new TreeNodeInstance() { BrowseName = stringFolderName + symbolicName, DisplayName = symbolicName, NodePropertyType = nodeProperties.NodePropertiesType, NodeDataType = nodeProperties.NodeDataType });
nodeNameAndBuiltInTypes.Add(stringFolderName + symbolicName, nodeProperties);
}
else
{
if (component.Name == "Property")
{
var propName = component.Attributes["BrowseName"].Value;
var propSymbolicName = component.Attributes["SymbolicName"].Value;
var propNodeDataType = component.Attributes["DataType"].Value ?? null;
var propNodeVGroup = component.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
var nodeProperties = new NodeProperties(propName, propNodeDataType, "", null, null, null, null, propNodeVGroup, NodePropertiesType.Property);
nodeNameAndBuiltInTypes.Add(stringFolderName + propSymbolicName, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance() { BrowseName = stringFolderName + propSymbolicName, DisplayName = propSymbolicName, NodePropertyType = nodeProperties.NodePropertiesType, NodeDataType = nodeProperties.NodeDataType });
}
if (component.Name != "Property" && component.Attributes != null)
{
var treeNodeChild = new TreeNodeInstance()
{
BrowseName = stringFolderName + component.Attributes["Name"].Value,
DisplayName = component.Attributes["Name"].Value,
NodePropertyType = NodePropertiesType.Folder,
NodeDataType = null
};
treeNodeInstance.AddChild(treeNodeChild);
CreateSubDictionary(stringFolderName + component.Attributes["Name"].Value, component, nodeNameAndBuiltInTypes, treeNodeChild);
}
}
}
}
#endregion Private Methods
#region Public Methods
public IDictionary<string, NodeProperties> CreateDictionaryFromXmlToGenerateValues(string tracciatoXml)
{
IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes = new Dictionary<string, NodeProperties>();
var xmlDocument = new XmlDocument();
// carico XML appena salvato
xmlDocument.Load(tracciatoXml);
ParseXml(xmlDocument, nodeNameAndBuiltInTypes, new TreeNodeInstance());
return nodeNameAndBuiltInTypes;
}
public TreeNodeInstance CreateTree(string tracciatoXml)
{
IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes = new Dictionary<string, NodeProperties>();
var treeNodeInstance = new TreeNodeInstance();
var xmlDocument = new XmlDocument();
xmlDocument.Load(tracciatoXml);
ParseXml(xmlDocument, nodeNameAndBuiltInTypes, treeNodeInstance);
return treeNodeInstance;
}
#endregion Public Methods
_eventMessageRepository = eventMessageRepository;
}
}
public IDictionary<string, NodeProperties> CreateDictionaryFromXmlToGenerateValues(string tracciatoXml)
{
IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes = new Dictionary<string, NodeProperties>();
var xmlDocument = new XmlDocument();
// carico XML appena salvato
xmlDocument.Load(tracciatoXml);
ParseXml(xmlDocument, nodeNameAndBuiltInTypes, new TreeNodeInstance());
return nodeNameAndBuiltInTypes;
}
public TreeNodeInstance CreateTree(string tracciatoXml)
{
IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes = new Dictionary<string, NodeProperties>();
var treeNodeInstance = new TreeNodeInstance();
var xmlDocument = new XmlDocument();
xmlDocument.Load(tracciatoXml);
ParseXml(xmlDocument, nodeNameAndBuiltInTypes, treeNodeInstance);
return treeNodeInstance;
}
private void CreateSubDictionary(string path, XmlNode component, IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes, TreeNodeInstance treeNodeInstance)
{
string redisPath = path.Replace("/", ":");
foreach (XmlElement xmlElement in component)
{
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions" && xmlElement.Name != "Property")
{
var nodeName = xmlElement.Attributes["BrowseName"].Value;
var symbolicName = xmlElement.Attributes["SymbolicName"].Value;
var nodeDataType = xmlElement.Attributes["DataType"].Value;
// range NON lo richiediamo x cui controllo NULL "a monte"...
var nodeRange = component.Attributes["Range"] != null ? (component.Attributes["Range"].Value ?? "null") : "null";
//// vecchio modo che genera eccezioni se manca attributo...
//var nodeRange = xmlElement.Attributes["Range"].Value ?? "null";
var nodeUnits = xmlElement.Attributes["Units"]?.Value ?? "null";
var severity = xmlElement.Attributes["Severity"]?.Value ?? "null";
// 2019.01.29 aggiunta decodifica nuove conf XML, con valori default
var nodeSGroup = xmlElement.Attributes["SGroup"]?.Value ?? "3";
var nodeDBand = xmlElement.Attributes["DBand"]?.Value ?? "";
var nodeVGroup = xmlElement.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
//var parentName = component.Attributes["Name"].Value ?? "";
if (!Enum.TryParse(xmlElement.Name, out NodePropertiesType nodePropertyType))
{
nodePropertyType = NodePropertiesType.Variable;
}
NodeProperties nodeProperties;
if (xmlElement.Name == "Condition")
{
// allarmi SEMPRE alla massima priorità...
nodeSGroup = "1";
// HARD CODED traduzione messaggi a lingua corrente... in area AdpConf...
string redAlarmPath = string.Format("{0}:{1}", redisPath, symbolicName);
var eventMessages = _eventMessageRepository.getAlarmList(redAlarmPath);
var vetoCodes = _eventMessageRepository.getVetoCodes(redAlarmPath);
nodeProperties = new ConditionNodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType, eventMessages, vetoCodes);
}
else
{
nodeProperties = new NodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType);
}
nodeNameAndBuiltInTypes.Add(path + "/" + symbolicName, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance()
{
BrowseName = path + "/" + symbolicName,
DisplayName = symbolicName,
NodePropertyType = nodeProperties.NodePropertiesType,
NodeDataType = nodeProperties.NodeDataType
});
}
else if (xmlElement.Name == "Property")
{
var propName = xmlElement.Attributes["BrowseName"].Value;
var propSymbolicName = xmlElement.Attributes["SymbolicName"].Value;
var propNodeDataType = xmlElement.Attributes["DataType"].Value ?? null;
string nodeSGroup = "5"; // fix a 5
var propNodeVGroup = xmlElement.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
var nodeProperties = new NodeProperties(propName, propNodeDataType, "", null, null, nodeSGroup, null, propNodeVGroup, NodePropertiesType.Property);
var key = path.EndsWith("/") ? path + propSymbolicName : path + "/" + propSymbolicName;
nodeNameAndBuiltInTypes.Add(key, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance()
{
BrowseName = key,
DisplayName = propSymbolicName,
NodePropertyType = nodeProperties.NodePropertiesType,
NodeDataType = nodeProperties.NodeDataType
});
}
else
{
if (xmlElement.Name != "Property")
{
var name = xmlElement.Attributes["Name"].Value;
var treeNodeChild = new TreeNodeInstance()
{
BrowseName = path + "/" + name,
DisplayName = name,
NodePropertyType = NodePropertiesType.Folder,
NodeDataType = null
};
treeNodeInstance.AddChild(treeNodeChild);
CreateSubDictionary(path + "/" + name, xmlElement, nodeNameAndBuiltInTypes, treeNodeChild);
}
}
}
}
private void ParseXml(XmlDocument xmlDocument, IDictionary<string, NodeProperties> nodeNameAndBuiltInTypes,
TreeNodeInstance treeNodeInstance)
{
var itemRef = xmlDocument.GetElementsByTagName("Machine");
string rootName = "Machine"; //itemRef[0]?.Attributes?["Name"].Value + "_" + itemRef[0]?.Attributes?["Serial"].Value;
treeNodeInstance.BrowseName = rootName;
treeNodeInstance.DisplayName = rootName;
treeNodeInstance.NodePropertyType = NodePropertiesType.Folder;
treeNodeInstance.NodeDataType = null;
var xmlNodeList = itemRef[0]?.ChildNodes;
if (xmlNodeList == null)
{
nodeNameAndBuiltInTypes = null;
return;
}
foreach (XmlNode component in xmlNodeList)
{
var stringFolderName = rootName + "/";
if (component.Name != "Component" && component.Name != "Components" && component.Name != "Property")
{
var nodeName = component.Attributes["BrowseName"].Value;
var symbolicName = component.Attributes["SymbolicName"].Value;
var nodeDataType = component.Attributes["DataType"].Value ?? null;
// range NON lo richiediamo x cui controllo NULL "a monte"...
var nodeRange = component.Attributes["Range"] != null ? (component.Attributes["Range"].Value ?? "null") : "null";
//// vecchio modo che genera eccezioni se manca attributo...
//var nodeRange = component.Attributes["Range"].Value ?? "null";
var nodeUnits = component.Attributes["Units"]?.Value ?? "null";
var severity = component.Attributes["Severity"]?.Value ?? "null";
var nodeSGroup = component.Attributes["SGroup"]?.Value ?? "3";
var nodeDBand = component.Attributes["DBand"]?.Value ?? "";
var nodeVGroup = component.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
if (!Enum.TryParse(component.Name, out NodePropertiesType nodePropertyType))
{
nodePropertyType = NodePropertiesType.Variable;
}
NodeProperties nodeProperties;
if (component.Name == "Condition")
{
// HARD CODED traduzione messaggi a lingua corrente... in area AdpConf...
string redAlarmPath = string.Format("{0}:{1}", rootName, symbolicName);
var eventMessages = _eventMessageRepository.getAlarmList(redAlarmPath);
var vetoCodes = _eventMessageRepository.getVetoCodes(redAlarmPath);
nodeProperties = new ConditionNodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType, eventMessages, vetoCodes);
}
else
{
nodeProperties = new NodeProperties(nodeName, nodeDataType, nodeRange, nodeUnits, severity, nodeSGroup, nodeDBand, nodeVGroup, nodePropertyType);
}
treeNodeInstance.AddChild(new TreeNodeInstance() { BrowseName = stringFolderName + symbolicName, DisplayName = symbolicName, NodePropertyType = nodeProperties.NodePropertiesType, NodeDataType = nodeProperties.NodeDataType });
nodeNameAndBuiltInTypes.Add(stringFolderName + symbolicName, nodeProperties);
}
else
{
if (component.Name == "Property")
{
var propName = component.Attributes["BrowseName"].Value;
var propSymbolicName = component.Attributes["SymbolicName"].Value;
var propNodeDataType = component.Attributes["DataType"].Value ?? null;
var propNodeVGroup = component.Attributes["VGroup"]?.Value ?? "A"; // default: ALL
var nodeProperties = new NodeProperties(propName, propNodeDataType, "", null, null, null, null, propNodeVGroup, NodePropertiesType.Property);
nodeNameAndBuiltInTypes.Add(stringFolderName + propSymbolicName, nodeProperties);
treeNodeInstance.AddChild(new TreeNodeInstance() { BrowseName = stringFolderName + propSymbolicName, DisplayName = propSymbolicName, NodePropertyType = nodeProperties.NodePropertiesType, NodeDataType = nodeProperties.NodeDataType });
}
if (component.Name != "Property" && component.Attributes != null)
{
var treeNodeChild = new TreeNodeInstance()
{
BrowseName = stringFolderName + component.Attributes["Name"].Value,
DisplayName = component.Attributes["Name"].Value,
NodePropertyType = NodePropertiesType.Folder,
NodeDataType = null
};
treeNodeInstance.AddChild(treeNodeChild);
CreateSubDictionary(stringFolderName + component.Attributes["Name"].Value, component, nodeNameAndBuiltInTypes, treeNodeChild);
}
}
}
}
}
}
+8 -92
View File
@@ -8,11 +8,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
@@ -24,7 +24,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -60,11 +60,11 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
@@ -76,7 +76,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -84,7 +84,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -92,7 +92,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.2.0" newVersion="4.3.2.0" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
@@ -102,90 +102,6 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Connections.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.DispatchProxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+6 -6
View File
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Pipelines.Sockets.Unofficial" version="2.1.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
<package id="Pipelines.Sockets.Unofficial" version="2.0.22" targetFramework="net461" />
<package id="StackExchange.Redis" version="2.0.601" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.Diagnostics.PerformanceCounter" version="4.6.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net461" />
<package id="System.Diagnostics.PerformanceCounter" version="4.5.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
<package id="System.Threading.Channels" version="4.6.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Threading.Channels" version="4.5.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net461" />
</packages>
-49
View File
@@ -1,49 +0,0 @@
{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\froman\fprq2\fcharset2 Symbol;}}
{\colortbl ;\red0\green0\blue0;\red0\green0\blue255;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\nowidctlpar\sb120\sa120\b\f0\fs20 MICROSOFT SOFTWARE LICENSE TERMS\f1\par
\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120\f0 MICROSOFT SPEECH PLATFORM - SERVER RUNTIME \cf1 10.\f1 0\cf0\par
\pard\nowidctlpar\sb120\sa120\b0\f0 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f2\'b7\tab\f0 updates,\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\f2\'b7\tab\f0 supplements,\f1\par
\f2\'b7\tab\f0 Internet-based services, and \f1\par
\f2\'b7\tab\f0 support services\f1\par
\pard\nowidctlpar\sb120\sa120\f0 for this software, unless other terms accompany those items. If so, those terms apply.\f1\par
\b\f0 By using the software, you accept these terms. If you do not accept them, do not use the software.\f1\par
\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120\f0 If you comply with these license terms, you have the rights below.\f1\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\f0 1.\tab INSTALLATION AND USE RIGHTS. \b0 You may install and use any number of copies of the software on your devices running validly licensed copies of Windows Server 2003 or later version, as well as Microsoft Speech Platform SDK v10.1 and/or a non-Microsoft product which has been developed using the Microsoft Speech Platform SDK v10.0. If you are downloading this software in connection with such non-Microsoft product, then the terms associated with that product apply.\b\f1\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\caps\f0 2.\tab Scope of License\caps0\f1 .\b0\f0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\b\f1\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\b0\f2\'b7\tab\f0 disclose the results of any benchmark tests of the software to any third party without Microsoft\rquote s prior written approval\fs19 ;\f1\fs20\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f2\'b7\tab\f0 work around any technical limitations in the software\fs19 ;\f1\fs20\par
\f2\'b7\tab\f0 reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation\fs19 ;\f1\fs20\par
\f2\'b7\tab\f0 make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation\fs19 ;\f1\fs20\par
\f2\'b7\tab\f0 publish the software for others to copy\fs19 ;\f1\fs20\par
\f2\'b7\tab\f0 rent, lease or lend the software\fs19 ;\f1\fs20\par
\f2\'b7\tab\f0 transfer the software or this agreement to any third party\fs19 ; or\f1\fs20\par
\f2\'b7\tab\f0 use the software for commercial software hosting services\f1\fs19 .\fs20\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\b\f0 3.\tab BACKUP COPY.\b0 You may make one backup copy of the software. You may use it only to reinstall the software.\b\f1\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\f0 4.\tab DOCUMENTATION.\b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\b\f1\par
\caps\f0 5.\tab Export Restrictions\caps0\f1 .\b0\f0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\field{\*\fldinst{HYPERLINK "www.microsoft.com/exporting"}}{\fldrslt{\ul\cf2 www.microsoft.com/exporting}}}\f1\fs20 .\b\par
\caps\f0 6.\tab SUPPORT SERVICES.\caps0 \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\b\f1\par
\caps\f0 7.\tab Entire Agreement.\b0\caps0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\b\caps\f0 8.\tab Applicable Law\caps0\f1 .\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\f0 a.\tab United States.\b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\b\f1\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f0 b.\tab Outside the United States.\b0 If you acquired the software in any other country, the laws of that country apply.\b\f1\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\caps\f0 9.\tab Legal Effect.\b0\caps0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\b\caps\f1\par
\pard\nowidctlpar\fi-357\li357\sb120\sa120\f0 10.\tab Disclaimer of Warranty.\caps0 The software is licensed \ldblquote as-is.\rdblquote You bear the risk of using it. Microsoft gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, Microsoft excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.\caps\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f0 11.\tab Limitation on and Exclusion of Remedies and Damages. \caps0 You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.\caps\f1\par
\pard\nowidctlpar\li357\sb120\sa120\b0\caps0\f0 This limitation applies to\f1\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\f2\'b7\tab\f0 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\f1\par
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f2\'b7\tab\f0 claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\f1\par
\pard\nowidctlpar\li360\sb120\sa120\f0 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\f1\par
\pard\nowidctlpar\sb120\sa120\b\f0 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\f1\par
\f0 Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\f1\par
\f0 EXON\'c9RATION DE GARANTIE.\b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\f1\par
\b\f0 LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES.\b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\f1\par
\f0 Cette limitation concerne :\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f2\'b7\tab\f0 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\f1\par
\pard\nowidctlpar\fi-360\li360\sb120\sa120\f2\'b7\tab\f0 les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\f1\par
\pard\nowidctlpar\sb120\sa120\f0 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\f1\par
\b\f0 EFFET JURIDIQUE.\b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. \lang1036 Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par
\b\f1\par
}
-107
View File
@@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define SOUR_TargetDir=$(var.SOUR.TargetDir)?>
<?define OpcUaCommon_TargetDir=$(var.OpcUaCommon.TargetDir)?>
<?define OpcUaServer.Server_TargetDir=$(var.OpcUaServer.Server.TargetDir)?>
<?define SOUR.Core_TargetDir=$(var.SOUR.Core.TargetDir)?>
<?define Manufacturer="Steamware"?>
<!--Calcolo il nome del prodotto...-->
<?define ProductName="SOUR" ?>
<?if $(var.SOUR.Configuration) = "Debug" ?>
<?define ProductName="$(var.ProductName)-unstable" ?>
<?endif?>
<Product Id="2cacd1b8-991b-48d6-a7ae-55464641bd74" Name="$(var.ProductName)" Language="1033" Version="!(bind.FileVersion.SOUR.exe)" Manufacturer="Steamware srl" UpgradeCode="7e0cd98d-b481-4776-86ce-93ce56575e64">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="$(var.ProductName)" />
<!--<Product Id="2cacd1b8-991b-48d6-a7ae-55464641bd74" Name="SOUR" Language="1033" Version="!(bind.FileVersion.SOUR.exe)" Manufacturer="Steamware srl" UpgradeCode="7e0cd98d-b481-4776-86ce-93ce56575e64">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />-->
<!--Aggiunto UI x finestra di dialogo x InstallDir-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<Icon Id="icon.ico" SourceFile="$(var.ProjectDir)icon.ico" />
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<!--
RemoveFolderEx requires that we "remember" the path for uninstall.
Read the path value and set the APPLICATIONFOLDER property with the value.
-->
<Property Id="APPLICATIONFOLDER">
<RegistrySearch Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)" Root="HKLM" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
</Property>
<!--<DirectoryRef Id="APPLICATIONFOLDER">
<Component Id="CleanupMainApplicationFolder" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.Manufacturer)\$(var.ProductName)" Name="Path" Type="string" Value="[APPLICATIONFOLDER]" KeyPath="yes" />
<util:RemoveFolderEx On="uninstall" Property="APPLICATIONFOLDER" />
</Component>
</DirectoryRef>-->
<!--Licenza d'uso (std microsoft)-->
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\License.rtf" />
<!--Messaggio upgrade-->
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!--Unico file senza cab esterni-->
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SOUR" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="lib_files" />
<ComponentGroupRef Id="logs_files" />
<ComponentGroupRef Id="Rec_files" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SOUR">
<Directory Id="lib" Name="lib" />
<Directory Id="Rec" Name="Rec" />
<Directory Id="logs" Name="logs" />
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="Server.Config.xml" Guid="73b30dbd-3440-4481-93b0-b42d9ed445d6">
<File Id="Server.Config.xml" Name="Server.Config.xml" Source="$(var.SOUR_TargetDir)Server.Config.xml" />
</Component>
<Component Id="SOUR.exe" Guid="96f41478-f3dc-45b0-8b1b-3f6ec5db9504">
<File Id="SOUR.exe" Name="SOUR.exe" Source="$(var.SOUR_TargetDir)SOUR.exe" />
</Component>
<Component Id="SOUR.exe.config" Guid="da7fd54d-f097-4137-b735-0a16ae3b7560">
<File Id="SOUR.exe.config" Name="SOUR.exe.config" Source="$(var.SOUR_TargetDir)SOUR.exe.config" />
</Component>
<Component Id="SOUR.Core.dll.config" Guid="f1cfec8e-7659-4648-a69a-e05353f10ef2">
<File Id="SOUR.Core.dll.config" Name="SOUR.Core.dll.config" Source="$(var.SOUR.Core_TargetDir)SOUR.Core.dll.config" />
</Component>
<Component Id="DataModel.xml" Guid="2148150e-2fe4-42b4-a8cc-c5003f99785d">
<File Id="DataModel.xml" Name="DataModel.xml" Source="$(var.SOUR_TargetDir)DataModel.xml" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="lib_files" Directory="lib">
<Component Id="lib_.placeholder" Guid="9c71c67e-f8b4-4877-bcea-695af0b9586e">
<File Id="lib_.placeholder" Name=".placeholder" Source="$(var.SOUR_TargetDir)lib\.placeholder" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="logs_files" Directory="logs">
<Component Id="logs_.placeholder" Guid="94e4b013-afda-4021-aade-9cbab56c35cb">
<File Id="logs_.placeholder" Name=".placeholder" Source="$(var.SOUR_TargetDir)logs\.placeholder" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="Rec_files" Directory="Rec">
<Component Id="Rec_.placeholder" Guid="350a29b7-7ae3-4c19-be04-6b4c69563883">
<File Id="Rec_.placeholder" Name=".placeholder" Source="$(var.SOUR_TargetDir)Rec\.placeholder" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
-13
View File
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-16"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<DeployedProjects>
<string>SOUR\SOUR.csproj</string>
</DeployedProjects>
<DirectoryMappings>
<Item Key="" Value="INSTALLFOLDER" />
</DirectoryMappings>
<FileMappings />
<DeploySymbols>false</DeploySymbols>
<DeployLocalizations>false</DeployLocalizations>
<DeployExternalLocalizations>false</DeployExternalLocalizations>
</Configuration>
-89
View File
@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>c60609f8-e274-4ed3-a14e-06a8f978ff3b</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>SOUR</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<ItemGroup>
<Content Include="icon.ico" />
<Content Include="License.rtf" />
<Content Include="SOUR.Setup.wax" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpcUaCommon\OpcUaCommon.csproj">
<Name>OpcUaCommon</Name>
<Project>{4c09fe6b-20fe-4a16-8443-f8be8ae0849a}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\OpcUaServer.Server\OpcUaServer.Server.csproj">
<Name>OpcUaServer.Server</Name>
<Project>{1e81f982-2e67-4f37-9d0d-c1e1f2c3c415}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\SOUR.Core\SOUR.Core.csproj">
<Name>SOUR.Core</Name>
<Project>{c91082e5-3ec7-4ae7-b2f1-c7c194a02165}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
<ProjectReference Include="..\SOUR\SOUR.csproj">
<Name>SOUR</Name>
<Project>{a924c997-f587-429a-a492-867460320b81}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Folder Include="Images" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

+5 -29
View File
@@ -13,62 +13,38 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SOUR", "SOUR\SOUR.csproj",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{C26EADFE-AEC9-45EC-BAF4-C699721496F6}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SOUR.Setup", "SOUR.Setup\SOUR.Setup.wixproj", "{C60609F8-E274-4ED3-A14E-06A8F978FF3B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XUnitTestSOUR", "XUnitTestSOUR\XUnitTestSOUR.csproj", "{72E9A21C-6D52-471C-BA6F-EDDC8CDE8D74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Debug|x86.ActiveCfg = Debug|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Debug|x86.Build.0 = Debug|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Release|Any CPU.Build.0 = Release|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Release|x86.ActiveCfg = Release|Any CPU
{1E81F982-2E67-4F37-9D0D-C1E1F2C3C415}.Release|x86.Build.0 = Release|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Debug|x86.ActiveCfg = Debug|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Debug|x86.Build.0 = Debug|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Release|Any CPU.Build.0 = Release|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Release|x86.ActiveCfg = Release|Any CPU
{C91082E5-3EC7-4AE7-B2F1-C7C194A02165}.Release|x86.Build.0 = Release|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Debug|x86.ActiveCfg = Debug|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Debug|x86.Build.0 = Debug|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Release|Any CPU.Build.0 = Release|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Release|x86.ActiveCfg = Release|Any CPU
{4C09FE6B-20FE-4A16-8443-F8BE8AE0849A}.Release|x86.Build.0 = Release|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Debug|x86.ActiveCfg = Debug|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Debug|x86.Build.0 = Debug|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Release|Any CPU.Build.0 = Release|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Release|x86.ActiveCfg = Release|Any CPU
{A924C997-F587-429A-A492-867460320B81}.Release|x86.Build.0 = Release|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Debug|x86.ActiveCfg = Debug|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Debug|x86.Build.0 = Debug|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Release|Any CPU.Build.0 = Release|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Release|x86.ActiveCfg = Release|Any CPU
{C26EADFE-AEC9-45EC-BAF4-C699721496F6}.Release|x86.Build.0 = Release|Any CPU
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Debug|Any CPU.ActiveCfg = Debug|x86
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Debug|x86.ActiveCfg = Debug|x86
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Debug|x86.Build.0 = Debug|x86
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Release|Any CPU.ActiveCfg = Release|x86
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Release|x86.ActiveCfg = Release|x86
{C60609F8-E274-4ED3-A14E-06A8F978FF3B}.Release|x86.Build.0 = Release|x86
{72E9A21C-6D52-471C-BA6F-EDDC8CDE8D74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72E9A21C-6D52-471C-BA6F-EDDC8CDE8D74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72E9A21C-6D52-471C-BA6F-EDDC8CDE8D74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72E9A21C-6D52-471C-BA6F-EDDC8CDE8D74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
-3
View File
@@ -1,7 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="simRequeue" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
+4 -7
View File
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false,allowAdmin=true" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="doRecord" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="doRecProp" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
<add key="simRequeue" value="false" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
<appSettings>
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false,allowAdmin=true" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>
+176 -262
View File
@@ -1,265 +1,179 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<appSettings>
<add key="Module" value="SOUR" />
<add key="ModuleMcc" value="MCC" />
<add key="DataModelPath" value="DataModel.xml" />
<add key="TestMode" value="true" />
<add key="RSamplInt" value="20" />
<add key="cntDwn_1" value="1" />
<add key="cntDwn_2" value="2" />
<add key="cntDwn_3" value="11" />
<add key="cntDwn_4" value="23" />
<add key="cntDwn_5" value="101" />
<add key="waitResendCondition" value="1500" />
<add key="waitEventDequeue" value="1000" />
<add key="simRequeue" value="true" />
<!--Gestione allarmi: modo tra TEXT / LIST-->
<add key="AlarmListMode" value="LIST" />
<!--Indica se allarmi statici (=true) oppure da rileggere SEMPRE da REDIS (=false) -->
<add key="staticAlarmList" value="false" />
<!--Conf REDIS-->
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" />
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false,allowAdmin=true" />
<add key="RedisMccDb" value="1" />
<!--DataModel read retry-->
<add key="xmlReadMaxRetry" value="30" />
<!--Recorder-->
<add key="doRecord" value="true" />
<add key="doRecProp" value="true" />
<add key="forceDot" value="true" />
<add key="logLevel" value="6" />
<add key="shortTTL" value="15" />
<add key="setPropRed" value="true" />
<add key="recordFormat" value="BASE" />
<add key="redisDb" value="0" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<probing privatePath="lib;libs" />
<dependentAssembly>
<assemblyIdentity name="System.Net.Sockets" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.2.0" newVersion="4.3.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Connections.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.DispatchProxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!--<file type="log4net.Util.PatternString" value=".\logs\logfile.log" />-->
<!--<file type="log4net.Util.PatternString" value=".\logs\%utcdate{yyyy-MM-dd}.log" />-->
<file type="log4net.Util.PatternString" value=".\logs\SOUR.log" />
<PreserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maximumFileSize value="5000KB" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<!--<conversionPattern value="%level - %message%newline" />-->
<conversionPattern value="%date [%thread] %level - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<appSettings>
<add key="Module" value="SOUR" />
<add key="ModuleMcc" value="MCC" />
<add key="DataModelPath" value="DataModel.xml" />
<add key="TestMode" value="true" />
<add key="RSamplInt" value="20" />
<add key="cntDwn_1" value="3" />
<add key="cntDwn_2" value="7" />
<add key="cntDwn_3" value="29" />
<add key="cntDwn_4" value="101" />
<add key="cntDwn_5" value="401" />
<add key="waitResendCondition" value="1500" />
<!--Gestione allarmi: modo tra TEXT / LIST-->
<add key="AlarmListMode" value="LIST" />
<!--Indica se allarmi statici (=true) oppure da rileggere SEMPRE da REDIS (=false) -->
<add key="staticAlarmList" value="false" />
<!--Conf REDIS-->
<add key="RedisConn" value="localhost,abortConnect=false,ssl=false" />
<add key="RedisConnAdmin" value="localhost,abortConnect=false,ssl=false,allowAdmin=true" />
<add key="RedisMccDb" value="1" />
<!--DataModel read retry-->
<add key="xmlReadMaxRetry" value="30" />
<!--Recorder-->
<add key="doRecord" value="true" />
<add key="doRecProp" value="true" />
<add key="forceDot" value="true" />
<add key="logLevel" value="6" />
<add key="shortTTL" value="15" />
<add key="setPropRed" value="true" />
<add key="recordFormat" value="BASE" />
<add key="redisDb" value="0" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<probing privatePath="lib;libs" />
<dependentAssembly>
<assemblyIdentity name="System.Net.Sockets" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!--<file type="log4net.Util.PatternString" value=".\logs\logfile.log" />-->
<!--<file type="log4net.Util.PatternString" value=".\logs\%utcdate{yyyy-MM-dd}.log" />-->
<file type="log4net.Util.PatternString" value=".\logs\SOUR.log" />
<PreserveLogFileNameExtension value="true" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<maximumFileSize value="5000KB" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<!--<conversionPattern value="%level - %message%newline" />-->
<conversionPattern value="%date [%thread] %level - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
-193
View File
@@ -1,193 +0,0 @@
<ModelDesign>
<Machine>
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="ANTARES26/15-PX5" />
<Property SymbolicName="Manufacturer" BrowseName="Manufacturer" DataType="ua:String" ValueRank="Scalar" Value="CMS Industries" />
<Property SymbolicName="Serial" BrowseName="Serial" DataType="ua:String" ValueRank="Scalar" Value="9206" />
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="CNC_MACHINE" />
<Property SymbolicName="BuildYear" BrowseName="BuildYear" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="Alarm" BrowseName="Alarm" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<Variable SymbolicName="Emergency" BrowseName="Emergency" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="001" CmsDataOpt="HOURS" />
<Variable SymbolicName="ActiveWorkingTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="002" CmsDataOpt="HOURS" />
<Component Name="Events">
<Variable SymbolicName="Production" BrowseName="Production" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="1" />
<Variable SymbolicName="Kpis" BrowseName="Kpis" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="1" VGroup="P" />
<Variable SymbolicName="Tools" BrowseName="Tools" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="1" VGroup="P" />
<Variable SymbolicName="Downtimes" BrowseName="Downtimes" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="1" VGroup="P" />
<Variable SymbolicName="Messages" BrowseName="MEssages" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="1" VGroup="P" />
</Component>
<Component Name="Cnc">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="OSAI" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
<Component Name="CncProcesses" VGroup="P">
<Component Name="01">
<Variable SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="CodG" BrowseName="CodG" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodM" BrowseName="CodM" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodS" BrowseName="CodS" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodT" BrowseName="CodT" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:String" ValueRank="Scalar" Units="m/min" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="SubMode" BrowseName="SubMode" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
</Component>
</Component>
</Component>
<Component Name="Plc" VGroup="P">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="SIEMENS" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
</Component>
<Component Name="Hmi" VGroup="P">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="CMS Active" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="1.00.02" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
<Variable SymbolicName="User" BrowseName="User" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Language" BrowseName="Language" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="ActiveSection" BrowseName="ActiveSection" DataType="ua:String" ValueRank="Scalar" Units="h" />
<Variable SymbolicName="ActiveTimeSession" BrowseName="ActiveTimeSession" DataType="ua:String" ValueRank="Scalar" Units="" />
</Component>
<Component Name="Axes" VGroup="P">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="026" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="001" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="005" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="004" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="02">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="027" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="002" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="007" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" CmsDataType="CounterList" CmsDataIndex="006" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="03">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="028" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="003" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="009" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="008" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="04">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="029" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="004" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="011" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="010" CmsDataOpt="NUM" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="05">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="030" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="005" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
<Variable CmsDataType="CounterList" SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataIndex="013" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="012" CmsDataOpt="NUM" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="06">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SLAVE" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="031" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="1" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="006" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="015" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="014" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
</Component>
<Component Name="OperatingGroups" VGroup="P">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SPINDLE" />
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="CMS-SPINDLE-01" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="006" CmsDataOpt="BIT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Krev" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="NUM" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="HOURS" />
<Variable SymbolicName="SpeedRate" BrowseName="SpeedRate" DataType="ua:UInt32" ValueRank="Scalar" Units="rpm" />
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="025" CmsDataOpt="NUM" />
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" Units="" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
</Component>
<Component Name="AuxiliaryGroups" VGroup="P">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LUBRO" />
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="021" CmsDataOpt="NUM" />
</Component>
<Component Name="02">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_PUMP" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="002" CmsDataOpt="BIT" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="017" CmsDataOpt="HOURS" />
</Component>
<Component Name="03">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_ACT" />
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="019" CmsDataOpt="NUM" />
</Component>
</Component>
</Machine>
</ModelDesign>
+185 -2
View File
@@ -1,6 +1,189 @@
<ModelDesign>
<Machine>
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="TEST-MACHINE" />
<Property SymbolicName="Manufacturer" BrowseName="Manufacturer" DataType="ua:String" ValueRank="Scalar" Value="ACME Industries" />
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="ANTARES26/15-PX5" />
<Property SymbolicName="Manufacturer" BrowseName="Manufacturer" DataType="ua:String" ValueRank="Scalar" Value="CMS Industries" />
<Property SymbolicName="Serial" BrowseName="Serial" DataType="ua:String" ValueRank="Scalar" Value="9206" />
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="CNC_MACHINE" />
<Property SymbolicName="BuildYear" BrowseName="BuildYear" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="Alarm" BrowseName="Alarm" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<Variable SymbolicName="Emergency" BrowseName="Emergency" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" Units="Bool" />
<!--<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" Units="Enum" />-->
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="001" CmsDataOpt="HOURS" />
<Variable SymbolicName="ActiveWorkingTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="002" CmsDataOpt="HOURS" />
<Component Name="Cnc">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="OSAI" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
<Component Name="CncProcesses">
<Component Name="01">
<Variable SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<!--<Variable SymbolicName="ActiveAxes" BrowseName="ActiveAxes" DataType="ua:String" ValueRank="Scalar" Units="" />-->
<Variable SymbolicName="CodG" BrowseName="CodG" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodM" BrowseName="CodM" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodS" BrowseName="CodS" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CodT" BrowseName="CodT" DataType="ua:String" ValueRank="Scalar" Units="" SGroup="2" VGroup="P" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:String" ValueRank="Scalar" Units="m/min" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:String" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="SubMode" BrowseName="SubMode" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
</Component>
</Component>
</Component>
<Component Name="Plc">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="SIEMENS" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="2019" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
</Component>
<Component Name="Hmi">
<Property SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Value="CMS Active" />
<Property SymbolicName="Version" BrowseName="Version" DataType="ua:String" ValueRank="Scalar" Value="1.00.02" />
<Condition SymbolicName="Condition" BrowseName="Condition" DataType="ua:String" ValueRank="Scalar" Type="OffNormalAlarmState" Units="" />
<Variable SymbolicName="User" BrowseName="User" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Language" BrowseName="Language" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="ActiveSection" BrowseName="ActiveSection" DataType="ua:String" ValueRank="Scalar" Units="h" />
<Variable SymbolicName="ActiveTimeSession" BrowseName="ActiveTimeSession" DataType="ua:String" ValueRank="Scalar" Units="" />
</Component>
<Component Name="Axes">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="026" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="001" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="005" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="004" CmsDataOpt="METER"/>
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="02">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="027" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="002" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="007" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" CmsDataType="CounterList" CmsDataIndex="006" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="03">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="028" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="003" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="009" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="008" CmsDataOpt="METER" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="04">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="029" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="004" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="011" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="010" CmsDataOpt="NUM" />
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="05">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="ROTATIONAL" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="MASTER" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="030" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="0" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="005" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="deg" SGroup="4" DBand="1" VGroup="P" />
<Variable CmsDataType="CounterList" SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataIndex="013" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="KRev" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="012" CmsDataOpt="NUM"/>
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="rpm/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
<Component Name="06">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LINEAR" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Property SymbolicName="Role" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SLAVE" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="031" CmsDataOpt="HOURS" />
<Variable SymbolicName="Direction" BrowseName="Direction" DataType="ua:String" ValueRank="Scalar" Units="Enum" />
<Variable SymbolicName="MasterId" BrowseName="Type" DataType="ua:UInt32" ValueRank="Scalar" Value="1" Units="NUM" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" CmsDataType="AnalogData" CmsDataIndex="006" CmsDataOpt="NUM" />
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" Units="mm" SGroup="2" DBand="1" VGroup="P" />
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="015" CmsDataOpt="COUNT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Km" SGroup="4" DBand="1" VGroup="P" CmsDataType="CounterList" CmsDataIndex="014" CmsDataOpt="METER"/>
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" Units="m/min" SGroup="4" DBand="1" VGroup="P" />
<Variable SymbolicName="FeedOverride" BrowseName="FeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="RapidOverride" BrowseName="RapidOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
</Component>
<Component Name="OperatingGroups">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="SPINDLE" />
<Property SymbolicName="Model" BrowseName="Model" DataType="ua:String" ValueRank="Scalar" Value="CMS-SPINDLE-01" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="006" CmsDataOpt="BIT" />
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" Units="Krev" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="NUM" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="016" CmsDataOpt="HOURS" />
<Variable SymbolicName="SpeedRate" BrowseName="SpeedRate" DataType="ua:UInt32" ValueRank="Scalar" Units="rpm" />
<Variable SymbolicName="SpeedOverride" BrowseName="SpeedOverride" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" Units="Perc" />
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="025" CmsDataOpt="NUM" />
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" Units="" />
<Variable SymbolicName="ParentProc" BrowseName="ParentProc" DataType="ua:UInt32" ValueRank="Scalar" Units="" />
</Component>
</Component>
<Component Name="AuxiliaryGroups">
<Component Name="01">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="LUBRO" />
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="021" CmsDataOpt="NUM" />
</Component>
<Component Name="02">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_PUMP" />
<Variable SymbolicName="Status" BrowseName="Status" DataType="ua:String" ValueRank="Scalar" Units="Enum" CmsDataType="StatusList" CmsDataIndex="002" CmsDataOpt="BIT" />
<Variable SymbolicName="ActiveTime" BrowseName="ActiveTime" DataType="ua:Float" ValueRank="Scalar" Units="h" CmsDataType="CounterList" CmsDataIndex="017" CmsDataOpt="HOURS" />
</Component>
<Component Name="03">
<Property SymbolicName="Type" BrowseName="Type" DataType="ua:String" ValueRank="Scalar" Value="VACUUM_ACT" />
<Variable SymbolicName="Repetitions" BrowseName="Repetitions" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="019" CmsDataOpt="NUM" />
</Component>
</Component>
</Machine>
</ModelDesign>
-3
View File
@@ -1,3 +0,0 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
-111
View File
@@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
-6
View File
@@ -70,8 +70,6 @@ namespace SOUR.Core
{
currPubData.usrBroker = "dev-5c86dced371e9e980142167d";
currPubData.pwdBroker = "9c4173da75";
// loggo che sto aprtendo in modalita testing by SAM
printer.Print("***** SOUR: DEVELOP & TESTING MODE (S.E.L. workstation found) *****");
}
#endif
@@ -87,10 +85,6 @@ namespace SOUR.Core
autoReconnectDelayMs = 1000
};
}
else
{
printer.Print($"***** SOUR: MQTT broker not starting: publishigData (user/pwd) IS OK: {hasPublishingData} | vetosend (GwHw key) IS PRESENT: {hasVetoSend} *****");
}
try
{
-44
View File
@@ -1,44 +0,0 @@
<body>
<i>Server gestione Scehde di Collaudo</i>
<h4>Versione: {{CURRENT-REL}}</h4>
<br />
Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.3.1.* &rarr;</b>
<ul>
<li>Revisione ruoli</li>
<li>Gestione fasi con revisione e congelamento fasi</li>
<li>Nuovi elementi schede di collaudo</li>
<li>Implementazione sistema traduzione in campi schede/misure/parametri</li>
<li>Sistemi supporto traduzione/visualizzazione in lingua</li>
<li>Nuovi reports</li>
</ul>
</li>
<li>
<b>v.2.* &rarr;</b>
<ul>
<li>Implementazione modifiche per gestione in CMS</li>
</ul>
</li>
<li>
<b>v.1.* &rarr;</b>
<ul>
<li>Implementazione iniziale con gestione standard Ms AX + ISO9000 e succ</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2018</a>
</div>
</div>
</body>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.0.0</version>
<url>http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip</url>
<changelog>http://seriate.steamware.net:8083/SWS/CMS_SC/{{PACKNAME}}/{{BRANCHNAME}}/ChangeLog.html</changelog>
<mandatory>false</mandatory>
</item>
+33 -44
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>SOUR</RootNamespace>
<AssemblyName>SOUR</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
@@ -48,24 +47,16 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowedReferenceRelatedFileExtensions>
<!-- Prevent default XML and PDB files copied to output in RELEASE. Only *.allowedextension files will be included, which doesn't exist in my case. -->
*.pdb;
*.xml
</AllowedReferenceRelatedFileExtensions>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.0\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.0.22\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
</Reference>
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
<HintPath>..\packages\StackExchange.Redis.2.0.601\lib\net461\StackExchange.Redis.dll</HintPath>
@@ -76,12 +67,12 @@
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.6.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.5.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
@@ -90,12 +81,12 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.6.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
<Reference Include="System.Threading.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.5.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -129,31 +120,34 @@
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<Content Include="DataModel.demo.xml">
<None Include="forceDb.ini" />
<None Include="logs\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="DataModel.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="FodyWeavers.xml" />
<Content Include="lib\.placeholder">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="logs\.placeholder">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="FodyWeavers.xsd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<Content Include="Rec\.placeholder">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<None Include="Rec\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="Resources\RedisEndpoint.txt">
<SubType>Designer</SubType>
</Content>
<None Include="Resources\App.Debug.config">
<DependentUpon>RedisEndpoint.txt</DependentUpon>
</None>
<None Include="Resources\App.Release.config">
<DependentUpon>RedisEndpoint.txt</DependentUpon>
</None>
<None Include="Resources\CNC.map" />
<None Include="Resources\CNC.msg" />
<None Include="Resources\convertScmAlarm.ps1" />
<None Include="Resources\PLC.map" />
<None Include="Resources\PLC.msg" />
</ItemGroup>
<ItemGroup>
<Folder Include="CONF\" />
</ItemGroup>
<ItemGroup>
<Content Include="DataModel.xml" />
<Content Include="Server.Config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
@@ -191,20 +185,15 @@
</PropertyGroup>
<Target Name="AfterBuild">
<ItemGroup>
<MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" Exclude="$(OutputPath)Server.Config.xml; $(OutputPath)DataModel.xml" />
<MoveToLibFolder Include="$(OutputPath)*.dll ; $(OutputPath)*.pdb ; $(OutputPath)*.xml" Exclude="$(OutputPath)DataModel.xml; $(OutputPath)Server.Config.xml" />
</ItemGroup>
<Move SourceFiles="@(MoveToLibFolder)" DestinationFolder="$(OutputPath)lib" OverwriteReadOnlyFiles="true" />
</Target>
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.20\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.20\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
<Error Condition="!Exists('..\packages\Fody.6.0.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.0.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.20\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.20\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
</Target>
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
<Import Project="..\packages\Fody.6.0.5\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.5\build\Fody.targets')" />
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
</Project>
-1
View File
@@ -1 +0,0 @@

+7 -11
View File
@@ -1,21 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="4.1.0" targetFramework="net461" />
<package id="Fody" version="6.0.5" targetFramework="net461" developmentDependency="true" />
<package id="log4net" version="2.0.8" targetFramework="net461" />
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net461" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net461" developmentDependency="true" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Pipelines.Sockets.Unofficial" version="2.1.0" targetFramework="net461" />
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.20" targetFramework="net461" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
<package id="Pipelines.Sockets.Unofficial" version="2.0.22" targetFramework="net461" />
<package id="PrettyBin" version="1.1.0" targetFramework="net461" />
<package id="StackExchange.Redis" version="2.0.601" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.Diagnostics.PerformanceCounter" version="4.6.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net461" />
<package id="System.Diagnostics.PerformanceCounter" version="4.5.0" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
<package id="System.Threading.Channels" version="4.6.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Threading.Channels" version="4.5.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net461" />
</packages>
+2 -4
View File
@@ -15,9 +15,7 @@
[assembly: System.Reflection.AssemblyCopyright("Copyright © Steamware 2018+")]
[assembly: System.Reflection.AssemblyTrademark("_")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: System.Reflection.AssemblyVersion("1.0.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("1.0.0.0")]
// [assembly: System.Reflection.AssemblyVersion("2.2.1907.257")]
// [assembly: System.Reflection.AssemblyFileVersion("2.2.1907.257")]
[assembly: System.Reflection.AssemblyVersion("2.2.1907.257")]
[assembly: System.Reflection.AssemblyFileVersion("2.2.1907.257")]
+1 -1
View File
@@ -31,7 +31,7 @@ namespace TestApp
pwd_broker = "9c4173da75",
autoReconnectDelayMs = 1000
};
mqttCli = new MQTT_Client(currConfig, new NullPrinter());
mqttCli = new MQTT_Client(currConfig);
await mqttCli.startAsync();
+2 -2
View File
@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>TestApp</RootNamespace>
<AssemblyName>TestApp</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
@@ -34,7 +34,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
</packages>
+219
View File
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ua="http://opcfoundation.org/UA/2008/02/Types.xsd"
xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd"
>
<ApplicationName>Server</ApplicationName>
<ApplicationUri>urn:localhost:UA:Server</ApplicationUri>
<ProductUri>uri:opcfoundation.org:Server</ProductUri>
<ApplicationType>Server_0</ApplicationType>
<SecurityConfiguration>
<!-- Where the application instance certificate is stored (MachineDefault) -->
<ApplicationCertificate>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\MachineDefault</StorePath>
<SubjectName>CN=SOUR SCM OPC UA Server, C=IT, S=Rimini, O=SCM Group, DC=localhost</SubjectName>
</ApplicationCertificate>
<!-- Where the issuer certificate are stored (certificate authorities) -->
<TrustedIssuerCertificates>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\UA Certificate Authorities</StorePath>
</TrustedIssuerCertificates>
<!-- Where the trust list is stored (UA Applications) -->
<TrustedPeerCertificates>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\UA Applications</StorePath>
</TrustedPeerCertificates>
<!-- The directory used to store invalid certficates for later review by the administrator. -->
<RejectedCertificateStore>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\RejectedCertificates</StorePath>
</RejectedCertificateStore>
<!-- WARNING: The following setting (to automatically accept untrusted certificates) should be used
for easy debugging purposes ONLY and turned off for production deployments! -->
<AutoAcceptUntrustedCertificates>false</AutoAcceptUntrustedCertificates>
<!-- WARNING: SHA1 signed certficates are by default rejected and should be phased out.
The setting below to allow them is only required for UACTT (1.02.336.244) which uses SHA-1 signed certs. -->
<RejectSHA1SignedCertificates>false</RejectSHA1SignedCertificates>
<MinimumCertificateKeySize>2048</MinimumCertificateKeySize>
</SecurityConfiguration>
<TransportConfigurations></TransportConfigurations>
<TransportQuotas>
<OperationTimeout>600000</OperationTimeout>
<MaxStringLength>1048576</MaxStringLength>
<MaxByteStringLength>1048576</MaxByteStringLength>
<MaxArrayLength>65535</MaxArrayLength>
<MaxMessageSize>4194304</MaxMessageSize>
<MaxBufferSize>65535</MaxBufferSize>
<ChannelLifetime>300000</ChannelLifetime>
<SecurityTokenLifetime>3600000</SecurityTokenLifetime>
</TransportQuotas>
<ServerConfiguration>
<BaseAddresses>
<ua:String>opc.tcp://127.0.0.1:62541/Server</ua:String>
</BaseAddresses>
<SecurityPolicies>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>None_1</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#None</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256</SecurityPolicyUri>
</ServerSecurityPolicy>
</SecurityPolicies>
<MinRequestThreadCount>5</MinRequestThreadCount>
<MaxRequestThreadCount>100</MaxRequestThreadCount>
<MaxQueuedRequestCount>2000</MaxQueuedRequestCount>
<!-- The SDK expects the server to support the same set of user tokens for every endpoint. -->
<UserTokenPolicies>
<!-- Allows anonymous users -->
<ua:UserTokenPolicy>
<ua:TokenType>Anonymous_0</ua:TokenType>
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#None</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
<!-- Allows username/password -->
<ua:UserTokenPolicy>
<ua:TokenType>UserName_1</ua:TokenType>
<!-- passwords must be encrypted - this specifies what algorithm to use -->
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
<!-- Allows user certificates -->
<ua:UserTokenPolicy>
<ua:TokenType>Certificate_2</ua:TokenType>
<!-- certificate possession must be proven with a digital signature - this specifies what algorithm to use -->
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
</UserTokenPolicies>
<DiagnosticsEnabled>false</DiagnosticsEnabled>
<MaxSessionCount>100</MaxSessionCount>
<MinSessionTimeout>10000</MinSessionTimeout>
<MaxSessionTimeout>3600000</MaxSessionTimeout>
<MaxBrowseContinuationPoints>10</MaxBrowseContinuationPoints>
<MaxQueryContinuationPoints>10</MaxQueryContinuationPoints>
<MaxHistoryContinuationPoints>100</MaxHistoryContinuationPoints>
<MaxRequestAge>600000</MaxRequestAge>
<MinPublishingInterval>100</MinPublishingInterval>
<MaxPublishingInterval>3600000</MaxPublishingInterval>
<PublishingResolution>50</PublishingResolution>
<MaxSubscriptionLifetime>3600000</MaxSubscriptionLifetime>
<MaxMessageQueueSize>100</MaxMessageQueueSize>
<MaxNotificationQueueSize>100</MaxNotificationQueueSize>
<MaxNotificationsPerPublish>1000</MaxNotificationsPerPublish>
<MinMetadataSamplingInterval>1000</MinMetadataSamplingInterval>
<AvailableSamplingRates>
<SamplingRateGroup>
<Start>5</Start>
<Increment>5</Increment>
<Count>20</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>100</Start>
<Increment>100</Increment>
<Count>4</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>500</Start>
<Increment>250</Increment>
<Count>2</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>1000</Start>
<Increment>500</Increment>
<Count>20</Count>
</SamplingRateGroup>
</AvailableSamplingRates>
<RegistrationEndpoint>
<ua:EndpointUrl>opc.tcp://localhost:4840</ua:EndpointUrl>
<ua:Server>
<ua:ApplicationUri>opc.tcp://localhost:4840</ua:ApplicationUri>
<ua:ApplicationType>DiscoveryServer_3</ua:ApplicationType>
<ua:DiscoveryUrls>
<ua:String>opc.tcp://localhost:4840</ua:String>
</ua:DiscoveryUrls>
</ua:Server>
<ua:SecurityMode>SignAndEncrypt_3</ua:SecurityMode>
<ua:SecurityPolicyUri />
<ua:UserIdentityTokens />
</RegistrationEndpoint>
<MaxRegistrationInterval>0</MaxRegistrationInterval>
<NodeManagerSaveFile>Server.nodes.xml</NodeManagerSaveFile>
<MinSubscriptionLifetime>10000</MinSubscriptionLifetime>
<MaxPublishRequestCount>20</MaxPublishRequestCount>
<MaxSubscriptionCount>100</MaxSubscriptionCount>
<MaxEventQueueSize>10000</MaxEventQueueSize>
<!-- see https://opcfoundation-onlineapplications.org/profilereporting/ for list of available profiles -->
<ServerProfileArray>
<ua:String>Standard UA Server Profile</ua:String>
<ua:String>Data Access Server Facet</ua:String>
<ua:String>Method Server Facet</ua:String>
</ServerProfileArray>
<ShutdownDelay>5</ShutdownDelay>
<ServerCapabilities>
<ua:String>UA</ua:String>
</ServerCapabilities>
<SupportedPrivateKeyFormats>
<ua:String>PFX</ua:String>
<ua:String>PEM</ua:String>
</SupportedPrivateKeyFormats>
<MaxTrustListSize>0</MaxTrustListSize>
<MultiCastDnsEnabled>false</MultiCastDnsEnabled>
</ServerConfiguration>
<TraceConfiguration>
<OutputFilePath>Logs\Server.log.txt</OutputFilePath>
<DeleteOnLoad>true</DeleteOnLoad>
<!-- Show Only Errors -->
<!-- <TraceMasks>1</TraceMasks> -->
<!-- Show Only Security and Errors -->
<!-- <TraceMasks>513</TraceMasks> -->
<!-- Show Only Security, Errors and Trace -->
<!-- <TraceMasks>515</TraceMasks> -->
<!-- Show Only Security, COM Calls, Errors and Trace -->
<!-- <TraceMasks>771</TraceMasks> -->
<!-- Show Only Security, Service Calls, Errors and Trace -->
<!-- <TraceMasks>523</TraceMasks> -->
<!-- Show Only Security, ServiceResultExceptions, Errors and Trace -->
<!-- <TraceMasks>519</TraceMasks> -->
</TraceConfiguration>
</ApplicationConfiguration>
+11 -13
View File
@@ -114,23 +114,21 @@ namespace XUnitTestProject1
[Fact]
public void sanitizeTest()
{
XmlDocument xmlOrig = new XmlDocument();
xmlOrig.LoadXml("DataModel.xml");
string xmlOrig = System.IO.File.ReadAllText(@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\DataModel.xml");
//calcolo lunghezza stringa in ingresso
int lenghtOrig;
//int lenghtOrig = xmlOrig.Length;
//calcolo lunghezza stringa in ingresso...
int lenghtOrig = xmlOrig.Length;
//ne scrivo uno di test
//XmlDocument xmlRes = DataHelper.xmlSanitize(xmlOrig);
//ne scrivo uno di test...
string xmlRes = DataHelper.xmlSanitize(xmlOrig);
//calcolo lunghezza stringa in uscita
int lenghtRes;
//int lenghtRes= xmlRes.Lenght;
//calcolo lunghezza stringa in uscita...
int lenghtRes= xmlRes.Length;
//bool b = lenghtRes <= lenghtOrig;
//Assert.True(b);
//verifico che la stringa di output da sanitize sia di lunghezza <= a quella data in input...
bool b = lenghtRes <= lenghtOrig;
Assert.True(b);
}
}
+100 -1
View File
@@ -1,8 +1,107 @@
using System;
using Xunit;
using SOUR.Core;
using OpcUaCommon.Services;
using SOUR.Core.Model;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Xml;
using SOUR.Core.Services;
using OpcUaServer.Server;
using OpcUaServer.Server.Services;
namespace XUnitTestProject1
{
/*
public class RedisSampler
{
/// <summary>
/// Lista delle proprietà in XML (Eliminare... sono costanti)
/// </summary>
protected List<MemDataItem> Properties;
/// <summary>
/// Lista delle variabili da XML
/// </summary>
protected List<MemDataItem> Variables;
/// <summary>
/// Lista delle condizioni di allarme da XML
/// </summary>
protected List<MemDataItem> Conditions;
}
}
DObbiamo testare 2 cose
1) creazione oggetto
2) creazione + start oggetto
*/
public class UTS_SourCoreRedisSampler
{
public IPrinter _printer;
public XmlParser _xmlParser=new XmlParser(new EventMessageRepository("..\\archive"));
public ServerManagerDecorator ServerMD { get; private set; }
/// <summary>
/// FIle conf XML (da sostituire con quello scaricato da REDIS)
/// </summary>
public string _xmlConfigurationPath = (@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\DataModel.xml");
public string _serverConfigurationFilePath = ("Server.Config.xml");
//public string _serverConfigurationFilePath = (@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\Server.Config.xml");
private readonly DataRecorder _recorder;
protected MQTT_Client.confData _mqttConf;
protected MQTT_Client _mqttCli;
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
{
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
}
protected IRedisSampler GetSampler(ServerDecorator server)
{
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
ServerMD = new ServerManagerDecorator(server);
return new RedisSampler(ServerMD, _xmlConfigurationPath, this._printer,
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
}
[Fact]
public void CreateTest()
{
// metodi da start...
_printer = new ConsoleLogPrinter(new IPrinter[] { new NullPrinter() });
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
var redSampler = GetSampler(server);
//controllo che il redSampler non sia nullo
Assert.NotNull(redSampler);
}
[Fact]
public void StartTest()
{
// metodi da start...
_printer = new ConsoleLogPrinter(new IPrinter[] { new NullPrinter() });
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
var redSampler = GetSampler(server);
redSampler.Start();
//controllo che il redSampler non sia nullo
Assert.NotNull(redSampler);
}
}
}
+6
View File
@@ -8,10 +8,14 @@
<ItemGroup>
<None Remove="DataModel.xml" />
<None Remove="Server.Config.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="DataModel.xml" />
<Content Include="Server.Config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
@@ -27,6 +31,8 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpcUaCommon\OpcUaCommon.csproj" />
<ProjectReference Include="..\OpcUaServer.Server\OpcUaServer.Server.csproj" />
<ProjectReference Include="..\SOUR.Core\SOUR.Core.csproj" />
<ProjectReference Include="..\SOUR\SOUR.csproj" />
</ItemGroup>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Le informazioni generali relative a un assembly sono controllate dal seguente
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
// associate a un assembly.
[assembly: AssemblyTitle("xUnitTestSOUR")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("xUnitTestSOUR")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
[assembly: Guid("6a68226f-c5f2-4a04-ab31-4ad4b69a40d2")]
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Versione principale
// Versione secondaria
// Numero di build
// Revisione
//
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+219
View File
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<ApplicationConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ua="http://opcfoundation.org/UA/2008/02/Types.xsd"
xmlns="http://opcfoundation.org/UA/SDK/Configuration.xsd"
>
<ApplicationName>Server</ApplicationName>
<ApplicationUri>urn:localhost:UA:Server</ApplicationUri>
<ProductUri>uri:opcfoundation.org:Server</ProductUri>
<ApplicationType>Server_0</ApplicationType>
<SecurityConfiguration>
<!-- Where the application instance certificate is stored (MachineDefault) -->
<ApplicationCertificate>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\MachineDefault</StorePath>
<SubjectName>CN=SOUR SCM OPC UA Server, C=IT, S=Rimini, O=SCM Group, DC=localhost</SubjectName>
</ApplicationCertificate>
<!-- Where the issuer certificate are stored (certificate authorities) -->
<TrustedIssuerCertificates>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\UA Certificate Authorities</StorePath>
</TrustedIssuerCertificates>
<!-- Where the trust list is stored (UA Applications) -->
<TrustedPeerCertificates>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\UA Applications</StorePath>
</TrustedPeerCertificates>
<!-- The directory used to store invalid certficates for later review by the administrator. -->
<RejectedCertificateStore>
<StoreType>Directory</StoreType>
<StorePath>%CommonApplicationData%\OPC Foundation\CertificateStores\RejectedCertificates</StorePath>
</RejectedCertificateStore>
<!-- WARNING: The following setting (to automatically accept untrusted certificates) should be used
for easy debugging purposes ONLY and turned off for production deployments! -->
<AutoAcceptUntrustedCertificates>false</AutoAcceptUntrustedCertificates>
<!-- WARNING: SHA1 signed certficates are by default rejected and should be phased out.
The setting below to allow them is only required for UACTT (1.02.336.244) which uses SHA-1 signed certs. -->
<RejectSHA1SignedCertificates>false</RejectSHA1SignedCertificates>
<MinimumCertificateKeySize>2048</MinimumCertificateKeySize>
</SecurityConfiguration>
<TransportConfigurations></TransportConfigurations>
<TransportQuotas>
<OperationTimeout>600000</OperationTimeout>
<MaxStringLength>1048576</MaxStringLength>
<MaxByteStringLength>1048576</MaxByteStringLength>
<MaxArrayLength>65535</MaxArrayLength>
<MaxMessageSize>4194304</MaxMessageSize>
<MaxBufferSize>65535</MaxBufferSize>
<ChannelLifetime>300000</ChannelLifetime>
<SecurityTokenLifetime>3600000</SecurityTokenLifetime>
</TransportQuotas>
<ServerConfiguration>
<BaseAddresses>
<ua:String>opc.tcp://127.0.0.1:62541/Server</ua:String>
</BaseAddresses>
<SecurityPolicies>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>None_1</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#None</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>Sign_2</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256</SecurityPolicyUri>
</ServerSecurityPolicy>
<ServerSecurityPolicy>
<SecurityMode>SignAndEncrypt_3</SecurityMode>
<SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256</SecurityPolicyUri>
</ServerSecurityPolicy>
</SecurityPolicies>
<MinRequestThreadCount>5</MinRequestThreadCount>
<MaxRequestThreadCount>100</MaxRequestThreadCount>
<MaxQueuedRequestCount>2000</MaxQueuedRequestCount>
<!-- The SDK expects the server to support the same set of user tokens for every endpoint. -->
<UserTokenPolicies>
<!-- Allows anonymous users -->
<ua:UserTokenPolicy>
<ua:TokenType>Anonymous_0</ua:TokenType>
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#None</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
<!-- Allows username/password -->
<ua:UserTokenPolicy>
<ua:TokenType>UserName_1</ua:TokenType>
<!-- passwords must be encrypted - this specifies what algorithm to use -->
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
<!-- Allows user certificates -->
<ua:UserTokenPolicy>
<ua:TokenType>Certificate_2</ua:TokenType>
<!-- certificate possession must be proven with a digital signature - this specifies what algorithm to use -->
<ua:SecurityPolicyUri>http://opcfoundation.org/UA/SecurityPolicy#Basic256</ua:SecurityPolicyUri>
</ua:UserTokenPolicy>
</UserTokenPolicies>
<DiagnosticsEnabled>false</DiagnosticsEnabled>
<MaxSessionCount>100</MaxSessionCount>
<MinSessionTimeout>10000</MinSessionTimeout>
<MaxSessionTimeout>3600000</MaxSessionTimeout>
<MaxBrowseContinuationPoints>10</MaxBrowseContinuationPoints>
<MaxQueryContinuationPoints>10</MaxQueryContinuationPoints>
<MaxHistoryContinuationPoints>100</MaxHistoryContinuationPoints>
<MaxRequestAge>600000</MaxRequestAge>
<MinPublishingInterval>100</MinPublishingInterval>
<MaxPublishingInterval>3600000</MaxPublishingInterval>
<PublishingResolution>50</PublishingResolution>
<MaxSubscriptionLifetime>3600000</MaxSubscriptionLifetime>
<MaxMessageQueueSize>100</MaxMessageQueueSize>
<MaxNotificationQueueSize>100</MaxNotificationQueueSize>
<MaxNotificationsPerPublish>1000</MaxNotificationsPerPublish>
<MinMetadataSamplingInterval>1000</MinMetadataSamplingInterval>
<AvailableSamplingRates>
<SamplingRateGroup>
<Start>5</Start>
<Increment>5</Increment>
<Count>20</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>100</Start>
<Increment>100</Increment>
<Count>4</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>500</Start>
<Increment>250</Increment>
<Count>2</Count>
</SamplingRateGroup>
<SamplingRateGroup>
<Start>1000</Start>
<Increment>500</Increment>
<Count>20</Count>
</SamplingRateGroup>
</AvailableSamplingRates>
<RegistrationEndpoint>
<ua:EndpointUrl>opc.tcp://localhost:4840</ua:EndpointUrl>
<ua:Server>
<ua:ApplicationUri>opc.tcp://localhost:4840</ua:ApplicationUri>
<ua:ApplicationType>DiscoveryServer_3</ua:ApplicationType>
<ua:DiscoveryUrls>
<ua:String>opc.tcp://localhost:4840</ua:String>
</ua:DiscoveryUrls>
</ua:Server>
<ua:SecurityMode>SignAndEncrypt_3</ua:SecurityMode>
<ua:SecurityPolicyUri />
<ua:UserIdentityTokens />
</RegistrationEndpoint>
<MaxRegistrationInterval>0</MaxRegistrationInterval>
<NodeManagerSaveFile>Server.nodes.xml</NodeManagerSaveFile>
<MinSubscriptionLifetime>10000</MinSubscriptionLifetime>
<MaxPublishRequestCount>20</MaxPublishRequestCount>
<MaxSubscriptionCount>100</MaxSubscriptionCount>
<MaxEventQueueSize>10000</MaxEventQueueSize>
<!-- see https://opcfoundation-onlineapplications.org/profilereporting/ for list of available profiles -->
<ServerProfileArray>
<ua:String>Standard UA Server Profile</ua:String>
<ua:String>Data Access Server Facet</ua:String>
<ua:String>Method Server Facet</ua:String>
</ServerProfileArray>
<ShutdownDelay>5</ShutdownDelay>
<ServerCapabilities>
<ua:String>UA</ua:String>
</ServerCapabilities>
<SupportedPrivateKeyFormats>
<ua:String>PFX</ua:String>
<ua:String>PEM</ua:String>
</SupportedPrivateKeyFormats>
<MaxTrustListSize>0</MaxTrustListSize>
<MultiCastDnsEnabled>false</MultiCastDnsEnabled>
</ServerConfiguration>
<TraceConfiguration>
<OutputFilePath>Logs\Server.log.txt</OutputFilePath>
<DeleteOnLoad>true</DeleteOnLoad>
<!-- Show Only Errors -->
<!-- <TraceMasks>1</TraceMasks> -->
<!-- Show Only Security and Errors -->
<!-- <TraceMasks>513</TraceMasks> -->
<!-- Show Only Security, Errors and Trace -->
<!-- <TraceMasks>515</TraceMasks> -->
<!-- Show Only Security, COM Calls, Errors and Trace -->
<!-- <TraceMasks>771</TraceMasks> -->
<!-- Show Only Security, Service Calls, Errors and Trace -->
<!-- <TraceMasks>523</TraceMasks> -->
<!-- Show Only Security, ServiceResultExceptions, Errors and Trace -->
<!-- <TraceMasks>519</TraceMasks> -->
</TraceConfiguration>
</ApplicationConfiguration>
@@ -0,0 +1,205 @@
using System;
using Xunit;
using SOUR.Core;
using OpcUaCommon.Services;
using System.Text;
using System.Globalization;
using SOUR.Core.Services;
using System.Reflection;
using System.Threading;
using System.IO;
namespace xUnitTestSOUR
{
public class UTS_SourCoreApplicationStarter
{
/****************************************************************************
* Questa classe deve fare i test dei metodi pubblici di ApplicationStarter.cs
*
* In particolare vanno testati 3 metodi pubblici:
* - ApplicationStarter
* - Start
* - GetSampler
*
* Andiamo a definire i test di
* - creazione oggetti in modo corretto (passando parametri) --> assert success
* - creazione oggetti in modo NON corretto (es non passando parametri) --> assert fail
* - avvio metodo SENZA ERRORI (assert success)
* - avvio ultimo metodo con oggetto restituito valido
*
* mod: 2019.07.23 S.Terzi
* mod: 2019.07.24 S.E. Locatelli
* mod: 2019.07.24 S.Terzi
* mod: 2019.07.25 S.Terzi
* mod: 2019.07.26 S.Terzi
*
****************************************************************************/
#region helpers e utility
/// <summary>
/// Effettua se abilitata registrazione apertura file con dt stop
/// </summary>
/// <param name="recorder"></param>
private static void recorderStart(DataRecorder recorder)
{
if (true)
{
// provo a scrivere nel dataRecorder...
StringBuilder sb = new StringBuilder();
sb.AppendLine("#-----------------------------------------#");
sb.AppendLine(string.Format("# Versione : v_{0}", Assembly.GetExecutingAssembly().GetName().Version));
sb.AppendLine(string.Format("# Rec Start: {0:yyyy.MM.dd HH:mm:ss}", DateTime.Now));
sb.AppendLine("#-----------------------------------------#");
recorder.Print(sb.ToString());
}
}
/// <summary>
/// Effettua se abilitata registrazione chiusura file con dt stop
/// </summary>
/// <param name="recorder"></param>
private static void recorderClose(DataRecorder recorder)
{
if (true)
{
// salvo chiusura recorder
StringBuilder sb = new StringBuilder();
sb.AppendLine("#-----------------------------------------#");
sb.AppendLine(string.Format("# Rec Stop: {0:yyyy.MM.dd HH:mm:ss}", DateTime.Now));
sb.AppendLine("#-----------------------------------------#");
recorder.Print(sb.ToString());
}
}
/// <summary>
/// Init console stsandard
/// </summary>
private static void initConsole()
{
// 2019.02.10 imposto culture EN + UTF8...
Console.OutputEncoding = Encoding.UTF8;
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
#endregion
[Fact]
public void ApplicationStarterInitRecorder()
{
initConsole();
// avvio logprinter...
var printer = new ConsoleLogPrinter(new IPrinter[] { new ConsolePrinter() });
string recFile = string.Format(@"{0}Rec\SOUR_{1:yyyyMMdd_HHmmss}.log", AppDomain.CurrentDomain.BaseDirectory, DateTime.Now);
// oggetto recorder
var recorder = new DataRecorder(recFile);
recorderStart(recorder);
// verifico che il file esista e abbia almeno 1 riga contenuta...
Assert.NotNull(recorder);
// pulizia...
File.Delete(recFile);
}
[Fact]
public void ApplicationStarterInitFile()
{
initConsole();
// avvio logprinter...
var printer = new ConsoleLogPrinter(new IPrinter[] { new ConsolePrinter() });
string recFile = string.Format(@"{0}Rec\SOUR_{1:yyyyMMdd_HHmmss}.log", AppDomain.CurrentDomain.BaseDirectory, DateTime.Now);
// oggetto recorder
var recorder = new DataRecorder(recFile);
recorderStart(recorder);
// verifico che il file esista e abbia almeno 1 riga contenuta...
Assert.True(File.Exists(recFile));
// pulizia...
File.Delete(recFile);
}
[Fact]
public void ApplicationStarterInitFail()
{
initConsole();
// avvio logprinter... ma NULLA
var printer = new ConsoleLogPrinter(new IPrinter[] { new NullPrinter() });
string recFile = string.Format(@"{0}Rec\SOUR_{1:yyyyMMdd_HHmmss}.log",
AppDomain.CurrentDomain.BaseDirectory, DateTime.Now);
// singolo file giornaliero in DEBUG locale...
recFile = string.Format(@"{0}Rec\SOUR_{1:yyyyMMdd}.log", AppDomain.CurrentDomain.BaseDirectory, DateTime.Now);
// oggetto recorder
var recorder = new DataRecorder(recFile);
recorderStart(recorder);
// init MQTT
MQTT_Client.confData currConfig = new MQTT_Client.confData();
currConfig = new MQTT_Client.confData();
try
{
printer.Print("***** SOUR.S (SCM OpcUa Redis SERVER) started... *****");
string xmlConfigurationPath = memLayer.man.confReadString("DataModelPath");
// init application starter
var appStart = new ApplicationStarter(printer, xmlConfigurationPath, new XmlParser(new EventMessageRepository("..\\archive")), null, recorder, currConfig);
// avvio
appStart.Start();
// chiusura
printer.Print("***** SOUR.S closed... *****");
// chiudo rec SE abilitata
recorderClose(recorder);
// salvo chiusura...
DataHelper.sendRedisStop();
var expected = typeof(SOUR.Core.ApplicationStarter);
Assert.IsType(expected, appStart);
// pulizia...
File.Delete(recFile);
}
catch (Exception ex)
{
printer.Print("**** Error *****");
printer.Print(ex.ToString());
Console.ReadLine();
}
}
}
}
@@ -0,0 +1,135 @@
using System;
using Xunit;
using SOUR.Core;
using SOUR.Core.Services;
using System.Xml;
namespace xUnitTestSOUR
{
public class UTS_SourCoreDataHelper
{
/// <summary>
/// Formato output timestamp
/// </summary>
protected static string dataFormat = "yyyy-MM-dd\\THH:mm:ss.fffK";
// !!!TDB!!! provare questo formato ma ha 7 decimali...
//protected string dataFormat = "O";
/// <summary>
/// Timestamp formattato...
/// </summary>
protected static string timestamp
{
get
{
return DateTime.UtcNow.ToString(dataFormat);
}
}
/// <summary>
/// TTL eventi BREVI (15 sec)
/// </summary>
public static int shortTTL = 15;
/// <summary>
/// TTL eventi LUNGI (5 minuto)
/// </summary>
public static int longTTL = 300;
/// <summary>
/// classe gestione accessi a Session, cache, viewstate, configuration...
/// </summary>
[Fact]
public void redisSendTest()
{
// setup valori
string currKey = "";
string expected = "1.2.3.4";
currKey = memLayer.man.redHash("Srv:Vers");
// leggo il valore de versione da redis
string currVers = memLayer.man.getRSV(currKey);
// ne scrivo uno di test
DataHelper.sendRedisStart(expected);
// rileggo
string newVal = memLayer.man.getRSV(currKey);
// controllo sia corretto
Assert.Equal(newVal, expected);
// riscrivo valore iniziale
memLayer.man.setRSV(currKey, currVers);
}
[Fact]
public void redisStopTest()
{
//setup valori
string currKey= "";
string expected = "stopped";
currKey = memLayer.man.redHash("Srv:Status");
// ne scrivo uno di test
DataHelper.sendRedisStop();
//rileggo
string newVal = memLayer.man.getRSV(currKey);
//controllo
Assert.Equal(expected, newVal);
}
[Fact]
public void redisHBeatTest()
{
// test dell'hearbeat: priam di tutto lo invoco e verifico abbia scritto una delel chiavi di controllo, poia ttendo 15 sec e ricontrollo se sia scomparsa...
//setup valori
string currKey = memLayer.man.redHash("Srv:Status");
//ne scrivo uno di test
DataHelper.sendRedisHBeat();
// leggo valore scritto
string newVal = memLayer.man.getRSV(currKey);
//test con valore "running"
Assert.Equal("running", newVal);
//attesa 15 sec
System.Threading.Thread.Sleep(15000);
// rileggo --> mi aspetto null...
newVal = memLayer.man.getRSV(currKey);
//test 2
Assert.Null(newVal);
}
// qui fai il iltest che la funzione sanitize restituisca una stringa di lunghezza <= di quella in ingresso, che DOVREBBE essere un XML letto da file...
[Fact]
public void sanitizeTest()
{
string xmlOrig = System.IO.File.ReadAllText(@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\DataModel.xml");
//calcolo lunghezza stringa in ingresso...
int lenghtOrig = xmlOrig.Length;
//ne scrivo uno di test...
string xmlRes = DataHelper.xmlSanitize(xmlOrig);
//calcolo lunghezza stringa in uscita...
int lenghtRes= xmlRes.Length;
//verifico che la stringa di output da sanitize sia di lunghezza <= a quella data in input...
bool b = lenghtRes <= lenghtOrig;
Assert.True(b);
}
}
}
@@ -0,0 +1,105 @@
using System;
using Xunit;
using SOUR.Core;
using OpcUaCommon.Services;
using SOUR.Core.Model;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Xml;
using SOUR.Core.Services;
using OpcUaServer.Server;
using OpcUaServer.Server.Services;
namespace xUnitTestSOUR
{
/*
public class RedisSampler
{
/// <summary>
/// Lista delle proprietà in XML (Eliminare... sono costanti)
/// </summary>
protected List<MemDataItem> Properties;
/// <summary>
/// Lista delle variabili da XML
/// </summary>
protected List<MemDataItem> Variables;
/// <summary>
/// Lista delle condizioni di allarme da XML
/// </summary>
protected List<MemDataItem> Conditions;
}
Dobbiamo testare 2 cose
1) creazione oggetto
2) creazione + start oggetto
*/
public class UTS_SourCoreRedisSampler
{
public IPrinter _printer;
public XmlParser _xmlParser=new XmlParser(new EventMessageRepository("..\\archive"));
public ServerManagerDecorator ServerMD { get; private set; }
/// <summary>
/// FIle conf XML (da sostituire con quello scaricato da REDIS)
/// </summary>
public string _xmlConfigurationPath = (@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\DataModel.xml");
public string _serverConfigurationFilePath = ("Server.Config.xml");
//public string _serverConfigurationFilePath = (@"C:\Users\simone.terzi\Documents\Repo\OPC-UA-REDIS\src\XUnitTestSOUR\Server.Config.xml");
private readonly DataRecorder _recorder;
protected MQTT_Client.confData _mqttConf;
protected MQTT_Client _mqttCli;
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
{
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
}
protected IRedisSampler GetSampler(ServerDecorator server)
{
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
ServerMD = new ServerManagerDecorator(server);
return new RedisSampler(ServerMD, _xmlConfigurationPath, this._printer,
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
}
[Fact]
public void CreateTest()
{
// metodi da start...
_printer = new ConsoleLogPrinter(new IPrinter[] { new NullPrinter() });
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
var redSampler = GetSampler(server);
//controllo che il redSampler non sia nullo
Assert.NotNull(redSampler);
}
[Fact]
public void StartTest()
{
// metodi da start...
_printer = new ConsoleLogPrinter(new IPrinter[] { new NullPrinter() });
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
// avvio server
StartServer(_printer, server, _serverConfigurationFilePath);
var redSampler = GetSampler(server);
redSampler.Start();
//controllo che il redSampler non sia nullo
Assert.NotNull(redSampler);
}
}
}
+91
View File
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.5.0" newVersion="1.8.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.4.1" targetFramework="net461" />
<package id="xunit.abstractions" version="2.0.3" targetFramework="net461" />
<package id="xunit.analyzers" version="0.10.0" targetFramework="net461" />
<package id="xunit.assert" version="2.4.1" targetFramework="net461" />
<package id="xunit.core" version="2.4.1" targetFramework="net461" />
<package id="xunit.extensibility.core" version="2.4.1" targetFramework="net461" />
<package id="xunit.extensibility.execution" version="2.4.1" targetFramework="net461" />
</packages>
+108
View File
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6A68226F-C5F2-4A04-AB31-4AD4B69A40D2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>xUnitTestSOUR</RootNamespace>
<AssemblyName>xUnitTestSOUR</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UTS_SourCoreApplicationStarter.cs" />
<Compile Include="UTS_SourCoreDataHelper.cs" />
<Compile Include="UTS_SourCoreRedisSampler.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="DataModel.xml" />
<Content Include="Server.Config.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Rec\.placeholder">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpcUaCommon\OpcUaCommon.csproj">
<Project>{4c09fe6b-20fe-4a16-8443-f8be8ae0849a}</Project>
<Name>OpcUaCommon</Name>
</ProjectReference>
<ProjectReference Include="..\OpcUaServer.Server\OpcUaServer.Server.csproj">
<Project>{1e81f982-2e67-4f37-9d0d-c1e1f2c3c415}</Project>
<Name>OpcUaServer.Server</Name>
</ProjectReference>
<ProjectReference Include="..\SOUR.Core\SOUR.Core.csproj">
<Project>{c91082e5-3ec7-4ae7-b2f1-c7c194a02165}</Project>
<Name>SOUR.Core</Name>
</ProjectReference>
<ProjectReference Include="..\SOUR\SOUR.csproj">
<Project>{a924c997-f587-429a-a492-867460320b81}</Project>
<Name>SOUR</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.props'))" />
<Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
</Target>
<Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
</Project>