#pragma warning disable ...

#pragma warning restore ...
This commit is contained in:
Mike Phares 2022-02-15 09:56:12 -07:00
parent b97d7ebdb3
commit b1ca4d2f83
43 changed files with 596 additions and 465 deletions

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

@ -0,0 +1,20 @@
[
{
"DocumentId": {
"ProjectId": {
"Id": "36ce7503-a7d8-470b-8576-22756424c451"
},
"Id": "fcfbf07c-6987-4353-afb3-7491fde8d564"
},
"FileName": "WS.cs",
"FilePath": "T:\\MET08THFTIRQS408M\\06_SourceCode\\MET08THFTIRQS408M\\Adaptation\\Shared\\Metrology\\WS.cs",
"FileChanges": [
{
"LineNumber": 1,
"CharNumber": 1,
"DiagnosticId": "IMPORTS",
"FormatDescription": "Fix imports ordering."
}
]
}
]

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

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

View File

@ -2,12 +2,16 @@
"cSpell.words": [ "cSpell.words": [
"BIORAD", "BIORAD",
"CICN", "CICN",
"datauniqueid",
"EQPT", "EQPT",
"headerid",
"Hmmssffff", "Hmmssffff",
"ipdsf", "ipdsf",
"ISMTP", "ISMTP",
"messa", "messa",
"ntities",
"PDSF", "PDSF",
"THFTIRQS" "THFTIRQS",
"uctor"
] ]
} }

View File

@ -6,6 +6,11 @@ namespace Adaptation.Eaf.Core;
public class Backbone public class Backbone
{ {
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public const string STATE_ERROR = "Error"; public const string STATE_ERROR = "Error";
public const string STATE_OFFLINE = "Offline"; public const string STATE_OFFLINE = "Offline";
public const string STATE_RUNNING = "Running"; public const string STATE_RUNNING = "Running";
@ -44,4 +49,5 @@ public class Backbone
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { } protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
protected virtual void StopAllComponents() { } protected virtual void StopAllComponents() { }
protected void StopComponents(List<BackboneComponent> components) { } protected void StopComponents(List<BackboneComponent> components) { }
} }

View File

@ -4,6 +4,10 @@ namespace Adaptation.Eaf.Core.Smtp;
public class EmailMessage public class EmailMessage
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public EmailMessage() { } public EmailMessage() { }
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { } public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }

View File

@ -6,6 +6,11 @@ namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting;
public class ParameterValue public class ParameterValue
{ {
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public ParameterValue(EquipmentParameter definition, object value) { } public ParameterValue(EquipmentParameter definition, object value) { }
public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { } public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
@ -16,4 +21,5 @@ public class ParameterValue
public virtual ParameterValue Clone(EquipmentParameter newDefinition) => throw new NotImplementedException(); public virtual ParameterValue Clone(EquipmentParameter newDefinition) => throw new NotImplementedException();
public override string ToString() => base.ToString(); public override string ToString() => base.ToString();
} }

View File

@ -4,6 +4,10 @@ namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
public class EquipmentParameter public class EquipmentParameter
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { } public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { } public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
@ -19,4 +23,5 @@ public class EquipmentParameter
public override string ToString() => base.ToString(); public override string ToString() => base.ToString();
public string ToStringWithDetails() => base.ToString(); public string ToStringWithDetails() => base.ToString();
} }

View File

@ -2,10 +2,15 @@
public class Field public class Field
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { } public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
public string Name { get; } public string Name { get; }
public string Description { get; } public string Description { get; }
public ParameterTypeDefinition TypeDefinition { get; } public ParameterTypeDefinition TypeDefinition { get; }
public bool CanBeNull { get; } public bool CanBeNull { get; }
} }

View File

@ -2,10 +2,15 @@
public abstract class ParameterTypeDefinition public abstract class ParameterTypeDefinition
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public ParameterTypeDefinition(string name, string description) { } public ParameterTypeDefinition(string name, string description) { }
public string Name { get; } public string Name { get; }
public string Description { get; } public string Description { get; }
public override string ToString() => base.ToString(); public override string ToString() => base.ToString();
} }

View File

@ -5,7 +5,12 @@ namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public class StructuredType : ParameterTypeDefinition public class StructuredType : ParameterTypeDefinition
{ {
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { } public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
public IList<Field> Fields { get; } public IList<Field> Fields { get; }
} }

View File

@ -5,6 +5,10 @@ namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)] [System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
public class ModelObjectParameterDefinition : IConfigurationObject public class ModelObjectParameterDefinition : IConfigurationObject
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public ModelObjectParameterDefinition() { } public ModelObjectParameterDefinition() { }
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { } public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { } public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
@ -22,4 +26,5 @@ public class ModelObjectParameterDefinition : IConfigurationObject
public virtual ModelObjectParameterDefinition Clone() => null; public virtual ModelObjectParameterDefinition Clone() => null;
public virtual bool IsValidValue(string value) => false; public virtual bool IsValidValue(string value) => false;
} }

View File

@ -21,6 +21,8 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M;
public class FileRead : Shared.FileRead, IFileRead public class FileRead : Shared.FileRead, IFileRead
{ {
#pragma warning disable CA1847
private readonly Timer _Timer; private readonly Timer _Timer;
private int _LastDummyRunIndex; private int _LastDummyRunIndex;
private readonly string _IqsFile; private readonly string _IqsFile;
@ -164,7 +166,7 @@ public class FileRead : Shared.FileRead, IFileRead
void IFileRead.Callback(object state) => Callback(state); void IFileRead.Callback(object state) => Callback(state);
protected List<QS408M.Description> GetDescriptions(JsonElement[] jsonElements) protected static List<QS408M.Description> GetDescriptions(JsonElement[] jsonElements)
{ {
List<QS408M.Description> results = new(); List<QS408M.Description> results = new();
QS408M.Description description; QS408M.Description description;

View File

@ -217,7 +217,7 @@ public class Description : IDescription, Shared.Properties.IDescription
return results; return results;
} }
private Description GetDisplayNames() private static Description GetDisplayNames()
{ {
Description result = new(); Description result = new();
return result; return result;

View File

@ -186,7 +186,7 @@ public partial class ProcessData : IProcessData
return IsNullOrWhiteSpace((num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I))); return IsNullOrWhiteSpace((num > -1 ? _Data.Substring(_I, num - _I) : _Data.Substring(_I)));
} }
private bool IsNullOrWhiteSpace(string text) private static bool IsNullOrWhiteSpace(string text)
{ {
bool flag; bool flag;
int num = 0; int num = 0;

View File

@ -3,10 +3,15 @@
[System.Runtime.Serialization.DataContractAttribute] [System.Runtime.Serialization.DataContractAttribute]
public class ConnectionSetting public class ConnectionSetting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public ConnectionSetting(string name, string value) { } public ConnectionSetting(string name, string value) { }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public string Name { get; set; } public string Name { get; set; }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public string Value { get; set; } public string Value { get; set; }
} }

View File

@ -5,6 +5,10 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
public class File public class File
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
public File(string filePath) => throw new NotImplementedException(); public File(string filePath) => throw new NotImplementedException();
public File(string filePath, DateTime timeFileFound) => throw new NotImplementedException(); public File(string filePath, DateTime timeFileFound) => throw new NotImplementedException();
@ -15,4 +19,5 @@ public class File
public File UpdateContentParameters(Dictionary<string, string> contentParameters) => throw new NotImplementedException(); public File UpdateContentParameters(Dictionary<string, string> contentParameters) => throw new NotImplementedException();
public File UpdateParsingStatus(bool isErrorFile) => throw new NotImplementedException(); public File UpdateParsingStatus(bool isErrorFile) => throw new NotImplementedException();
} }

View File

@ -6,6 +6,11 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
public class FilePathGenerator public class FilePathGenerator
{ {
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public const char PLACEHOLDER_IDENTIFIER = '%'; public const char PLACEHOLDER_IDENTIFIER = '%';
public const char PLACEHOLDER_SEPARATOR = ':'; public const char PLACEHOLDER_SEPARATOR = ':';
public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
@ -31,4 +36,5 @@ public class FilePathGenerator
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException(); protected virtual string GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException();
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException(); protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException();
protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException(); protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException();
} }

View File

@ -6,8 +6,14 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription;
public class FileConnectorParameterTypeDefinitionProvider public class FileConnectorParameterTypeDefinitionProvider
{ {
#pragma warning disable CA1822
#pragma warning disable CA2254
#pragma warning disable IDE0060
public FileConnectorParameterTypeDefinitionProvider() { } public FileConnectorParameterTypeDefinitionProvider() { }
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null; public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null;
public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null; public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null;
} }

View File

@ -112,13 +112,13 @@ public class Description : IDescription, Properties.IDescription
return results; return results;
} }
private Description GetDisplayNames() private static Description GetDisplayNames()
{ {
Description result = new(); Description result = new();
return result; return result;
} }
private Description GetDefault(IFileRead fileRead, Logistics logistics) private static Description GetDefault(IFileRead fileRead, Logistics logistics)
{ {
Description result = new() Description result = new()
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Text.Json; using System.Text.Json;
@ -9,6 +10,8 @@ namespace Adaptation.Shared.Metrology;
public partial class WS public partial class WS
{ {
#pragma warning disable CA1847
public static Tuple<string, Results> SendData(string url, object payload, int timeoutSeconds = 120) public static Tuple<string, Results> SendData(string url, object payload, int timeoutSeconds = 120)
{ {
Results results = new(); Results results = new();
@ -16,7 +19,7 @@ public partial class WS
try try
{ {
string json = JsonSerializer.Serialize(payload, payload.GetType()); string json = JsonSerializer.Serialize(payload, payload.GetType());
if (string.IsNullOrEmpty(url) || !url.Contains(":") || !url.Contains(".")) if (string.IsNullOrEmpty(url) || !url.Contains(':') || !url.Contains('.'))
throw new Exception("Invalid URL"); throw new Exception("Invalid URL");
using (HttpClient httpClient = new()) using (HttpClient httpClient = new())
{ {

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass] [TestClass]
public class BIORAD2 : EAFLoggingUnitTesting public class BIORAD2 : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static BIORAD2 EAFLoggingUnitTesting { get; private set; } internal static BIORAD2 EAFLoggingUnitTesting { get; private set; }
public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass] [TestClass]
public class BIORAD3 : EAFLoggingUnitTesting public class BIORAD3 : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static BIORAD3 EAFLoggingUnitTesting { get; private set; } internal static BIORAD3 EAFLoggingUnitTesting { get; private set; }
public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass] [TestClass]
public class MET08THFTIRQS408M : EAFLoggingUnitTesting public class MET08THFTIRQS408M : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; } internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; }
public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass] [TestClass]
public class BIORAD2 : EAFLoggingUnitTesting public class BIORAD2 : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static BIORAD2 EAFLoggingUnitTesting { get; private set; } internal static BIORAD2 EAFLoggingUnitTesting { get; private set; }
public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass] [TestClass]
public class BIORAD3 : EAFLoggingUnitTesting public class BIORAD3 : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static BIORAD3 EAFLoggingUnitTesting { get; private set; } internal static BIORAD3 EAFLoggingUnitTesting { get; private set; }
public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -12,6 +12,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass] [TestClass]
public class MET08THFTIRQS408M : EAFLoggingUnitTesting public class MET08THFTIRQS408M : EAFLoggingUnitTesting
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; } internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; }
public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false) public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)

View File

@ -6,6 +6,9 @@ namespace _Tests.Extract.Staging.v2_36_3;
public class BIORAD2 public class BIORAD2
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_36_3.BIORAD2 _BIORAD2; private static CreateSelfDescription.Staging.v2_36_3.BIORAD2 _BIORAD2;
[ClassInitialize] [ClassInitialize]

View File

@ -14,6 +14,9 @@ namespace _Tests.Extract.Staging.v2_36_3;
public class BIORAD3 public class BIORAD3
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_36_3.BIORAD3 _BIORAD3; private static CreateSelfDescription.Staging.v2_36_3.BIORAD3 _BIORAD3;
[ClassInitialize] [ClassInitialize]

View File

@ -6,6 +6,9 @@ namespace _Tests.Extract.Staging.v2_36_3;
public class MET08THFTIRQS408M public class MET08THFTIRQS408M
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_36_3.MET08THFTIRQS408M _MET08THFTIRQS408M; private static CreateSelfDescription.Staging.v2_36_3.MET08THFTIRQS408M _MET08THFTIRQS408M;
[ClassInitialize] [ClassInitialize]

View File

@ -6,6 +6,9 @@ namespace _Tests.Extract.Staging.v2_39_0;
public class BIORAD2 public class BIORAD2
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_39_0.BIORAD2 _BIORAD2; private static CreateSelfDescription.Staging.v2_39_0.BIORAD2 _BIORAD2;
[ClassInitialize] [ClassInitialize]

View File

@ -14,6 +14,9 @@ namespace _Tests.Extract.Staging.v2_39_0;
public class BIORAD3 public class BIORAD3
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_39_0.BIORAD3 _BIORAD3; private static CreateSelfDescription.Staging.v2_39_0.BIORAD3 _BIORAD3;
[ClassInitialize] [ClassInitialize]

View File

@ -6,6 +6,9 @@ namespace _Tests.Extract.Staging.v2_39_0;
public class MET08THFTIRQS408M public class MET08THFTIRQS408M
{ {
#pragma warning disable CA2254
#pragma warning disable IDE0060
private static CreateSelfDescription.Staging.v2_39_0.MET08THFTIRQS408M _MET08THFTIRQS408M; private static CreateSelfDescription.Staging.v2_39_0.MET08THFTIRQS408M _MET08THFTIRQS408M;
[ClassInitialize] [ClassInitialize]

View File

@ -19,6 +19,10 @@ public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable
_AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary); _AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary);
} }
public new void Dispose() => base.Dispose(); public new void Dispose()
{
base.Dispose();
GC.SuppressFinalize(this);
}
} }

View File

@ -102,6 +102,10 @@ public class LoggingUnitTesting : UnitTesting, IDisposable
return result; return result;
} }
public void Dispose() => _LoggerFactory.Dispose(); public void Dispose()
{
_LoggerFactory.Dispose();
GC.SuppressFinalize(this);
}
} }

View File

@ -9,6 +9,8 @@
public partial class CellInstanceVersion public partial class CellInstanceVersion
{ {
#pragma warning disable IDE1006 // Naming Styles
private string createdByField; private string createdByField;
private System.DateTime creationDateField; private System.DateTime creationDateField;

View File

@ -11,6 +11,8 @@
public partial class EquipmentDictionaryVersion public partial class EquipmentDictionaryVersion
{ {
#pragma warning disable IDE1006 // Naming Styles
private EquipmentDictionaryVersionAlarms alarmsField; private EquipmentDictionaryVersionAlarms alarmsField;
private string createdByField; private string createdByField;

View File

@ -9,6 +9,8 @@
public partial class EquipmentTypeVersion public partial class EquipmentTypeVersion
{ {
#pragma warning disable IDE1006 // Naming Styles
private string createdByField; private string createdByField;
private System.DateTime creationDateField; private System.DateTime creationDateField;

View File

@ -80,7 +80,7 @@ public class UnitTesting
AppendLine(" \"name\": \".NET Core Attach\","). AppendLine(" \"name\": \".NET Core Attach\",").
AppendLine(" \"type\": \"coreclr\","). AppendLine(" \"type\": \"coreclr\",").
AppendLine(" \"request\": \"attach\","). AppendLine(" \"request\": \"attach\",").
AppendLine($" \"processId\": {Process.GetCurrentProcess().Id}"). AppendLine($" \"processId\": {Environment.ProcessId}").
AppendLine(" }"). AppendLine(" }").
AppendLine(" ]"). AppendLine(" ]").
AppendLine("}"); AppendLine("}");

View File

@ -5,14 +5,14 @@
"dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn", "dotnet-format": "dotnet format --report .vscode --verbosity detailed --severity warn",
"pull": "git pull", "pull": "git pull",
"garbage-collect": "git gc", "garbage-collect": "git gc",
"AA-CreateSelfDescription.Staging.v2_39_0-BIORAD3_EQPT-Staging__v2_39_0__BIORAD3_EQPT__DownloadRsMFile": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3_EQPT & Staging__v2_39_0__BIORAD3_EQPT__DownloadRsMFile\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AA-CreateSelfDescription.Staging.v2_39_0-BIORAD3_EQPT-Staging__v2_39_0__BIORAD3__QS408M": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3_EQPT & Staging__v2_39_0__BIORAD3__QS408M\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AT-CreateSelfDescription.Staging.v2_39_0-MET08THFTIRQS408M": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~MET08THFTIRQS408M\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AT-CreateSelfDescription.Staging.v2_39_0-MET08THFTIRQS408M": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~MET08THFTIRQS408M\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AV-CreateSelfDescription.Staging.v2_39_0-BIORAD2_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD2_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AV-CreateSelfDescription.Staging.v2_39_0-BIORAD2_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD2_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AW-CreateSelfDescription.Staging.v2_39_0-BIORAD2": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD2\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AW-CreateSelfDescription.Staging.v2_39_0-BIORAD2": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD2\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AX-CreateSelfDescription.Staging.v2_39_0-BIORAD3_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AX-CreateSelfDescription.Staging.v2_39_0-BIORAD3_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AY-CreateSelfDescription.Staging.v2_39_0-BIORAD3": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AY-CreateSelfDescription.Staging.v2_39_0-BIORAD3": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0 & ClassName~BIORAD3\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"AZ-CreateSelfDescription.Staging.v2_39_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "AZ-CreateSelfDescription.Staging.v2_39_0": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.CreateSelfDescription.Staging.v2_39_0\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BA-Extract.Staging.v2_39_0-BIORAD3-Staging__v2_39_0__BIORAD3__RsM643047560320000000__Normal": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD3 & Staging__v2_39_0__BIORAD3__RsM643047560320000000__Normal\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "BA-Extract.Staging.v2_39_0-BIORAD3-Staging__v2_39_0__BIORAD3__QS408M637406016892454000__ReactorAndRDS": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD3 & Staging__v2_39_0__BIORAD3__QS408M637406016892454000__ReactorAndRDS\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BT-Extract.Staging.v2_39_0-MET08THFTIRQS408M": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~MET08THFTIRQS408M\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "BT-Extract.Staging.v2_39_0-MET08THFTIRQS408M": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~MET08THFTIRQS408M\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BV-Extract.Staging.v2_39_0-BIORAD2_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD2_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "BV-Extract.Staging.v2_39_0-BIORAD2_EQPT": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD2_EQPT\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",
"BW-Extract.Staging.v2_39_0-BIORAD2": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD2\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")", "BW-Extract.Staging.v2_39_0-BIORAD2": "dotnet test --runtime win-x64 --no-build --filter \"FullyQualifiedName~_Tests.Extract.Staging.v2_39_0 & ClassName~BIORAD2\" --% -- TestRunParameters.Parameter(name=\\\"Debug\\\", value=\\\"Debugger.IsAttached\\\")",

View File

@ -24,332 +24,326 @@ using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using System.Threading; using System.Threading;
namespace MET08THFTIRQS408M.FileHandlers namespace MET08THFTIRQS408M.FileHandlers;
public partial class FileRead : FileReaderHandler, ISMTP
{ {
public partial class FileRead : FileReaderHandler, ISMTP private readonly ILog _Log;
private IFileRead _FileRead;
private EquipmentEvent _EquipmentEvent;
private readonly bool _UseCyclicalForDescription;
private FilePathGenerator _FilePathGeneratorForError;
private FilePathGenerator _FilePathGeneratorForTarget;
private readonly List<EquipmentParameter> _EquipmentParameters;
private static readonly Dictionary<string, List<long>> _DummyRuns;
static FileRead() => _DummyRuns = new Dictionary<string, List<long>>();
public FileRead()
{ {
if (FileParameter is null)
FileParameter = new Dictionary<string, string>();
_FileRead = null;
_UseCyclicalForDescription = false;
_Log = LogManager.GetLogger(typeof(FileRead));
_EquipmentParameters = new List<EquipmentParameter>();
}
private readonly ILog _Log; public override void CreateSelfDescription()
private IFileRead _FileRead; {
private EquipmentEvent _EquipmentEvent; MethodBase methodBase = new StackFrame().GetMethod();
private readonly bool _UseCyclicalForDescription; _Log.Debug(string.Concat(methodBase.Name, " - Entry"));
private FilePathGenerator _FilePathGeneratorForError; try
private FilePathGenerator _FilePathGeneratorForTarget;
private readonly List<EquipmentParameter> _EquipmentParameters;
private static readonly Dictionary<string, List<long>> _DummyRuns;
static FileRead()
{ {
_DummyRuns = new Dictionary<string, List<long>>(); if (Equipment is null)
}
public FileRead()
{
if (FileParameter is null)
FileParameter = new Dictionary<string, string>();
_FileRead = null;
_UseCyclicalForDescription = false;
_Log = LogManager.GetLogger(typeof(FileRead));
_EquipmentParameters = new List<EquipmentParameter>();
}
public override void CreateSelfDescription()
{
MethodBase methodBase = new StackFrame().GetMethod();
_Log.Debug(string.Concat(methodBase.Name, " - Entry"));
try
{
if (Equipment is null)
throw new Exception();
CreateSelfDescription(methodBase);
_Log.Debug(string.Concat(methodBase.Name, " - Try - Exit"));
}
catch (Exception ex)
{
_Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace));
long breakAfter = DateTime.Now.AddSeconds(30).Ticks;
for (short i = 0; i < short.MaxValue; i++)
{
if (DateTime.Now.Ticks > breakAfter)
break;
Thread.Sleep(500);
}
throw;
}
}
public override bool Extract(string reportFullPath, string eventName)
{
MethodBase methodBase = new StackFrame().GetMethod();
_Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}"));
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults = null;
try
{
extractResults = _FileRead.GetExtractResult(reportFullPath, eventName);
TriggerEvents(extractResults);
_FileRead.Move(extractResults);
FilePathGeneratorInfoMove(extractResults);
_FileRead.WaitForThread();
_Log.Debug(string.Concat(methodBase.Name, " - Try - Exit"));
return true;
}
catch (Exception ex)
{
_Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace));
_FileRead.Move(extractResults, exception: ex);
FilePathGeneratorInfoMove(extractResults, exception: ex);
return false;
}
}
private void Send(EmailMessage emailMessage)
{
ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType<ISmtp>().SingleOrDefault();
if (!(smtp is null))
smtp.Send(emailMessage);
}
void ISMTP.SendLowPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.Low);
Send(emailMessage);
}
void ISMTP.SendHighPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.High);
Send(emailMessage);
}
void ISMTP.SendNormalPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.Normal);
Send(emailMessage);
}
private void AddParameterRangeAndEvent()
{
string description;
bool allowNull = false;
EquipmentParameter equipmentParameter;
JsonProperty[] jsonProperties = _FileRead.GetDefault();
Dictionary<string, string> keyValuePairs = _FileRead.GetDisplayNamesJsonElement();
Dictionary<JsonValueKind, ParameterTypeDefinition> parameterTypeDefinitions = new();
FileConnectorParameterTypeDefinitionProvider fileConnectorParameterTypeDefinitionProvider = new();
foreach (ParameterTypeDefinition parameterTypeDefinition in fileConnectorParameterTypeDefinitionProvider.GetAllParameterTypeDefinition())
{
switch (parameterTypeDefinition.Name)
{
case nameof(String):
parameterTypeDefinitions.Add(JsonValueKind.String, parameterTypeDefinition);
break;
case nameof(Double):
parameterTypeDefinitions.Add(JsonValueKind.Number, parameterTypeDefinition);
break;
case nameof(Boolean):
parameterTypeDefinitions.Add(JsonValueKind.True, parameterTypeDefinition);
parameterTypeDefinitions.Add(JsonValueKind.False, parameterTypeDefinition);
break;
default:
break;
}
}
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object && !parameterTypeDefinitions.ContainsKey(JsonValueKind.Object))
{
StructuredType structuredType = new(nameof(StructuredType), string.Empty, new List<Field>());
parameterTypeDefinitions.Add(JsonValueKind.Object, structuredType);
Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType);
}
if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind))
throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!"));
}
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
equipmentParameter = new EquipmentParameter(jsonProperty.Name, parameterTypeDefinitions[jsonProperty.Value.ValueKind], description);
_EquipmentParameters.Add(equipmentParameter);
}
Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_EquipmentParameters);
_EquipmentEvent = new EquipmentEvent(_FileRead.EventName, _FileRead.GetEventDescription(), _EquipmentParameters);
Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent);
}
private void CreateSelfDescription(MethodBase methodBase)
{
string cellInstanceName;
string equipmentTypeName = string.Empty;
string equipmentDictionaryName = string.Empty;
EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item;
if (Backbone.Instance?.CellName is null)
cellInstanceName = string.Empty;
else
cellInstanceName = Backbone.Instance.CellName;
string cellInstanceConnectionName = equipmentElement.Name;
FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration);
string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName;
IList<ModelObjectParameterDefinition> modelObjectParameters = Mapper.Map(ConfiguredParameters);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: true);
if (_FileRead.IsEvent)
AddParameterRangeAndEvent();
}
private object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile)
{
FilePathGeneratorInfo result;
FilePathGenerator filePathGeneratorOriginal;
if (Configuration is null)
result = null;
else
{
if (isErrorFile)
{
if (_FilePathGeneratorForError is null)
_FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true);
filePathGeneratorOriginal = _FilePathGeneratorForError;
}
else
{
if (_FilePathGeneratorForTarget is null)
_FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false);
filePathGeneratorOriginal = _FilePathGeneratorForTarget;
}
result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter);
}
return result;
}
private void FilePathGeneratorInfoMove(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null)
{
bool isErrorFile = !(exception is null);
object filePathGeneratorInfo = GetFilePathGeneratorInfo(_FileRead.ReportFullPath, isErrorFile);
if (!(filePathGeneratorInfo is null) && filePathGeneratorInfo is FilePathGeneratorInfo filePathGenerator)
{
string[] exceptionLines = _FileRead.Move(extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception);
if (isErrorFile)
{
try
{
StringBuilder stringBuilder = new();
foreach (string item in exceptionLines)
stringBuilder.Append("<").Append(item).AppendLine(">");
ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType<ISmtp>().SingleOrDefault();
EmailMessage emailMessage = new(_FileRead.ExceptionSubject, stringBuilder.ToString(), MailPriority.High);
smtp.Send(emailMessage);
}
catch (Exception) { }
}
}
}
private List<ParameterValue> GetParameterValues(List<string> headerNames, JsonElement[] jsonElements, int i)
{
List<ParameterValue> results = new();
if (_UseCyclicalForDescription && i > 0)
throw new Exception(); throw new Exception();
object value; CreateSelfDescription(methodBase);
List<object[]> list; _Log.Debug(string.Concat(methodBase.Name, " - Try - Exit"));
JsonProperty[] jsonProperties = jsonElements[i].EnumerateObject().ToArray();
if (jsonProperties.Length != _EquipmentParameters.Count)
throw new Exception();
for (int p = 0; p < jsonProperties.Length; p++)
{
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperties[p].Name))
value = jsonProperties[p].Value.ToString();
else
{
list = new List<object[]>();
for (int z = 0; z < jsonElements.Length; z++)
list.Add(new object[] { z, jsonElements[z].GetProperty(jsonProperties[p].Name).ToString() });
value = list;
}
results.Add(new ParameterValue(_EquipmentParameters[p], value, DateTime.Now));
}
return results;
} }
catch (Exception ex)
private void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults)
{ {
List<string> headerNames; _Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace));
List<ParameterValue> parameters; long breakAfter = DateTime.Now.AddSeconds(30).Ticks;
if (!_UseCyclicalForDescription) for (short i = 0; i < short.MaxValue; i++)
headerNames = null;
else
headerNames = _FileRead.GetHeaderNames();
for (int i = 0; i < extractResults.Item3.Length; i++)
{ {
if (DateTime.Now.Ticks > breakAfter)
break;
Thread.Sleep(500);
}
throw;
}
}
public override bool Extract(string reportFullPath, string eventName)
{
MethodBase methodBase = new StackFrame().GetMethod();
_Log.Debug(string.Concat(methodBase.Name, " - Entry - {", reportFullPath, "}"));
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults = null;
try
{
extractResults = _FileRead.GetExtractResult(reportFullPath, eventName);
TriggerEvents(extractResults);
_FileRead.Move(extractResults);
FilePathGeneratorInfoMove(extractResults);
_FileRead.WaitForThread();
_Log.Debug(string.Concat(methodBase.Name, " - Try - Exit"));
return true;
}
catch (Exception ex)
{
_Log.Error(string.Concat(methodBase.Name, " - Catch - Entry {", ex.Message, "}", Environment.NewLine, Environment.NewLine, ex.StackTrace));
_FileRead.Move(extractResults, exception: ex);
FilePathGeneratorInfoMove(extractResults, exception: ex);
return false;
}
}
private void Send(EmailMessage emailMessage)
{
ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType<ISmtp>().SingleOrDefault();
if (smtp is not null)
smtp.Send(emailMessage);
}
void ISMTP.SendLowPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.Low);
Send(emailMessage);
}
void ISMTP.SendHighPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.High);
Send(emailMessage);
}
void ISMTP.SendNormalPriorityEmailMessage(string subject, string body)
{
EmailMessage emailMessage = new(subject, body, MailPriority.Normal);
Send(emailMessage);
}
private void AddParameterRangeAndEvent()
{
string description;
bool allowNull = false;
EquipmentParameter equipmentParameter;
JsonProperty[] jsonProperties = _FileRead.GetDefault();
Dictionary<string, string> keyValuePairs = _FileRead.GetDisplayNamesJsonElement();
Dictionary<JsonValueKind, ParameterTypeDefinition> parameterTypeDefinitions = new();
FileConnectorParameterTypeDefinitionProvider fileConnectorParameterTypeDefinitionProvider = new();
foreach (ParameterTypeDefinition parameterTypeDefinition in fileConnectorParameterTypeDefinitionProvider.GetAllParameterTypeDefinition())
{
switch (parameterTypeDefinition.Name)
{
case nameof(String):
parameterTypeDefinitions.Add(JsonValueKind.String, parameterTypeDefinition);
break;
case nameof(Double):
parameterTypeDefinitions.Add(JsonValueKind.Number, parameterTypeDefinition);
break;
case nameof(Boolean):
parameterTypeDefinitions.Add(JsonValueKind.True, parameterTypeDefinition);
parameterTypeDefinitions.Add(JsonValueKind.False, parameterTypeDefinition);
break;
default:
break;
}
}
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object && !parameterTypeDefinitions.ContainsKey(JsonValueKind.Object))
{
StructuredType structuredType = new(nameof(StructuredType), string.Empty, new List<Field>());
parameterTypeDefinitions.Add(JsonValueKind.Object, structuredType);
Equipment.SelfDescriptionBuilder.AddParameterTypeDefinition(structuredType);
}
if (!parameterTypeDefinitions.ContainsKey(jsonProperty.Value.ValueKind))
throw new Exception(string.Concat('{', jsonProperty.Value.ValueKind, "} is not mapped!"));
}
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (jsonProperty.Value.ValueKind != JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
equipmentParameter = new EquipmentParameter(jsonProperty.Name, parameterTypeDefinitions[jsonProperty.Value.ValueKind], description);
_EquipmentParameters.Add(equipmentParameter);
}
_ = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddParameterRange(_EquipmentParameters);
_EquipmentEvent = new EquipmentEvent(_FileRead.EventName, _FileRead.GetEventDescription(), _EquipmentParameters);
_ = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.AddEvent(_EquipmentEvent);
}
private void CreateSelfDescription(MethodBase methodBase)
{
string cellInstanceName;
string equipmentTypeName = string.Empty;
string equipmentDictionaryName = string.Empty;
EquipmentElement equipmentElement = Equipment.SelfDescriptionBuilder.RootEquipmentElementBuilder.Item;
if (Backbone.Instance?.CellName is null)
cellInstanceName = string.Empty;
else
cellInstanceName = Backbone.Instance.CellName;
string cellInstanceConnectionName = equipmentElement.Name;
FileConnectorConfiguration fileConnectorConfiguration = Mapper.Map(Configuration);
string parameterizedModelObjectDefinitionType = methodBase.DeclaringType.FullName;
IList<ModelObjectParameterDefinition> modelObjectParameters = Mapper.Map(ConfiguredParameters);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: true);
if (_FileRead.IsEvent)
AddParameterRangeAndEvent();
}
private object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile)
{
FilePathGeneratorInfo result;
FilePathGenerator filePathGeneratorOriginal;
if (Configuration is null)
result = null;
else
{
if (isErrorFile)
{
if (_FilePathGeneratorForError is null)
_FilePathGeneratorForError = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: true);
filePathGeneratorOriginal = _FilePathGeneratorForError;
}
else
{
if (_FilePathGeneratorForTarget is null)
_FilePathGeneratorForTarget = new FilePathGenerator(Configuration, reportFullPath, isErrorFile: false);
filePathGeneratorOriginal = _FilePathGeneratorForTarget;
}
result = new FilePathGeneratorInfo(filePathGeneratorOriginal, reportFullPath, isErrorFile, FileParameter);
}
return result;
}
private void FilePathGeneratorInfoMove(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null)
{
bool isErrorFile = exception is not null;
object filePathGeneratorInfo = GetFilePathGeneratorInfo(_FileRead.ReportFullPath, isErrorFile);
if (filePathGeneratorInfo is not null and FilePathGeneratorInfo filePathGenerator)
{
string[] exceptionLines = _FileRead.Move(extractResults, filePathGenerator.To, filePathGenerator.From, filePathGenerator.ResolvedFileLocation, exception);
if (isErrorFile)
{
try
{
StringBuilder stringBuilder = new();
foreach (string item in exceptionLines)
_ = stringBuilder.Append("<").Append(item).AppendLine(">");
ISmtp smtp = Backbone.Instance.GetBackboneComponentsOfType<ISmtp>().SingleOrDefault();
EmailMessage emailMessage = new(_FileRead.ExceptionSubject, stringBuilder.ToString(), MailPriority.High);
smtp.Send(emailMessage);
}
catch (Exception) { }
}
}
}
private List<ParameterValue> GetParameterValues(List<string> headerNames, JsonElement[] jsonElements, int i)
{
List<ParameterValue> results = new();
if (_UseCyclicalForDescription && i > 0)
throw new Exception();
object value;
List<object[]> list;
JsonProperty[] jsonProperties = jsonElements[i].EnumerateObject().ToArray();
if (jsonProperties.Length != _EquipmentParameters.Count)
throw new Exception();
for (int p = 0; p < jsonProperties.Length; p++)
{
if (!_UseCyclicalForDescription || headerNames.Contains(jsonProperties[p].Name))
value = jsonProperties[p].Value.ToString();
else
{
list = new List<object[]>();
for (int z = 0; z < jsonElements.Length; z++)
list.Add(new object[] { z, jsonElements[z].GetProperty(jsonProperties[p].Name).ToString() });
value = list;
}
results.Add(new ParameterValue(_EquipmentParameters[p], value, DateTime.Now));
}
return results;
}
private void TriggerEvents(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults)
{
List<string> headerNames;
List<ParameterValue> parameters;
if (!_UseCyclicalForDescription)
headerNames = null;
else
headerNames = _FileRead.GetHeaderNames();
for (int i = 0; i < extractResults.Item3.Length; i++)
{
if (_EquipmentEvent is not null)
{
_Log.Debug(string.Concat("TriggerEvent - {", _FileRead.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length));
parameters = GetParameterValues(headerNames, extractResults.Item3, i);
if (_EquipmentEvent is not null) if (_EquipmentEvent is not null)
{ Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters);
_Log.Debug(string.Concat("TriggerEvent - {", _FileRead.ReportFullPath, "} ", i, " of ", extractResults.Item3.Length)); if (_UseCyclicalForDescription)
parameters = GetParameterValues(headerNames, extractResults.Item3, i); break;
if (!(_EquipmentEvent is null))
Equipment.DataCollection.TriggerEvent(_EquipmentEvent, parameters);
if (_UseCyclicalForDescription)
break;
}
} }
} }
}
public Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(string json) public Tuple<string, Test[], JsonElement[], List<FileInfo>> ReExtract(string json)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
string cellInstanceName;
if (!json.Contains(nameof(cellInstanceName)))
throw new Exception();
string equipmentTypeName;
if (!json.Contains(nameof(equipmentTypeName)))
throw new Exception();
string equipmentDictionaryName;
if (!json.Contains(nameof(equipmentDictionaryName)))
throw new Exception();
string cellInstanceConnectionName;
if (!json.Contains(nameof(cellInstanceConnectionName)))
throw new Exception();
if (!json.Contains(nameof(FileConnectorConfiguration)))
throw new Exception();
if (!json.Contains(nameof(IList<ModelObjectParameterDefinition>)))
throw new Exception();
string parameterizedModelObjectDefinitionType;
if (!json.Contains(nameof(parameterizedModelObjectDefinitionType)))
throw new Exception();
Dictionary<string, List<long>> dummyRuns = new();
Dictionary<string, string> fileParameter = new();
MethodBase methodBase = new StackFrame().GetMethod();
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString();
equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString();
equipmentDictionaryName = jsonElement.GetProperty(nameof(equipmentDictionaryName)).ToString();
cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString();
JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration));
parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString();
if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
JsonSerializerOptions jsonSerializerOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize<FileConnectorConfiguration>(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions);
JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList<ModelObjectParameterDefinition>));
if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
IList<ModelObjectParameterDefinition> modelObjectParameters = JsonSerializer.Deserialize<IList<ModelObjectParameterDefinition>>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: false);
results = _FileRead.ReExtract();
if (results?.Item2 is null)
throw new Exception();
else
{ {
Tuple<string, Test[], JsonElement[], List<FileInfo>> results; TriggerEvents(results);
string cellInstanceName; _FileRead.Move(results);
if (!json.Contains(nameof(cellInstanceName))) FilePathGeneratorInfoMove(results);
throw new Exception();
string equipmentTypeName;
if (!json.Contains(nameof(equipmentTypeName)))
throw new Exception();
string equipmentDictionaryName;
if (!json.Contains(nameof(equipmentDictionaryName)))
throw new Exception();
string cellInstanceConnectionName;
if (!json.Contains(nameof(cellInstanceConnectionName)))
throw new Exception();
if (!json.Contains(nameof(FileConnectorConfiguration)))
throw new Exception();
if (!json.Contains(nameof(IList<ModelObjectParameterDefinition>)))
throw new Exception();
string parameterizedModelObjectDefinitionType;
if (!json.Contains(nameof(parameterizedModelObjectDefinitionType)))
throw new Exception();
Dictionary<string, List<long>> dummyRuns = new();
Dictionary<string, string> fileParameter = new();
MethodBase methodBase = new StackFrame().GetMethod();
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
cellInstanceName = jsonElement.GetProperty(nameof(cellInstanceName)).ToString();
equipmentTypeName = jsonElement.GetProperty(nameof(equipmentTypeName)).ToString();
equipmentDictionaryName = jsonElement.GetProperty(nameof(equipmentDictionaryName)).ToString();
cellInstanceConnectionName = jsonElement.GetProperty(nameof(cellInstanceConnectionName)).ToString();
JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration));
parameterizedModelObjectDefinitionType = jsonElement.GetProperty(nameof(parameterizedModelObjectDefinitionType)).ToString();
if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
JsonSerializerOptions jsonSerializerOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize<FileConnectorConfiguration>(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions);
JsonElement modelObjectParameterDefinitionJsonElement = jsonElement.GetProperty(nameof(IList<ModelObjectParameterDefinition>));
if (modelObjectParameterDefinitionJsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
IList<ModelObjectParameterDefinition> modelObjectParameters = JsonSerializer.Deserialize<IList<ModelObjectParameterDefinition>>(modelObjectParameterDefinitionJsonElement.ToString(), jsonSerializerOptions);
_FileRead = CellInstanceConnectionName.Get(this, FileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, _DummyRuns, _UseCyclicalForDescription, isEAFHosted: false);
results = _FileRead.ReExtract();
if (results?.Item2 is null)
throw new Exception();
else
{
TriggerEvents(results);
_FileRead.Move(results);
FilePathGeneratorInfoMove(results);
}
return results;
} }
return results;
} }
} }

View File

@ -2,34 +2,19 @@ using System.Collections.Generic;
using Ifx.Eaf.EquipmentConnector.File.Component; using Ifx.Eaf.EquipmentConnector.File.Component;
using Ifx.Eaf.EquipmentConnector.File.Configuration; using Ifx.Eaf.EquipmentConnector.File.Configuration;
namespace Shared namespace Shared;
public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator
{ {
public class FilePathGenerator : Ifx.Eaf.EquipmentConnector.File.Component.FilePathGenerator public FileConnectorConfiguration FileConnectorConfiguration { get; private set; }
{
public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) : base(config, customPattern) => FileConnectorConfiguration = config;
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) : base(config, customPattern) public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) : base(config, file, isErrorFile, customPattern) => FileConnectorConfiguration = config;
{
FileConnectorConfiguration = config;
}
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) : base(config, file, isErrorFile, customPattern) public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) => FileConnectorConfiguration = config;
{
FileConnectorConfiguration = config;
}
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) : base(config, sourceFilePath, isErrorFile, customPattern) public string GetSubFolderPath() => SubFolderPath;
{
FileConnectorConfiguration = config;
}
public string GetSubFolderPath()
{
return SubFolderPath;
}
}
} }

View File

@ -1,66 +1,63 @@
using System.IO; using System.IO;
namespace Shared namespace Shared;
public class FilePathGeneratorInfo
{ {
public class FilePathGeneratorInfo public string To { get; protected set; }
public string From { get; protected set; }
public bool IsErrorFile { get; protected set; }
public string SubFolderPath { get; protected set; }
public string FirstDirectory { get; protected set; }
public string ReportFullPath { get; protected set; }
public string ResolvedFileLocation { get; protected set; }
public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary<string, string> fileParameter)
{ {
ReportFullPath = reportFullPath;
public string To { get; protected set; } IsErrorFile = isErrorFile;
public string From { get; protected set; } if (originalFilePathGenerator is null || originalFilePathGenerator is not FilePathGenerator original)
public bool IsErrorFile { get; protected set; }
public string SubFolderPath { get; protected set; }
public string FirstDirectory { get; protected set; }
public string ReportFullPath { get; protected set; }
public string ResolvedFileLocation { get; protected set; }
public FilePathGeneratorInfo(object originalFilePathGenerator, string reportFullPath, bool isErrorFile, System.Collections.Generic.Dictionary<string, string> fileParameter)
{ {
ReportFullPath = reportFullPath; FirstDirectory = string.Empty;
IsErrorFile = isErrorFile; ResolvedFileLocation = string.Empty;
if (originalFilePathGenerator is null || originalFilePathGenerator is not FilePathGenerator original) To = string.Empty;
{ From = string.Empty;
FirstDirectory = string.Empty; }
ResolvedFileLocation = string.Empty; else
To = string.Empty; {
From = string.Empty; string directorySeparatorChar = Path.DirectorySeparatorChar.ToString();
} FilePathGenerator filePathGenerator = new(original.FileConnectorConfiguration, reportFullPath, isErrorFile);
else SubFolderPath = filePathGenerator.GetSubFolderPath();
{ if (string.IsNullOrEmpty(SubFolderPath))
string directorySeparatorChar = Path.DirectorySeparatorChar.ToString(); FirstDirectory = SubFolderPath;
FilePathGenerator filePathGenerator = new(original.FileConnectorConfiguration, reportFullPath, isErrorFile); else
SubFolderPath = filePathGenerator.GetSubFolderPath(); FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0];
if (string.IsNullOrEmpty(SubFolderPath)) ResolvedFileLocation = filePathGenerator.GetTargetFolder();
FirstDirectory = SubFolderPath; if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath))
else To = string.Empty;
FirstDirectory = SubFolderPath.Split(Path.DirectorySeparatorChar)[0]; else if (string.IsNullOrEmpty(SubFolderPath))
ResolvedFileLocation = filePathGenerator.GetTargetFolder(); To = ResolvedFileLocation;
if (string.IsNullOrEmpty(ResolvedFileLocation) && string.IsNullOrEmpty(SubFolderPath)) else
To = string.Empty; To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory);
else if (string.IsNullOrEmpty(SubFolderPath)) #if (true)
To = ResolvedFileLocation; if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue))
else original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA";
To = string.Concat(ResolvedFileLocation.Replace(SubFolderPath, string.Empty), Path.DirectorySeparatorChar, FirstDirectory); if (fileParameter is not null && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue))
#if (true) {
if (string.IsNullOrEmpty(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) foreach (System.Collections.Generic.KeyValuePair<string, string> keyValuePair in fileParameter)
original.FileConnectorConfiguration.DefaultPlaceHolderValue = "NA"; To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value);
if (!(fileParameter is null) && fileParameter.Count == 1 && To.Contains(original.FileConnectorConfiguration.DefaultPlaceHolderValue)) }
{ #endif
foreach (System.Collections.Generic.KeyValuePair<string, string> keyValuePair in fileParameter) if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar))
To = To.Replace(string.Concat(original.FileConnectorConfiguration.DefaultPlaceHolderValue), keyValuePair.Value); From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory);
} else
#endif From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory);
if (original.FileConnectorConfiguration.SourceFileLocation.EndsWith(directorySeparatorChar)) if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar))
From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, FirstDirectory); To = string.Concat(To, Path.DirectorySeparatorChar);
else else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar))
From = string.Concat(original.FileConnectorConfiguration.SourceFileLocation, Path.DirectorySeparatorChar, FirstDirectory); To = To.Remove(To.Length - 1, 1);
if (From.EndsWith(directorySeparatorChar) && !To.EndsWith(directorySeparatorChar))
To = string.Concat(To, Path.DirectorySeparatorChar);
else if (To.EndsWith(directorySeparatorChar) && !From.EndsWith(directorySeparatorChar))
To = To.Remove(To.Length - 1, 1);
}
} }
} }
} }

View File

@ -2,76 +2,73 @@ using System.Collections.Generic;
using Eaf.Management.ConfigurationData.CellAutomation; using Eaf.Management.ConfigurationData.CellAutomation;
using Ifx.Eaf.EquipmentConnector.File.Configuration; using Ifx.Eaf.EquipmentConnector.File.Configuration;
namespace Shared namespace Shared;
public static class Mapper
{ {
public static class Mapper internal static Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration Map(FileConnectorConfiguration configuration)
{ {
Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration result = new()
internal static Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration Map(FileConnectorConfiguration configuration)
{ {
Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration result = new() AlternateTargetFolder = configuration.AlternateTargetFolder,
{ ConnectionRetryInterval = configuration.ConnectionRetryInterval,
AlternateTargetFolder = configuration.AlternateTargetFolder, ConnectionSettings = new List<Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting>(),
ConnectionRetryInterval = configuration.ConnectionRetryInterval, CopySourceFolderStructure = configuration.CopySourceFolderStructure,
ConnectionSettings = new List<Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting>(), DefaultPlaceHolderValue = configuration.DefaultPlaceHolderValue,
CopySourceFolderStructure = configuration.CopySourceFolderStructure, //DeleteAbandonedEmptySourceSubFolders = configuration.DeleteAbandonedEmptySourceSubFolders,
DefaultPlaceHolderValue = configuration.DefaultPlaceHolderValue, DeleteEmptySourceSubFolders = configuration.DeleteEmptySourceSubFolders,
//DeleteAbandonedEmptySourceSubFolders = configuration.DeleteAbandonedEmptySourceSubFolders, ErrorPostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.ErrorPostProcessingMode,
DeleteEmptySourceSubFolders = configuration.DeleteEmptySourceSubFolders, ErrorTargetFileLocation = configuration.ErrorTargetFileLocation,
ErrorPostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.ErrorPostProcessingMode, ErrorTargetFileName = configuration.ErrorTargetFileName,
ErrorTargetFileLocation = configuration.ErrorTargetFileLocation, FileAgeFilterMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileAgeFilterEnum)configuration.FileAgeFilterMode,
ErrorTargetFileName = configuration.ErrorTargetFileName, FileAgeThreshold = configuration.FileAgeThreshold,
FileAgeFilterMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileAgeFilterEnum)configuration.FileAgeFilterMode, //FileHandlers = configuration.FileHandlers,
FileAgeThreshold = configuration.FileAgeThreshold, FileHandleTimeout = (long)configuration.FileHandleTimeout,
//FileHandlers = configuration.FileHandlers, FileHandleWaitTime = configuration.FileHandleWaitTime,
FileHandleTimeout = (long)configuration.FileHandleTimeout, FileScanningIntervalInSeconds = configuration.FileScanningIntervalInSeconds,
FileHandleWaitTime = configuration.FileHandleWaitTime, FileScanningOption = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileScanningOptionEnum)configuration.FileScanningOption,
FileScanningIntervalInSeconds = configuration.FileScanningIntervalInSeconds, FolderAgeCheckIndividualSubFolders = configuration.FolderAgeCheckIndividualSubFolders,
FileScanningOption = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.FileScanningOptionEnum)configuration.FileScanningOption, FolderAgeThreshold = configuration.FolderAgeThreshold,
FolderAgeCheckIndividualSubFolders = configuration.FolderAgeCheckIndividualSubFolders, //FolderOperationsSubFolderLevel = configuration.FolderOperationsSubFolderLevel,
FolderAgeThreshold = configuration.FolderAgeThreshold, IdleEventWaitTimeInSeconds = (long)configuration.IdleEventWaitTimeInSeconds,
//FolderOperationsSubFolderLevel = configuration.FolderOperationsSubFolderLevel, IfFileExistAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfFileExistEnum)configuration.IfFileExistAction,
IdleEventWaitTimeInSeconds = (long)configuration.IdleEventWaitTimeInSeconds, IfPostProcessingFailsAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfPostProcessingFailsEnum)configuration.IfPostProcessingFailsAction,
IfFileExistAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfFileExistEnum)configuration.IfFileExistAction, IncludeSubDirectories = configuration.IncludeSubDirectories,
IfPostProcessingFailsAction = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.IfPostProcessingFailsEnum)configuration.IfPostProcessingFailsAction, PostProcessingRetries = configuration.PostProcessingRetries,
IncludeSubDirectories = configuration.IncludeSubDirectories, PreProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PreProcessingModeEnum)configuration.PreProcessingMode,
PostProcessingRetries = configuration.PostProcessingRetries, PostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.PostProcessingMode,
PreProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PreProcessingModeEnum)configuration.PreProcessingMode, SourceDirectoryCloaking = configuration.SourceDirectoryCloaking,
PostProcessingMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.PostProcessingModeEnum)configuration.PostProcessingMode, SourceFileFilter = configuration.SourceFileFilter,
SourceDirectoryCloaking = configuration.SourceDirectoryCloaking, SourceFileFilters = configuration.SourceFileFilters,
SourceFileFilter = configuration.SourceFileFilter, SourceFileLocation = configuration.SourceFileLocation,
SourceFileFilters = configuration.SourceFileFilters, TargetFileLocation = configuration.TargetFileLocation,
SourceFileLocation = configuration.SourceFileLocation, TargetFileName = configuration.TargetFileName,
TargetFileLocation = configuration.TargetFileLocation, TriggerOnChanged = configuration.TriggerOnChanged,
TargetFileName = configuration.TargetFileName, TriggerOnCreated = configuration.TriggerOnCreated,
TriggerOnChanged = configuration.TriggerOnChanged, UseZip64Mode = configuration.UseZip64Mode,
TriggerOnCreated = configuration.TriggerOnCreated, ZipErrorTargetFileName = configuration.ZipErrorTargetFileName,
UseZip64Mode = configuration.UseZip64Mode, ZipFileAmount = configuration.ZipFileAmount,
ZipErrorTargetFileName = configuration.ZipErrorTargetFileName, ZipFileSubFolderLevel = configuration.ZipFileSubFolderLevel,
ZipFileAmount = configuration.ZipFileAmount, ZipFileTime = configuration.ZipFileTime,
ZipFileSubFolderLevel = configuration.ZipFileSubFolderLevel, ZipMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.ZipModeEnum)configuration.ZipMode,
ZipFileTime = configuration.ZipFileTime, ZipTargetFileName = configuration.ZipTargetFileName,
ZipMode = (Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration.FileConnectorConfiguration.ZipModeEnum)configuration.ZipMode, };
ZipTargetFileName = configuration.ZipTargetFileName, foreach (Ifx.Eaf.Common.Configuration.ConnectionSetting connectionSetting in configuration.ConnectionSettings)
}; result.ConnectionSettings.Add(new Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting(connectionSetting.Name, connectionSetting.Value));
foreach (Ifx.Eaf.Common.Configuration.ConnectionSetting connectionSetting in configuration.ConnectionSettings) return result;
result.ConnectionSettings.Add(new Adaptation.Ifx.Eaf.Common.Configuration.ConnectionSetting(connectionSetting.Name, connectionSetting.Value)); }
return result;
}
internal static IList<Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition> Map(IList<ModelObjectParameterDefinition> configuredParameters) internal static IList<Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition> Map(IList<ModelObjectParameterDefinition> configuredParameters)
{
List<Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition> results = new();
Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType modelObjectParameterType;
for (int i = 0; i < configuredParameters.Count; i++)
{ {
List<Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition> results = new(); modelObjectParameterType = (Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType)configuredParameters[i].ValueType;
Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType modelObjectParameterType; results.Add(new Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition() { Id = i, Name = configuredParameters[i].Name, Value = configuredParameters[i].Value, ValueType = modelObjectParameterType, EnumType = modelObjectParameterType.ToString() });
for (int i = 0; i < configuredParameters.Count; i++)
{
modelObjectParameterType = (Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterType)configuredParameters[i].ValueType;
results.Add(new Adaptation.Eaf.Management.ConfigurationData.CellAutomation.ModelObjectParameterDefinition() { Id = i, Name = configuredParameters[i].Name, Value = configuredParameters[i].Value, ValueType = modelObjectParameterType, EnumType = modelObjectParameterType.ToString() });
}
return results;
} }
return results;
} }
} }