Ready to test v2.39.0

This commit is contained in:
Mike Phares 2022-02-14 18:41:51 -07:00
parent 199eb8567a
commit b97d7ebdb3
106 changed files with 11567 additions and 13653 deletions

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

@ -0,0 +1,13 @@
{
"cSpell.words": [
"BIORAD",
"CICN",
"EQPT",
"Hmmssffff",
"ipdsf",
"ISMTP",
"messa",
"PDSF",
"THFTIRQS"
]
}

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
using System;
using System.Collections.Generic;
namespace Adaptation.Eaf.Core
{
namespace Adaptation.Eaf.Core;
public class Backbone
{
public const string STATE_ERROR = "Error";
@ -30,12 +30,12 @@ namespace Adaptation.Eaf.Core
protected Dictionary<string, BackboneComponent> BackboneComponents { get; }
public void AddBackboneComponent(BackboneComponent backboneComponent) { }
public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); }
public bool ContainsBackboneComponent(string id) => throw new NotImplementedException();
[Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")]
public List<StatusItem> GetAllStatuses() { throw new NotImplementedException(); }
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); }
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); }
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); }
public List<StatusItem> GetAllStatuses() => throw new NotImplementedException();
public BackboneComponent GetBackboneComponentById(string id) => throw new NotImplementedException();
public List<T> GetBackboneComponentsOfType<T>() => throw new NotImplementedException();
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) => throw new NotImplementedException();
public void RegisterSubprocess(int pid) { }
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
public void SetStatus(string statusName, string statusValue) { }
@ -45,4 +45,3 @@ namespace Adaptation.Eaf.Core
protected virtual void StopAllComponents() { }
protected void StopComponents(List<BackboneComponent> components) { }
}
}

View File

@ -1,7 +1,6 @@
using System;
namespace Adaptation.Eaf.Core.Smtp
{
namespace Adaptation.Eaf.Core.Smtp;
public class EmailMessage
{
@ -12,13 +11,11 @@ namespace Adaptation.Eaf.Core.Smtp
public MailPriority Priority { get; }
public string Subject { get; }
public EmailMessage PriorityHigh() { throw new NotImplementedException(); }
public EmailMessage PriorityLow() { throw new NotImplementedException(); }
public EmailMessage PriorityNormal() { throw new NotImplementedException(); }
public EmailMessage SetBody(string body) { throw new NotImplementedException(); }
public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); }
public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); }
}
public EmailMessage PriorityHigh() => throw new NotImplementedException();
public EmailMessage PriorityLow() => throw new NotImplementedException();
public EmailMessage PriorityNormal() => throw new NotImplementedException();
public EmailMessage SetBody(string body) => throw new NotImplementedException();
public EmailMessage SetPriority(MailPriority priority) => throw new NotImplementedException();
public EmailMessage SetSubject(string subject) => throw new NotImplementedException();
}

View File

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

View File

@ -1,5 +1,4 @@
namespace Adaptation.Eaf.Core.Smtp
{
namespace Adaptation.Eaf.Core.Smtp;
public enum MailPriority
{
@ -7,5 +6,3 @@
Normal = 1,
High = 2
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
using Adaptation.PeerGroup.GCL.Annotations;
namespace Adaptation.Eaf.EquipmentCore.Control
{
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IEquipmentControl : IPackageSource
{
[NotNull]
@ -13,4 +13,3 @@ namespace Adaptation.Eaf.EquipmentCore.Control
[NotNull]
IConnectionControl Connection { get; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,8 +3,8 @@ using Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
using System;
using System.Collections.Generic;
namespace Adaptation.Eaf.EquipmentCore.Control
{
namespace Adaptation.Eaf.EquipmentCore.Control;
public interface IEquipmentDataCollection
{
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
@ -36,4 +36,3 @@ namespace Adaptation.Eaf.EquipmentCore.Control
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
}
}

View File

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

View File

@ -2,8 +2,8 @@
using Adaptation.PeerGroup.GCL.Annotations;
using System;
namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting
{
namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting;
public class ParameterValue
{
public ParameterValue(EquipmentParameter definition, object value) { }
@ -14,7 +14,6 @@ namespace Adaptation.Eaf.EquipmentCore.DataCollection.Reporting
public EquipmentParameter Definition { get; }
public DateTime Timestamp { get; protected set; }
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); }
public override string ToString() { return base.ToString(); }
}
public virtual ParameterValue Clone(EquipmentParameter newDefinition) => throw new NotImplementedException();
public override string ToString() => base.ToString();
}

View File

@ -1,7 +1,7 @@
using Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription
{
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription;
public class EquipmentParameter
{
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
@ -17,8 +17,6 @@ namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ElementDescription
public bool IsTransient { get; }
public bool IsReadOnly { get; }
public override string ToString() { return base.ToString(); }
public string ToStringWithDetails() { return base.ToString(); }
}
public override string ToString() => base.ToString();
public string ToStringWithDetails() => base.ToString();
}

View File

@ -1,5 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public class Field
{
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
@ -9,4 +9,3 @@
public ParameterTypeDefinition TypeDefinition { get; }
public bool CanBeNull { get; }
}
}

View File

@ -1,5 +1,5 @@
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public abstract class ParameterTypeDefinition
{
public ParameterTypeDefinition(string name, string description) { }
@ -7,6 +7,5 @@
public string Name { get; }
public string Description { get; }
public override string ToString() { return base.ToString(); }
}
public override string ToString() => base.ToString();
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
{
namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public class StructuredType : ParameterTypeDefinition
{
@ -9,4 +9,3 @@ namespace Adaptation.Eaf.EquipmentCore.SelfDescription.ParameterTypes
public IList<Field> Fields { get; }
}
}

View File

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

View File

@ -1,7 +1,7 @@
using System;
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
{
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
public class ModelObjectParameterDefinition : IConfigurationObject
{
@ -20,7 +20,6 @@ namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
[System.Runtime.Serialization.DataMemberAttribute]
public virtual string EnumType { get; set; }
public virtual ModelObjectParameterDefinition Clone() { return null; }
public virtual bool IsValidValue(string value) { return false; }
}
public virtual ModelObjectParameterDefinition Clone() => null;
public virtual bool IsValidValue(string value) => false;
}

View File

@ -1,5 +1,5 @@
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation
{
namespace Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
public enum ModelObjectParameterType
{
String = 0,
@ -14,4 +14,3 @@
Float = 9,
Enum = 10
}
}

View File

@ -1,8 +1,8 @@
using Adaptation.PeerGroup.GCL.SecsDriver;
using System;
namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances
{
namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstances;
[System.Runtime.Serialization.DataContractAttribute]
public class SecsConnectionConfiguration
{
@ -41,4 +41,3 @@ namespace Adaptation.Eaf.Management.ConfigurationData.Semiconductor.CellInstance
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
}
}

View File

@ -0,0 +1,141 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.Archive;
public class FileRead : Shared.FileRead, IFileRead
{
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
void IFileRead.CheckTests(Test[] tests, bool extra)
{
if (_Description is not Description)
throw new Exception();
}
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
private void MoveArchive(DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
{ }
string logisticsSequence = _Logistics.Sequence.ToString();
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
string jobIdDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory))
_ = Directory.CreateDirectory(jobIdDirectory);
//string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory);
string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\Archive\", _Logistics.JobID, @"\", weekDirectory);
if (!Directory.Exists(destinationArchiveDirectory))
_ = Directory.CreateDirectory(destinationArchiveDirectory);
string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() };
if ((matchDirectories is null) || matchDirectories.Length != 1)
throw new Exception("Didn't find directory by logistics sequence");
string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]);
destinationArchiveDirectory = string.Concat(destinationArchiveDirectory, @"\", Path.GetFileName(sourceDirectory));
Directory.Move(sourceDirectory, destinationArchiveDirectory);
}
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
Tuple<string, string[], string[]> pdsf = ProcessDataStandardFormat.GetLogisticsColumnsAndBody(reportFullPath);
_Logistics = new Logistics(reportFullPath, pdsf.Item1);
SetFileParameterLotIDToLogisticsMID();
JsonElement[] jsonElements = ProcessDataStandardFormat.GetArray(pdsf);
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
Tuple<Test[], Dictionary<Test, List<Shared.Properties.IDescription>>> tuple = GetTuple(this, descriptions, extra: false);
MoveArchive(dateTime);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(pdsf.Item1, tuple.Item1, jsonElements, new List<FileInfo>());
return results;
}
}

View File

@ -4,8 +4,7 @@ using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
namespace Adaptation.FileHandlers
{
namespace Adaptation.FileHandlers;
public class CellInstanceConnectionName
{
@ -13,16 +12,24 @@ namespace Adaptation.FileHandlers
internal static IFileRead Get(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
{
IFileRead result;
int levelIsArchive = 7;
int levelIsXToArchive = 6;
bool isDuplicator = cellInstanceConnectionName.StartsWith(cellInstanceName);
if (isDuplicator)
result = new MET08THFTIRQS408M.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted, levelIsXToArchive, levelIsArchive);
{
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
int hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
result = hyphens switch
{
(int)MET08THFTIRQS408M.Hyphen.IsArchive => new Archive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
(int)MET08THFTIRQS408M.Hyphen.IsDummy => new Dummy.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
(int)MET08THFTIRQS408M.Hyphen.IsXToArchive => new ToArchive.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
_ => new MET08THFTIRQS408M.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
};
}
else
{
result = cellInstanceConnectionName switch
{
nameof(QS408M) => new QS408M.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted, levelIsXToArchive, levelIsArchive),
nameof(QS408M) => new QS408M.FileRead(smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted),
_ => throw new Exception(),
};
}
@ -30,5 +37,3 @@ namespace Adaptation.FileHandlers
}
}
}

View File

@ -0,0 +1,308 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using Infineon.Monitoring.MonA;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
using System.Threading;
namespace Adaptation.FileHandlers.Dummy;
public class FileRead : Shared.FileRead, IFileRead
{
private readonly Timer _Timer;
private int _LastDummyRunIndex;
private readonly string[] _CellNames;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
_LastDummyRunIndex = -1;
List<string> cellNames = new();
_Timer = new Timer(Callback, null, Timeout.Infinite, Timeout.Infinite);
ModelObjectParameterDefinition[] cellInstanceCollection = GetProperties(cellInstanceConnectionName, modelObjectParameters, "CellInstance.", ".Alias");
foreach (ModelObjectParameterDefinition modelObjectParameterDefinition in cellInstanceCollection)
cellNames.Add(modelObjectParameterDefinition.Name.Split('.')[1]);
_CellNames = cellNames.ToArray();
if (Debugger.IsAttached || fileConnectorConfiguration.PreProcessingMode == FileConnectorConfiguration.PreProcessingModeEnum.Process)
Callback(null);
else
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName) => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract() => throw new Exception(string.Concat("See ", nameof(CallbackFileExists)));
void IFileRead.CheckTests(Test[] tests, bool extra)
{
if (_Description is not Description)
throw new Exception();
}
void IFileRead.Callback(object state) => Callback(state);
private void CallbackInProcessCleared(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, string inProcessDirectory, long sequence, bool warning)
{
const string site = "sjc";
string stateName = string.Concat("Dummy_", _EventName);
const string monInURL = "http://moninhttp.sjc.infineon.com/input/text";
MonIn monIn = MonIn.GetInstance(monInURL);
try
{
if (warning)
{
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() });
_ = monIn.SendStatus(site, monARessource, stateName, State.Warning);
for (int i = 1; i < 12; i++)
Thread.Sleep(500);
}
ZipFile.ExtractToDirectory(sourceArchiveFile, inProcessDirectory);
string[] files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.TopDirectoryOnly);
if (files.Length > 250)
throw new Exception("Safety net!");
foreach (string file in files)
File.SetLastWriteTime(file, new DateTime(sequence));
if (!_FileConnectorConfiguration.IncludeSubDirectories.Value)
{
foreach (string file in files)
File.Move(file, Path.Combine(targetFileLocation, Path.GetFileName(file)));
}
else
{
string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories);
foreach (string directory in directories)
_ = Directory.CreateDirectory(string.Concat(targetFileLocation, directory.Substring(inProcessDirectory.Length)));
foreach (string file in files)
File.Move(file, string.Concat(targetFileLocation, file.Substring(inProcessDirectory.Length)));
}
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() });
_ = monIn.SendStatus(site, monARessource, stateName, State.Ok);
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
_ = monIn.SendStatus(site, monARessource, stateName, State.Critical);
}
}
private void CallbackFileExists(string sourceArchiveFile, string traceDummyFile, string targetFileLocation, string monARessource, long sequence)
{
string[] files;
bool warning = false;
if (!_DummyRuns.ContainsKey(monARessource))
_DummyRuns.Add(monARessource, new List<long>());
if (!_DummyRuns[monARessource].Contains(sequence))
_DummyRuns[monARessource].Add(sequence);
File.AppendAllLines(traceDummyFile, new string[] { sourceArchiveFile });
string inProcessDirectory = Path.Combine(_ProgressPath, "Dummy In-Process", sequence.ToString());
if (!Directory.Exists(inProcessDirectory))
_ = Directory.CreateDirectory(inProcessDirectory);
files = Directory.GetFiles(inProcessDirectory, "*", SearchOption.AllDirectories);
if (files.Any())
{
if (files.Length > 250)
throw new Exception("Safety net!");
try
{
foreach (string file in files)
File.Delete(file);
}
catch (Exception) { }
}
if (_FileConnectorConfiguration.IncludeSubDirectories.Value)
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.AllDirectories);
else
files = Directory.GetFiles(targetFileLocation, "*", SearchOption.TopDirectoryOnly);
foreach (string file in files)
{
if (new FileInfo(file).LastWriteTime.Ticks == sequence)
{
warning = true;
break;
}
}
CallbackInProcessCleared(sourceArchiveFile, traceDummyFile, targetFileLocation, monARessource, inProcessDirectory, sequence, warning);
}
private string GetCellName(string pathSegment)
{
string result = string.Empty;
foreach (string cellName in _CellNames)
{
if (pathSegment.ToLower().Contains(cellName.ToLower()))
{
result = cellName;
break;
}
}
if (string.IsNullOrEmpty(result))
{
int count;
List<(string CellName, int Count)> cellNames = new();
foreach (string cellName in _CellNames)
{
count = 0;
foreach (char @char in cellName.ToLower())
count += pathSegment.Length - pathSegment.ToLower().Replace(@char.ToString(), string.Empty).Length;
cellNames.Add(new(cellName, count));
}
result = (from l in cellNames orderby l.CellName.Length, l.Count descending select l.CellName).First();
}
return result;
}
private void Callback(object state)
{
try
{
string pathSegment;
string monARessource;
DateTime dateTime = DateTime.Now;
if (!_FileConnectorConfiguration.TargetFileLocation.Contains(_FileConnectorConfiguration.SourceFileLocation))
throw new Exception("Target must start with source");
bool check = (dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday);
if (!_IsEAFHosted || check)
{
string checkSegment;
string checkDirectory;
string sourceFileFilter;
string sourceArchiveFile;
string sourceFileLocation;
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string traceDummyDirectory = Path.Combine(Path.GetPathRoot(_TracePath), "TracesDummy", _CellInstanceName, "Source", $"{dateTime:yyyy}___Week_{weekOfYear}");
if (!Directory.Exists(traceDummyDirectory))
_ = Directory.CreateDirectory(traceDummyDirectory);
string traceDummyFile = Path.Combine(traceDummyDirectory, $"{dateTime.Ticks} - {_CellInstanceName}.txt");
File.AppendAllText(traceDummyFile, string.Empty);
if (_FileConnectorConfiguration.SourceFileLocation.EndsWith("\\"))
sourceFileLocation = _FileConnectorConfiguration.SourceFileLocation;
else
sourceFileLocation = string.Concat(_FileConnectorConfiguration.SourceFileLocation, '\\');
for (int i = 0; i < _FileConnectorConfiguration.SourceFileFilters.Count; i++)
{
_LastDummyRunIndex += 1;
if (_LastDummyRunIndex >= _FileConnectorConfiguration.SourceFileFilters.Count)
_LastDummyRunIndex = 0;
sourceFileFilter = _FileConnectorConfiguration.SourceFileFilters[_LastDummyRunIndex];
sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, sourceFileFilter));
if (File.Exists(sourceArchiveFile))
{
checkSegment = _FileConnectorConfiguration.TargetFileLocation.Substring(sourceFileLocation.Length);
checkDirectory = Path.GetDirectoryName(sourceArchiveFile);
for (int z = 0; z < int.MaxValue; z++)
{
if (checkDirectory.Length < sourceFileLocation.Length || !checkDirectory.StartsWith(sourceFileLocation))
break;
checkDirectory = Path.GetDirectoryName(checkDirectory);
if (Directory.Exists(Path.Combine(checkDirectory, checkSegment)))
{
checkDirectory = Path.Combine(checkDirectory, checkSegment);
break;
}
}
if (!checkDirectory.EndsWith(checkSegment))
throw new Exception("Could not determine dummy target directory for extract!");
if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
throw new Exception("Invalid file name for source archive file!");
pathSegment = checkDirectory.Substring(sourceFileLocation.Length);
monARessource = GetCellName(pathSegment);
if (string.IsNullOrEmpty(monARessource))
throw new Exception("Could not determine which cell archive file is associated with!");
if (_IsEAFHosted)
CallbackFileExists(sourceArchiveFile, traceDummyFile, checkDirectory, monARessource, sequence);
break;
}
}
}
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
try
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception exception)
{
string subject = string.Concat("Exception:", _CellInstanceConnectionName);
string body = string.Concat(exception.Message, Environment.NewLine, Environment.NewLine, exception.StackTrace);
try
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
}
}
}

View File

@ -16,8 +16,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
namespace Adaptation.FileHandlers.MET08THFTIRQS408M;
public class FileRead : Shared.FileRead, IFileRead
{
@ -39,8 +38,8 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
private readonly int _HyphenIsXToOpenInsightMetrologyViewer;
private readonly int _HyphenIsXToOpenInsightMetrologyViewerAttachments;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted, int hyphenXToArchive, int hyphenIsArchive) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted, hyphenXToArchive, hyphenIsArchive)
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
@ -51,10 +50,6 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
if (hyphenIsArchive != (int)Hyphen.IsArchive)
throw new Exception(cellInstanceConnectionName);
if (hyphenXToArchive != (int)Hyphen.IsXToArchive)
throw new Exception(cellInstanceConnectionName);
_LastDummyRunIndex = -1;
if (_HyphenIsNaEDA == 0)
{ }
@ -96,15 +91,9 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
}
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
Move(this, extractResults, exception);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
void IFileRead.WaitForThread()
{
WaitForThread(thread: null, threadExceptions: null);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
@ -151,7 +140,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, new Test[] { }, JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
@ -169,34 +158,11 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
void IFileRead.CheckTests(Test[] tests, bool extra)
{
if (!(_Description is Description))
if (_Description is not Description)
throw new Exception();
}
void IFileRead.Callback(object state)
{
Callback(state);
}
void IFileRead.MoveArchive()
{
string logisticsSequence = _Logistics.Sequence.ToString();
string weekOfYear = _Calendar.GetWeekOfYear(_Logistics.DateTimeFromSequence, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
string jobIdDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory))
Directory.CreateDirectory(jobIdDirectory);
//string destinationArchiveDirectory = string.Concat(jobIdDirectory, @"\!Archive\", weekDirectory);
string destinationArchiveDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\Archive\", _Logistics.JobID, @"\", weekDirectory);
if (!Directory.Exists(destinationArchiveDirectory))
Directory.CreateDirectory(destinationArchiveDirectory);
string[] matchDirectories = new string[] { GetDirectoriesRecursively(jobIdDirectory, logisticsSequence).FirstOrDefault() };
if ((matchDirectories is null) || matchDirectories.Length != 1)
throw new Exception("Didn't find directory by logistics sequence");
string sourceDirectory = Path.GetDirectoryName(matchDirectories[0]);
destinationArchiveDirectory = string.Concat(destinationArchiveDirectory, @"\", Path.GetFileName(sourceDirectory));
Directory.Move(sourceDirectory, destinationArchiveDirectory);
}
void IFileRead.Callback(object state) => Callback(state);
protected List<QS408M.Description> GetDescriptions(JsonElement[] jsonElements)
{
@ -240,11 +206,11 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
if (segments.Length > 2)
duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]);
if (!Directory.Exists(duplicateDirectory))
Directory.CreateDirectory(duplicateDirectory);
if ((isDummyRun || isNotUsedInsightMetrologyViewerAttachments || _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0) && _Hyphens != _HyphenIsXToArchive && _Hyphens != _HyphenIsArchive)
_ = Directory.CreateDirectory(duplicateDirectory);
if ((isDummyRun || isNotUsedInsightMetrologyViewerAttachments || _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0))
{
if (!Directory.Exists(duplicateDirectory))
Directory.CreateDirectory(duplicateDirectory);
_ = Directory.CreateDirectory(duplicateDirectory);
string successDirectory;
if (_Hyphens != _HyphenIsXToAPC)
successDirectory = string.Empty;
@ -252,7 +218,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
successDirectory = string.Concat(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation), @"\ViewerPath");
if (!Directory.Exists(successDirectory))
Directory.CreateDirectory(successDirectory);
_ = Directory.CreateDirectory(successDirectory);
}
List<Tuple<Shared.Properties.IScopeInfo, string>> tuples = new();
string duplicateFile = string.Concat(duplicateDirectory, @"\", Path.GetFileName(reportFullPath));
@ -260,7 +226,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
string logisticsSequenceMemoryDirectory = string.Concat(_MemoryPath, @"\", _EquipmentType, @"\Source\", weekDirectory, @"\", _Logistics.Sequence);
if (!Directory.Exists(logisticsSequenceMemoryDirectory))
Directory.CreateDirectory(logisticsSequenceMemoryDirectory);
_ = Directory.CreateDirectory(logisticsSequenceMemoryDirectory);
if (_Hyphens == _HyphenIsXToAPC)
{
if (!isDummyRun && _IsEAFHosted)
@ -318,7 +284,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
File.SetLastWriteTime(reportFullPath, fileInfo.CreationTime);
string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory))
Directory.CreateDirectory(jobIdDirectory);
_ = Directory.CreateDirectory(jobIdDirectory);
string[] matchDirectories;
if (!_IsEAFHosted)
matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) };
@ -372,7 +338,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
if (fileCount > 0 || string.IsNullOrEmpty(checkDirectory))
{
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Warning.ToString() });
monIn.SendStatus(site, monARessource, stateName, State.Warning);
_ = monIn.SendStatus(site, monARessource, stateName, State.Warning);
for (int i = 1; i < 12; i++)
Thread.Sleep(500);
}
@ -411,12 +377,12 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
string[] directories = Directory.GetDirectories(inProcessDirectory, "*", SearchOption.AllDirectories);
foreach (string directory in directories)
Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length)));
_ = Directory.CreateDirectory(string.Concat(checkDirectory, directory.Substring(inProcessDirectory.Length)));
foreach (string file in files)
File.Move(file, string.Concat(checkDirectory, file.Substring(inProcessDirectory.Length)));
}
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Ok.ToString() });
monIn.SendStatus(site, monARessource, stateName, State.Ok);
_ = monIn.SendStatus(site, monARessource, stateName, State.Ok);
}
catch (Exception exception)
{
@ -426,7 +392,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{ _SMTP.SendHighPriorityEmailMessage(subject, body); }
catch (Exception) { }
File.AppendAllLines(traceDummyFile, new string[] { site, monARessource, stateName, State.Critical.ToString(), exception.Message, exception.StackTrace });
monIn.SendStatus(site, monARessource, stateName, State.Critical);
_ = monIn.SendStatus(site, monARessource, stateName, State.Critical);
}
}
}
@ -451,7 +417,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
string traceDummyDirectory = string.Concat(Path.GetPathRoot(_TracePath), @"\TracesDummy\", _CellInstanceName, @"\Source\", dateTime.ToString("yyyy"), "___Week_", weekOfYear);
if (!Directory.Exists(traceDummyDirectory))
Directory.CreateDirectory(traceDummyDirectory);
_ = Directory.CreateDirectory(traceDummyDirectory);
string traceDummyFile = string.Concat(traceDummyDirectory, @"\", dateTime.Ticks, " - ", _CellInstanceName, ".txt");
File.AppendAllText(traceDummyFile, string.Empty);
List<Tuple<string, string, string, string, int>> tuples = new();
@ -498,7 +464,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
inProcessDirectory = string.Concat(progressDirectory, @"\Dummy_in process\", sequence);
checkDirectory = inProcessDirectory;
if (!Directory.Exists(checkDirectory))
Directory.CreateDirectory(checkDirectory);
_ = Directory.CreateDirectory(checkDirectory);
files = Directory.GetFiles(checkDirectory, "*", SearchOption.AllDirectories);
fileCount = files.Length;
if (files.Any())
@ -535,7 +501,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
try
{
TimeSpan timeSpan = new(DateTime.Now.AddSeconds(_FileConnectorConfiguration.FileScanningIntervalInSeconds.Value).Ticks - DateTime.Now.Ticks);
_Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
_ = _Timer.Change((long)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception exception)
{
@ -548,5 +514,3 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
}
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
namespace Adaptation.FileHandlers.MET08THFTIRQS408M;
public enum Hyphen
{
@ -14,5 +13,3 @@
IsDummy,
IsNaEDA
}
}

View File

@ -4,8 +4,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
namespace Adaptation.FileHandlers.MET08THFTIRQS408M;
public class ProcessData
{
@ -33,7 +32,7 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
if (logistics is null)
{ }
QS408M.Description x = descriptions[0];
results.Append(x.UniqueId).Append(del).
_ = results.Append(x.UniqueId).Append(del).
Append(x.Date).Append(del).
Append(x.Employee).Append(del).
Append(x.Recipe).Append(del).
@ -68,5 +67,3 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
}
}
}

View File

@ -4,8 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace Adaptation.FileHandlers.MET08THFTIRQS408M
{
namespace Adaptation.FileHandlers.MET08THFTIRQS408M;
public class WSRequest
{
@ -85,5 +84,3 @@ namespace Adaptation.FileHandlers.MET08THFTIRQS408M
}
}
}

View File

@ -5,13 +5,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.QS408M
{
namespace Adaptation.FileHandlers.QS408M;
public class Description : IDescription, Shared.Properties.IDescription
{
public int Test { get; set; }
public int Count { get; set; }
public int Index { get; set; }
@ -48,10 +46,7 @@ namespace Adaptation.FileHandlers.QS408M
public string StdDev { get; set; }
public string Thickness { get; set; }
string IDescription.GetEventDescription()
{
return "File Has been read and parsed";
}
string IDescription.GetEventDescription() => "File Has been read and parsed";
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
{
@ -272,5 +267,3 @@ namespace Adaptation.FileHandlers.QS408M
}
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.FileHandlers.QS408M
{
namespace Adaptation.FileHandlers.QS408M;
public class Detail
{
@ -9,11 +8,6 @@ namespace Adaptation.FileHandlers.QS408M
public string Thickness { get; set; }
public string UniqueId { get; set; }
public override string ToString()
{
return string.Concat(Position, ";", Thickness, ";");
}
}
public override string ToString() => string.Concat(Position, ";", Thickness, ";");
}

View File

@ -9,8 +9,7 @@ using System.Linq;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.QS408M
{
namespace Adaptation.FileHandlers.QS408M;
public class FileRead : Shared.FileRead, IFileRead
{
@ -18,8 +17,8 @@ namespace Adaptation.FileHandlers.QS408M
private readonly string _OriginalDataBioRad;
private readonly ProcessData _LastProcessData;
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted, int hyphenXToArchive, int hyphenIsArchive) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted, hyphenXToArchive, hyphenIsArchive)
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), true, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
@ -34,15 +33,9 @@ namespace Adaptation.FileHandlers.QS408M
_LastProcessData = new();
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
Move(this, extractResults, exception);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception) => Move(extractResults, exception);
void IFileRead.WaitForThread()
{
WaitForThread(thread: null, threadExceptions: null);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
@ -89,7 +82,7 @@ namespace Adaptation.FileHandlers.QS408M
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, new Test[] { }, JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
@ -105,20 +98,9 @@ namespace Adaptation.FileHandlers.QS408M
return results;
}
void IFileRead.CheckTests(Test[] tests, bool extra)
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
void IFileRead.CheckTests(Test[] tests, bool extra) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
void IFileRead.MoveArchive()
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
void IFileRead.Callback(object state)
{
throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
}
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
@ -146,5 +128,3 @@ namespace Adaptation.FileHandlers.QS408M
}
}
}

View File

@ -11,8 +11,7 @@ using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace Adaptation.FileHandlers.QS408M
{
namespace Adaptation.FileHandlers.QS408M;
public partial class ProcessData : IProcessData
{
@ -59,10 +58,7 @@ namespace Adaptation.FileHandlers.QS408M
Parse(fileRead, logistics, fileInfoCollection, originalDataBioRad, lastProcessData);
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors)
{
throw new Exception(string.Concat("See ", nameof(Parse)));
}
string IProcessData.GetCurrentReactor(IFileRead fileRead, Logistics logistics, Dictionary<string, string> reactors) => throw new Exception(string.Concat("See ", nameof(Parse)));
Tuple<string, Test[], JsonElement[], List<FileInfo>> IProcessData.GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection)
{
@ -300,8 +296,8 @@ namespace Adaptation.FileHandlers.QS408M
ScanPast("wafer:");
}
Wafer = GetToEOL();
GetToEOL();
GetToEOL();
_ = GetToEOL();
_ = GetToEOL();
string token = GetToken();
int counter = 1;
while (true)
@ -390,7 +386,7 @@ namespace Adaptation.FileHandlers.QS408M
foreach (char c in Title)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
titleFixed.Append(c);
_ = titleFixed.Append(c);
}
Title = titleFixed.ToString();
@ -399,7 +395,7 @@ namespace Adaptation.FileHandlers.QS408M
foreach (char c in Wafer)
{
if (char.IsLetterOrDigit(c) || c == '-' || c == '.')
waferFixed.Append(c);
_ = waferFixed.Append(c);
}
Wafer = waferFixed.ToString();
@ -431,5 +427,3 @@ namespace Adaptation.FileHandlers.QS408M
}
}
}

View File

@ -0,0 +1,140 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared;
using Adaptation.Shared.Duplicator;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json;
namespace Adaptation.FileHandlers.ToArchive;
public class FileRead : Shared.FileRead, IFileRead
{
public FileRead(ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted) :
base(new Description(), false, smtp, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfiguration, equipmentTypeName, parameterizedModelObjectDefinitionType, modelObjectParameters, equipmentDictionaryName, dummyRuns, useCyclicalForDescription, isEAFHosted)
{
_MinFileLength = 10;
_NullData = string.Empty;
_Logistics = new Logistics(this);
if (_FileParameter is null)
throw new Exception(cellInstanceConnectionName);
if (_ModelObjectParameterDefinitions is null)
throw new Exception(cellInstanceConnectionName);
if (!_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
}
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
bool isErrorFile = exception is not null;
if (!isErrorFile && !string.IsNullOrEmpty(_Logistics.ReportFullPath))
{
FileInfo fileInfo = new(_Logistics.ReportFullPath);
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
}
Move(extractResults, exception);
}
void IFileRead.WaitForThread() => WaitForThread(thread: null, threadExceptions: null);
string IFileRead.GetEventDescription()
{
string result = _Description.GetEventDescription();
return result;
}
List<string> IFileRead.GetHeaderNames()
{
List<string> results = _Description.GetHeaderNames();
return results;
}
string[] IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results = Move(extractResults, to, from, resolvedFileLocation, exception);
return results;
}
JsonProperty[] IFileRead.GetDefault()
{
JsonProperty[] results = _Description.GetDefault(this, _Logistics);
return results;
}
Dictionary<string, string> IFileRead.GetDisplayNamesJsonElement()
{
Dictionary<string, string> results = _Description.GetDisplayNamesJsonElement(this);
return results;
}
List<IDescription> IFileRead.GetDescriptions(IFileRead fileRead, List<Test> tests, IProcessData processData)
{
List<IDescription> results = _Description.GetDescriptions(fileRead, _Logistics, tests, processData);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.GetExtractResult(string reportFullPath, string eventName)
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
if (string.IsNullOrEmpty(eventName))
throw new Exception();
_ReportFullPath = reportFullPath;
DateTime dateTime = DateTime.Now;
results = GetExtractResult(reportFullPath, dateTime);
if (results.Item3 is null)
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(results.Item1, Array.Empty<Test>(), JsonSerializer.Deserialize<JsonElement[]>("[]"), results.Item4);
if (results.Item3.Length > 0 && _IsEAFHosted)
WritePDSF(this, results.Item3);
UpdateLastTicksDuration(DateTime.Now.Ticks - dateTime.Ticks);
return results;
}
Tuple<string, Test[], JsonElement[], List<FileInfo>> IFileRead.ReExtract()
{
Tuple<string, Test[], JsonElement[], List<FileInfo>> results;
List<string> headerNames = _Description.GetHeaderNames();
Dictionary<string, string> keyValuePairs = _Description.GetDisplayNamesJsonElement(this);
results = ReExtract(this, headerNames, keyValuePairs);
return results;
}
void IFileRead.CheckTests(Test[] tests, bool extra)
{
if (_Description is not Description)
throw new Exception();
}
void IFileRead.Callback(object state) => throw new Exception(string.Concat("Not ", nameof(_IsDuplicator)));
private Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, DateTime dateTime)
{
if (dateTime == DateTime.MinValue)
{ }
Tuple<string, Test[], JsonElement[], List<FileInfo>> results = new(string.Empty, null, null, new List<FileInfo>());
_Logistics = new Logistics(this, reportFullPath, useSplitForMID: true);
SetFileParameterLotIDToLogisticsMID();
string[] segments = Path.GetFileNameWithoutExtension(reportFullPath).Split('_');
string duplicateDirectory = string.Concat(_FileConnectorConfiguration.TargetFileLocation, @"\", segments[0]);
if (segments.Length > 2)
duplicateDirectory = string.Concat(duplicateDirectory, @"-", segments[2]);
if (!Directory.Exists(duplicateDirectory))
_ = Directory.CreateDirectory(duplicateDirectory);
string logisticsSequence = _Logistics.Sequence.ToString();
bool isDummyRun = _DummyRuns.Any() && _DummyRuns.ContainsKey(_Logistics.JobID) && _DummyRuns[_Logistics.JobID].Any() && (from l in _DummyRuns[_Logistics.JobID] where l == _Logistics.Sequence select 1).Any();
List<Tuple<Shared.Properties.IScopeInfo, string>> tuples = new();
string destinationDirectory = WriteScopeInfo(_ProgressPath, _Logistics, dateTime, duplicateDirectory, tuples);
if (isDummyRun)
Shared0607(reportFullPath, duplicateDirectory, logisticsSequence, destinationDirectory);
return results;
}
}

View File

@ -1,5 +1,5 @@
namespace Adaptation.Ifx.Eaf.Common.Configuration
{
namespace Adaptation.Ifx.Eaf.Common.Configuration;
[System.Runtime.Serialization.DataContractAttribute]
public class ConnectionSetting
{
@ -10,4 +10,3 @@
[System.Runtime.Serialization.DataMemberAttribute]
public string Value { get; set; }
}
}

View File

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

View File

@ -2,8 +2,8 @@
using System;
using System.Collections.Generic;
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component
{
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component;
public class FilePathGenerator
{
public const char PLACEHOLDER_IDENTIFIER = '%';
@ -15,9 +15,9 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component
public const string PLACEHOLDER_SUB_FOLDER = "SubFolder";
public const string PLACEHOLDER_CELL_NAME = "CellName";
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) => throw new NotImplementedException();
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) => throw new NotImplementedException();
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) => throw new NotImplementedException();
protected string SubFolderPath { get; }
protected FileConnectorConfiguration Configuration { get; }
@ -25,11 +25,10 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Component
protected bool IsErrorFile { get; }
protected string DefaultPlaceHolderValue { get; }
public string GetFullTargetPath() { throw new NotImplementedException(); }
public virtual string GetTargetFileName() { throw new NotImplementedException(); }
public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); }
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); }
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); }
protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); }
}
public string GetFullTargetPath() => throw new NotImplementedException();
public virtual string GetTargetFileName() => throw new NotImplementedException();
public string GetTargetFolder(bool throwExceptionIfNotExist = true) => throw new NotImplementedException();
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException();
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException();
protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException();
}

View File

@ -2,8 +2,8 @@
using System;
using System.Collections.Generic;
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration
{
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
[System.Runtime.Serialization.DataContractAttribute]
public class FileConnectorConfiguration
{
@ -85,7 +85,7 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileName { get; set; }
public void Initialize() { throw new NotImplementedException(); }
public void Initialize() => throw new NotImplementedException();
public enum PostProcessingModeEnum
{
@ -132,4 +132,3 @@ namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration
IgnoreOlder = 1
}
}
}

View File

@ -2,13 +2,12 @@
using System;
using System.Collections.Generic;
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription
{
namespace Adaptation.Ifx.Eaf.EquipmentConnector.File.SelfDescription;
public class FileConnectorParameterTypeDefinitionProvider
{
public FileConnectorParameterTypeDefinitionProvider() { }
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() { return null; }
public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; }
}
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() => null;
public ParameterTypeDefinition GetParameterTypeDefinition(string name) => null;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
namespace Adaptation.PeerGroup.GCL.SecsDriver
{
namespace Adaptation.PeerGroup.GCL.SecsDriver;
public enum SerialBaudRate
{
Baud9600 = 0,
@ -13,4 +13,3 @@
Baud57600 = 8,
Baud115200 = 9
}
}

View File

@ -4,8 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace Adaptation.Shared.Duplicator
{
namespace Adaptation.Shared.Duplicator;
public class Description : IDescription, Properties.IDescription
{
@ -24,10 +23,7 @@ namespace Adaptation.Shared.Duplicator
public string MID { get; set; }
public string Date { get; set; } //2021-10-23
string IDescription.GetEventDescription()
{
return "File Has been read and parsed";
}
string IDescription.GetEventDescription() => "File Has been read and parsed";
List<string> IDescription.GetNames(IFileRead fileRead, Logistics logistics)
{
@ -144,5 +140,3 @@ namespace Adaptation.Shared.Duplicator
}
}
}

View File

@ -1,4 +1,4 @@
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Eaf.Management.ConfigurationData.CellAutomation;
using Adaptation.Ifx.Eaf.EquipmentConnector.File.Configuration;
using Adaptation.Shared.Methods;
using log4net;
@ -12,8 +12,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public class FileRead : Properties.IFileRead
{
@ -35,10 +34,8 @@ namespace Adaptation.Shared
protected readonly Calendar _Calendar;
protected readonly bool _IsSourceTimer;
protected readonly string _VillachPath;
protected readonly int _HyphenIsArchive;
protected readonly string _ProgressPath;
protected readonly string _EquipmentType;
protected readonly int _HyphenIsXToArchive;
protected readonly long _BreakAfterSeconds;
protected readonly string _ExceptionSubject;
protected readonly string _CellInstanceName;
@ -66,7 +63,7 @@ namespace Adaptation.Shared
string Properties.IFileRead.CellInstanceConnectionName => _CellInstanceConnectionName;
string Properties.IFileRead.ParameterizedModelObjectDefinitionType => _ParameterizedModelObjectDefinitionType;
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted, int hyphenXToArchive, int hyphenIsArchive)
public FileRead(IDescription description, bool isEvent, ISMTP smtp, Dictionary<string, string> fileParameter, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, Dictionary<string, List<long>> dummyRuns, bool useCyclicalForDescription, bool isEAFHosted)
{
_SMTP = smtp;
_IsEvent = isEvent;
@ -76,9 +73,7 @@ namespace Adaptation.Shared
_Description = description;
_FileParameter = fileParameter;
_ReportFullPath = string.Empty;
_HyphenIsArchive = hyphenIsArchive;
_CellInstanceName = cellInstanceName;
_HyphenIsXToArchive = hyphenXToArchive;
_Calendar = new CultureInfo("en-US").Calendar;
_Log = LogManager.GetLogger(typeof(FileRead));
_UseCyclicalForDescription = useCyclicalForDescription;
@ -86,9 +81,9 @@ namespace Adaptation.Shared
_ModelObjectParameterDefinitions = modelObjectParameters;
_FileConnectorConfiguration = fileConnectorConfiguration;
_ParameterizedModelObjectDefinitionType = parameterizedModelObjectDefinitionType;
_IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt"));
_IsSourceTimer = fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt");
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
_Hyphens = (cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length);
_Hyphens = cellInstanceConnectionName.Length - cellInstanceConnectionNameBase.Length;
_ExceptionSubject = string.Concat("Exception:", _CellInstanceConnectionName, _FileConnectorConfiguration?.SourceDirectoryCloaking);
string suffix;
string[] segments = _ParameterizedModelObjectDefinitionType.Split('.');
@ -147,7 +142,7 @@ namespace Adaptation.Shared
throw new Exception("_Configuration is empty?");
if (_FileConnectorConfiguration.TargetFileLocation.Contains('%') || _FileConnectorConfiguration.ErrorTargetFileLocation.Contains('%'))
throw new Exception("_Configuration is incorrect for a duplicator!");
if (!(_FileConnectorConfiguration is null))
if (_FileConnectorConfiguration is not null)
{
if (string.IsNullOrEmpty(_FileConnectorConfiguration.SourceDirectoryCloaking))
throw new Exception("SourceDirectoryCloaking is empty?");
@ -157,7 +152,7 @@ namespace Adaptation.Shared
}
}
protected string GetPropertyValue(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyName)
protected static string GetPropertyValue(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyName)
{
string result;
List<string> results = (from l in modelObjectParameters where l.Name == propertyName select l.Value).ToList();
@ -167,7 +162,7 @@ namespace Adaptation.Shared
return result;
}
protected ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix)
{
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) select l).ToArray();
if (!results.Any())
@ -175,7 +170,7 @@ namespace Adaptation.Shared
return results;
}
protected ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
protected static ModelObjectParameterDefinition[] GetProperties(string cellInstanceConnectionName, IList<ModelObjectParameterDefinition> modelObjectParameters, string propertyNamePrefix, string propertyNameSuffix)
{
ModelObjectParameterDefinition[] results = (from l in modelObjectParameters where l.Name.StartsWith(propertyNamePrefix) && l.Name.EndsWith(propertyNameSuffix) select l).ToArray();
if (!results.Any())
@ -192,7 +187,7 @@ namespace Adaptation.Shared
protected void WaitForThread(Thread thread, List<Exception> threadExceptions)
{
if (!(thread is null))
if (thread is not null)
{
ThreadState threadState;
for (short i = 0; i < short.MaxValue; i++)
@ -202,7 +197,7 @@ namespace Adaptation.Shared
else
{
threadState = thread.ThreadState;
if (threadState != ThreadState.Running && threadState != ThreadState.WaitSleepJoin)
if (threadState is not ThreadState.Running and not ThreadState.WaitSleepJoin)
break;
}
Thread.Sleep(500);
@ -221,29 +216,29 @@ namespace Adaptation.Shared
}
}
protected void CreateProgressDirectory(string progressPath, Logistics logistics, int? duplicator, string[] exceptionLines)
protected void CreateProgressDirectory(string[] exceptionLines)
{
string progressDirectory;
StringBuilder stringBuilder = new();
if (duplicator is null || duplicator.Value == 0)
progressDirectory = string.Concat(progressPath, @"\EquipmentIntegration");
if (_Hyphens == 0)
progressDirectory = Path.Combine(_ProgressPath, _CellInstanceConnectionName);
else
{
stringBuilder.Clear();
for (int i = 0; i < duplicator.Value; i++)
_ = stringBuilder.Clear();
for (int i = 0; i < _Hyphens; i++)
{
if (i > 0 && (i % 2) == 0)
stringBuilder.Append(' ');
stringBuilder.Append('-');
_ = stringBuilder.Append(' ');
_ = stringBuilder.Append('-');
}
progressDirectory = string.Concat(progressPath, @"\", (duplicator.Value + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim();
progressDirectory = string.Concat(_ProgressPath, @"\", (_Hyphens + 1).ToString().PadLeft(2, '0'), " ", stringBuilder).Trim();
}
DateTime dateTime = DateTime.Now;
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", logistics.MID, "_", logistics.Sequence, "_", DateTime.Now.Ticks - logistics.Sequence);
progressDirectory = string.Concat(progressDirectory, @"\", dateTime.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.MID, "_", _Logistics.Sequence, "_", DateTime.Now.Ticks - _Logistics.Sequence);
if (!Directory.Exists(progressDirectory))
Directory.CreateDirectory(progressDirectory);
if (!(exceptionLines is null))
_ = Directory.CreateDirectory(progressDirectory);
if (exceptionLines is not null)
{
string fileName = string.Concat(progressDirectory, @"\readme.txt");
try
@ -255,17 +250,17 @@ namespace Adaptation.Shared
protected string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception)
{
string[] results;
bool isErrorFile = !(exception is null);
bool isErrorFile = exception is not null;
if (!to.EndsWith(@"\"))
string.Concat(to, @"\");
_ = string.Concat(to, @"\");
if (!isErrorFile)
results = new string[] { };
results = Array.Empty<string>();
else
{
results = new string[] { _Logistics.Sequence.ToString(), _Logistics.ReportFullPath, from, resolvedFileLocation, to, string.Empty, string.Empty, exception.Message, string.Empty, string.Empty, exception.StackTrace };
Shared0449(to, results);
}
if (!(extractResults is null) && !(extractResults.Item4 is null) && extractResults.Item4.Any())
if (extractResults is not null && extractResults.Item4 is not null && extractResults.Item4.Any())
{
string itemFile;
List<string> directories = new();
@ -276,7 +271,7 @@ namespace Adaptation.Shared
itemFile = sourceFile.FullName.Replace(from, to);
Shared1880(itemFile, directories, sourceFile, isErrorFile);
}
else if (!isErrorFile && !(_Logistics is null))
else if (!isErrorFile && _Logistics is not null)
Shared1811(to, sourceFile);
}
Shared0231(directories);
@ -284,7 +279,7 @@ namespace Adaptation.Shared
return results;
}
protected IEnumerable<string> GetDirectoriesRecursively(string path, string directoryNameSegment = null)
protected static IEnumerable<string> GetDirectoriesRecursively(string path, string directoryNameSegment = null)
{
Queue<string> queue = new();
queue.Enqueue(path);
@ -319,7 +314,7 @@ namespace Adaptation.Shared
Directory.Move(matchDirectories[0], result);
result = string.Concat(result, @"\", logistics.Sequence);
if (!Directory.Exists(result))
Directory.CreateDirectory(result);
_ = Directory.CreateDirectory(result);
}
return result;
}
@ -342,7 +337,7 @@ namespace Adaptation.Shared
return result;
}
protected string GetTupleFile(Logistics logistics, Properties.IScopeInfo scopeInfo, string duplicateDirectory)
protected static string GetTupleFile(Logistics logistics, Properties.IScopeInfo scopeInfo, string duplicateDirectory)
{
string result;
string rds;
@ -438,7 +433,7 @@ namespace Adaptation.Shared
try
{ File.Delete(duplicateFiles[i]); }
catch (Exception) { }
stringBuilder.Append("<").Append(duplicateFiles[i]).Append("> ");
_ = stringBuilder.Append('<').Append(duplicateFiles[i]).Append("> ");
}
}
throw new Exception(string.Concat("After {", _BreakAfterSeconds, "} seconds, right side of {", sourceDirectoryCloaking, "} didn't consume file(s) ", stringBuilder));
@ -491,7 +486,7 @@ namespace Adaptation.Shared
else
directory = Path.Combine(_TracePath, _EquipmentType, "Source", _CellInstanceName, _CellInstanceConnectionName);
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
_ = Directory.CreateDirectory(directory);
string file = Path.Combine(directory, string.Concat(_Logistics.MesEntity, "_", _Logistics.Sequence, ".ipdsf"));
string lines = ProcessDataStandardFormat.GetPDSFText(fileRead, _Logistics, jsonElements, logisticsText: string.Empty);
File.WriteAllText(file, lines);
@ -503,17 +498,13 @@ namespace Adaptation.Shared
}
}
protected void Move(IFileRead fileRead, Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
protected void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
{
bool isErrorFile = !(exception is null);
bool isErrorFile = exception is not null;
if (!isErrorFile && _IsDuplicator)
{
if (_Hyphens == _HyphenIsXToArchive)
Shared0192();
else if (_IsEAFHosted && _Hyphens == _HyphenIsArchive)
fileRead.MoveArchive();
if (_IsEAFHosted && !string.IsNullOrEmpty(_ProgressPath))
CreateProgressDirectory(_ProgressPath, _Logistics, _Hyphens, exceptionLines: null);
CreateProgressDirectory(exceptionLines: null);
}
if (!_IsEAFHosted)
{
@ -524,10 +515,10 @@ namespace Adaptation.Shared
to = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
foreach (KeyValuePair<string, string> keyValuePair in _FileParameter)
to = to.Replace(string.Concat('%', keyValuePair.Key, '%'), keyValuePair.Value);
if (to.Contains("%"))
if (to.Contains('%'))
_Log.Debug("Can't debug without EAF Hosting");
else
Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null);
_ = Move(extractResults, to, _FileConnectorConfiguration.SourceFileLocation, resolvedFileLocation: string.Empty, exception: null);
}
}
@ -592,7 +583,7 @@ namespace Adaptation.Shared
return results;
}
protected Dictionary<Test, List<Properties.IDescription>> GetKeyValuePairs(List<Properties.IDescription> descriptions)
protected static Dictionary<Test, List<Properties.IDescription>> GetKeyValuePairs(List<Properties.IDescription> descriptions)
{
Dictionary<Test, List<Properties.IDescription>> results = new();
Test testKey;
@ -606,7 +597,7 @@ namespace Adaptation.Shared
return results;
}
protected List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
protected static List<Properties.IDescription> GetDuplicatorDescriptions(JsonElement[] jsonElements)
{
List<Properties.IDescription> results = new();
Duplicator.Description description;
@ -621,7 +612,7 @@ namespace Adaptation.Shared
return results;
}
protected Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> GetTuple(IFileRead fileRead, IEnumerable<Properties.IDescription> descriptions, bool extra = false)
protected static Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> GetTuple(IFileRead fileRead, IEnumerable<Properties.IDescription> descriptions, bool extra = false)
{
Tuple<Test[], Dictionary<Test, List<Properties.IDescription>>> result;
Dictionary<Test, List<Properties.IDescription>> keyValuePairs = GetKeyValuePairs(descriptions.ToList());
@ -634,14 +625,14 @@ namespace Adaptation.Shared
protected void Shared0449(string to, string[] exceptionLines)
{
if (_IsDuplicator)
CreateProgressDirectory(_ProgressPath, _Logistics, _Hyphens, exceptionLines);
CreateProgressDirectory(exceptionLines: null);
else
{
string fileName = string.Concat(to, @"\readme.txt");
try
{
if (!Directory.Exists(to))
Directory.CreateDirectory(to);
_ = Directory.CreateDirectory(to);
File.WriteAllLines(fileName, exceptionLines);
}
catch (Exception ex) { _Log.Error(ex.Message); }
@ -660,7 +651,7 @@ namespace Adaptation.Shared
processingModeEnum = _FileConnectorConfiguration.ErrorPostProcessingMode.Value;
if (processingModeEnum != FileConnectorConfiguration.PostProcessingModeEnum.Delete && !Directory.Exists(itemDirectory))
{
Directory.CreateDirectory(itemDirectory);
_ = Directory.CreateDirectory(itemDirectory);
FileInfo fileInfo = new(_Logistics.ReportFullPath);
Directory.SetCreationTime(itemDirectory, fileInfo.LastWriteTime);
}
@ -694,14 +685,14 @@ namespace Adaptation.Shared
string weekDirectory = string.Concat(_Logistics.DateTimeFromSequence.ToString("yyyy"), "_Week_", weekOfYear, @"\", _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd"));
string destinationDirectory = string.Concat(jobIdDirectory, @"\_ Ignore 100 bytes\", weekDirectory, @"\", directoryName);
if (!Directory.Exists(destinationDirectory))
Directory.CreateDirectory(destinationDirectory);
_ = Directory.CreateDirectory(destinationDirectory);
File.Move(sourceFile.FullName, string.Concat(destinationDirectory, @"\", sourceFile.Name));
try
{
string[] checkDirectories = Directory.GetDirectories(jobIdDirectory, "*", SearchOption.TopDirectoryOnly);
foreach (string checkDirectory in checkDirectories)
{
if (!checkDirectory.Contains("_"))
if (!checkDirectory.Contains('_'))
continue;
if (Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly).Any())
continue;
@ -748,7 +739,7 @@ namespace Adaptation.Shared
}
}
protected void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory)
protected static void Shared0607(string reportFullPath, string duplicateDirectory, string logisticsSequence, string destinationDirectory)
{
if (destinationDirectory == duplicateDirectory)
throw new Exception("Check Target File Folder for %LotIDWithLogisticsSequence%_in process on CI (not Duplicator)");
@ -763,16 +754,6 @@ namespace Adaptation.Shared
File.Delete(reportFullPath);
}
protected void Shared0192()
{
if (!string.IsNullOrEmpty(_Logistics.ReportFullPath))
{
FileInfo fileInfo = new(_Logistics.ReportFullPath);
if (fileInfo.Exists && fileInfo.LastWriteTime < fileInfo.CreationTime)
File.SetLastWriteTime(_Logistics.ReportFullPath, fileInfo.CreationTime);
}
}
protected string[] Shared1567(string reportFullPath, List<Tuple<Properties.IScopeInfo, string>> tuples)
{
string[] results;
@ -780,7 +761,7 @@ namespace Adaptation.Shared
string logisticsSequence = _Logistics.Sequence.ToString();
string jobIdDirectory = string.Concat(Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation)), @"\", _Logistics.JobID);
if (!Directory.Exists(jobIdDirectory))
Directory.CreateDirectory(jobIdDirectory);
_ = Directory.CreateDirectory(jobIdDirectory);
string[] matchDirectories;
if (!_IsEAFHosted)
matchDirectories = new string[] { Path.GetDirectoryName(Path.GetDirectoryName(reportFullPath)) };
@ -791,7 +772,7 @@ namespace Adaptation.Shared
string fileName = Path.GetFileNameWithoutExtension(reportFullPath);
string sequenceDirectory = string.Concat(matchDirectories[0], @"\", logisticsSequence);
if (!Directory.Exists(sequenceDirectory))
Directory.CreateDirectory(sequenceDirectory);
_ = Directory.CreateDirectory(sequenceDirectory);
foreach (Tuple<Properties.IScopeInfo, string> tuple in tuples)
{
fileName = string.Concat(sequenceDirectory, @"\", fileName, "_", tuple.Item1.FileNameWithoutExtension, ".pdsfc");
@ -816,19 +797,17 @@ namespace Adaptation.Shared
string ecCharacterizationSi = Path.GetDirectoryName(Path.GetDirectoryName(jobIdDirectory));
string destinationJobIdDirectory = string.Concat(ecCharacterizationSi, @"\Processed\", _Logistics.JobID);
if (!Directory.Exists(destinationJobIdDirectory))
Directory.CreateDirectory(destinationJobIdDirectory);
_ = Directory.CreateDirectory(destinationJobIdDirectory);
destinationJobIdDirectory = string.Concat(destinationJobIdDirectory, @"\", Path.GetFileName(destinationDirectory).Split(new string[] { logisticsSequence }, StringSplitOptions.None)[0], _Logistics.DateTimeFromSequence.ToString("yyyy-MM-dd_hh;mm_tt_"), DateTime.Now.Ticks - _Logistics.Sequence);
string sequenceDirectory = string.Concat(destinationJobIdDirectory, @"\", logisticsSequence);
string jsonFileName = string.Concat(sequenceDirectory, @"\", Path.GetFileNameWithoutExtension(reportFullPath), ".json");
Directory.Move(destinationDirectory, destinationJobIdDirectory);
if (!Directory.Exists(sequenceDirectory))
Directory.CreateDirectory(sequenceDirectory);
_ = Directory.CreateDirectory(sequenceDirectory);
File.Copy(reportFullPath, string.Concat(sequenceDirectory, @"\", Path.GetFileName(reportFullPath)), overwrite: true);
File.WriteAllText(jsonFileName, json);
}
}
}
// 2021-12-17 -> Shared - FileRead
// 2022-02-14 -> Shared - FileRead

View File

@ -1,11 +1,10 @@
using Adaptation.Shared.Methods;
using Adaptation.Shared.Methods;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public class Logistics : ILogistics
{
@ -166,7 +165,7 @@ namespace Adaptation.Shared
Logistics2 logistics2;
Tags = new List<string>();
Logistics2 = new List<Logistics2>();
for (int i = 1; i < Logistics1.Count(); i++)
for (int i = 1; i < Logistics1.Count; i++)
{
if (Logistics1[i].StartsWith("LOGISTICS_2"))
{
@ -174,32 +173,20 @@ namespace Adaptation.Shared
Logistics2.Add(logistics2);
}
}
for (int i = Logistics1.Count() - 1; i > -1; i--)
for (int i = Logistics1.Count - 1; i > -1; i--)
{
if (Logistics1[i].StartsWith("LOGISTICS_2"))
Logistics1.RemoveAt(i);
}
}
public Logistics ShallowCopy()
{
return (Logistics)MemberwiseClone();
}
public Logistics ShallowCopy() => (Logistics)MemberwiseClone();
private string DefaultMesEntity(DateTime dateTime)
{
return string.Concat(dateTime.Ticks, "_MES_ENTITY");
}
private static string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal string GetLotViaMostCommonMethod()
{
return MID.Substring(0, MID.Length - 2);
}
internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2);
internal string GetPocketNumberViaMostCommonMethod()
{
return MID.Substring(MID.Length - 2);
}
internal string GetPocketNumberViaMostCommonMethod() => MID.Substring(MID.Length - 2);
internal void Update(string dateTime, string processJobID, string mid)
{
@ -219,5 +206,3 @@ namespace Adaptation.Shared
Logistics2 = new List<Logistics2>();
}
}
}

View File

@ -1,7 +1,6 @@
using System;
using System;
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public class Logistics2 : Methods.ILogistics2
{
@ -77,5 +76,3 @@ namespace Adaptation.Shared
}
}
}

View File

@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json;
namespace Adaptation.Shared.Methods
{
namespace Adaptation.Shared.Methods;
public interface IDescription
{
@ -21,5 +20,3 @@ namespace Adaptation.Shared.Methods
List<IDescription> GetDescriptions(IFileRead fileRead, Logistics logistics, List<Test> tests, IProcessData iProcessData);
}
}

View File

@ -3,12 +3,11 @@ using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace Adaptation.Shared.Methods
{
namespace Adaptation.Shared.Methods;
public interface IFileRead : Properties.IFileRead
{
void MoveArchive();
void WaitForThread();
JsonProperty[] GetDefault();
void Callback(object state);
@ -21,6 +20,5 @@ namespace Adaptation.Shared.Methods
void Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception = null);
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
string[] Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, string to, string from, string resolvedFileLocation, Exception exception);
}
}

View File

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

View File

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

View File

@ -3,8 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text.Json;
namespace Adaptation.Shared.Methods
{
namespace Adaptation.Shared.Methods;
public interface IProcessData : Properties.IProcessData
{
@ -13,5 +12,3 @@ namespace Adaptation.Shared.Methods
Tuple<string, Test[], JsonElement[], List<FileInfo>> GetResults(IFileRead fileRead, Logistics logistics, List<FileInfo> fileInfoCollection);
}
}

View File

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

View File

@ -1,8 +1,7 @@
using System;
using System.IO;
namespace Adaptation.Shared.Metrology
{
namespace Adaptation.Shared.Metrology;
public class ScopeInfo : Properties.IScopeInfo
{
@ -296,11 +295,6 @@ namespace Adaptation.Shared.Metrology
FileName = string.Concat(FileNameWithoutExtension, ".txt");
}
public ScopeInfo ShallowCopy()
{
return (ScopeInfo)MemberwiseClone();
}
}
public ScopeInfo ShallowCopy() => (ScopeInfo)MemberwiseClone();
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared.Metrology
{
namespace Adaptation.Shared.Metrology;
public partial class WS
{
@ -20,5 +19,3 @@
}
}
}

View File

@ -1,8 +1,7 @@
using System.Collections.Generic;
using System.Text.Json;
namespace Adaptation.Shared.Metrology
{
namespace Adaptation.Shared.Metrology;
public partial class WS
{
@ -22,12 +21,7 @@ namespace Adaptation.Shared.Metrology
public List<string> Warnings { get; set; }
// this is just a helper function to make displaying the results easier
public override string ToString()
{
return JsonSerializer.Serialize(this, GetType());
}
}
public override string ToString() => JsonSerializer.Serialize(this, GetType());
}
}

View File

@ -4,25 +4,24 @@ using System.Net.Http;
using System.Text;
using System.Text.Json;
namespace Adaptation.Shared.Metrology
{
namespace Adaptation.Shared.Metrology;
public partial class WS
{
public static Tuple<string, Results> SendData(string url, object payload, int timeoutSeconds = 120)
{
Results results = new Results();
Results results = new();
string resultsJson = string.Empty;
try
{
string json = JsonSerializer.Serialize(payload, payload.GetType());
if (string.IsNullOrEmpty(url) || !url.Contains(":") || !url.Contains("."))
throw new Exception("Invalid URL");
using (HttpClient httpClient = new HttpClient())
using (HttpClient httpClient = new())
{
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
HttpRequestMessage httpRequestMessage = new HttpRequestMessage
HttpRequestMessage httpRequestMessage = new()
{
RequestUri = new Uri(url),
Method = HttpMethod.Post,
@ -38,10 +37,10 @@ namespace Adaptation.Shared.Metrology
catch (Exception e)
{
Exception exception = e;
StringBuilder stringBuilder = new StringBuilder();
while (!(exception is null))
StringBuilder stringBuilder = new();
while (exception is not null)
{
stringBuilder.AppendLine(exception.Message);
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
if (results.Errors is null)
@ -62,8 +61,7 @@ namespace Adaptation.Shared.Metrology
// also, this has been made synchronous
public static void AttachFile(string url, long attachToHeaderId, string attachToDataUniqueId, byte[] fileContents, string fileName, int timeoutSeconds = 60)
{
using (HttpClient httpClient = new HttpClient())
{
using HttpClient httpClient = new();
string requestUrl = url + "/attachment?headerid=" + attachToHeaderId.ToString();
if (!string.IsNullOrWhiteSpace(attachToDataUniqueId))
{
@ -75,8 +73,8 @@ namespace Adaptation.Shared.Metrology
httpClient.Timeout = new TimeSpan(0, 0, 0, timeoutSeconds, 0);
MultipartFormDataContent multipartFormDataContent = new MultipartFormDataContent();
ByteArrayContent byteArrayContent = new ByteArrayContent(fileContents);
MultipartFormDataContent multipartFormDataContent = new();
ByteArrayContent byteArrayContent = new(fileContents);
byteArrayContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
multipartFormDataContent.Add(byteArrayContent, "attachment", fileName);
@ -90,18 +88,17 @@ namespace Adaptation.Shared.Metrology
throw new Exception("Attachment failed: " + resultBody);
}
}
public static void AttachFiles(string url, long headerID, List<Attachment> headerAttachments = null, List<Attachment> dataAttachments = null)
{
try
{
if (!(headerAttachments is null))
if (headerAttachments is not null)
{
foreach (Attachment attachment in headerAttachments)
AttachFile(url, headerID, "", System.IO.File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName);
}
if (!(dataAttachments is null))
if (dataAttachments is not null)
{
foreach (Attachment attachment in dataAttachments)
AttachFile(url, headerID, attachment.UniqueId, System.IO.File.ReadAllBytes(attachment.SourceFileName), attachment.DestinationFileName);
@ -111,10 +108,10 @@ namespace Adaptation.Shared.Metrology
catch (Exception e)
{
Exception exception = e;
StringBuilder stringBuilder = new StringBuilder();
while (!(exception is null))
StringBuilder stringBuilder = new();
while (exception is not null)
{
stringBuilder.AppendLine(exception.Message);
_ = stringBuilder.AppendLine(exception.Message);
exception = exception.InnerException;
}
//MessageBox.Show(msgs.ToString(), "Exception", //MessageBoxButtons.OK, //MessageBoxIcon.Error);
@ -123,5 +120,3 @@ namespace Adaptation.Shared.Metrology
}
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public enum ParameterType
{
@ -9,5 +8,3 @@ namespace Adaptation.Shared
Boolean = 4,
StructuredType = 5
}
}

View File

@ -7,8 +7,7 @@ using System.Linq;
using System.Text;
using System.Text.Json;
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public class ProcessDataStandardFormat
{
@ -38,29 +37,29 @@ namespace Adaptation.Shared
string format = "MM/dd/yyyy HH:mm:ss";
StringBuilder stringBuilder = new();
lines = new string[] { "HEADER_TAG\tHEADER_VALUE", "FORMAT\t2.00", "NUMBER_PASSES\t0001", string.Concat("HEADER_OFFSET\t", headerOffset), string.Concat("DATA_OFFSET\t", dataOffset), string.Concat("END_OFFSET\t", endOffset) }.ToList();
stringBuilder.Append("\"Time\"").Append('\t');
stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
_ = stringBuilder.Append("\"Time\"").Append('\t');
_ = stringBuilder.Append("\"A_LOGISTICS\"").Append('\t');
_ = stringBuilder.Append("\"B_LOGISTICS\"").Append('\t');
for (int i = 0; i < jsonElements.Length;)
{
foreach (JsonProperty jsonProperty in jsonElements[0].EnumerateObject())
{
columns += 1;
stringBuilder.Append("\"").Append(jsonProperty.Name).Append("\"").Append('\t');
_ = stringBuilder.Append('"').Append(jsonProperty.Name).Append('"').Append('\t');
}
break;
}
stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
lines.Add(stringBuilder.ToString());
for (int i = 0; i < jsonElements.Length; i++)
{
stringBuilder.Clear();
stringBuilder.Append("0.1").Append('\t');
stringBuilder.Append("1").Append('\t');
stringBuilder.Append("2").Append('\t');
_ = stringBuilder.Clear();
_ = stringBuilder.Append("0.1").Append('\t');
_ = stringBuilder.Append('1').Append('\t');
_ = stringBuilder.Append('2').Append('\t');
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
stringBuilder.Append(jsonProperty.Value).Append('\t');
stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.Append(jsonProperty.Value).Append('\t');
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
lines.Add(stringBuilder.ToString());
}
lines.Add(string.Concat("NUM_DATA_ROWS ", jsonElements.Length.ToString().PadLeft(9, '0')));
@ -78,9 +77,9 @@ namespace Adaptation.Shared
lines.Add(string.Concat("LOGISTICS_2", '\t', "B_CHAMBER=;B_INFO=", fileRead.EventName, ";B_INFO2=", fileRead.EquipmentType, ";B_JOBID=", fileRead.CellInstanceName, ";B_MES_ENTITY=", fileRead.MesEntity, ";B_MID=", logistics.MID, ";B_NULL_DATA=", fileRead.NullData, ";B_PPID=NO_PPID;B_PROCESS_JOBID=", logistics.ProcessJobID, ";B_PRODUCT=;B_SEQUENCE=", logistics.Sequence, ";B_WAFER_ID=;"));
lines.Add("END_HEADER");
}
stringBuilder.Clear();
_ = stringBuilder.Clear();
foreach (string line in lines)
stringBuilder.AppendLine(line);
_ = stringBuilder.AppendLine(line);
result = stringBuilder.ToString();
result = result.Replace(headerOffset, result.IndexOf("NUM_DATA_ROWS").ToString().PadLeft(9, '0')).
Replace(dataOffset, result.IndexOf('"').ToString().PadLeft(9, '0')).
@ -98,7 +97,7 @@ namespace Adaptation.Shared
lines = File.ReadAllLines(reportFullPath);
string[] segments;
if (lines.Length < 7)
segments = new string[] { };
segments = Array.Empty<string>();
else
segments = lines[6].Trim().Split('\t');
List<string> columns = new();
@ -121,7 +120,7 @@ namespace Adaptation.Shared
}
}
bool lookForLogistics = false;
for (int r = 7; r < lines.Count(); r++)
for (int r = 7; r < lines.Length; r++)
{
if (lines[r].StartsWith("NUM_DATA_ROWS"))
lookForLogistics = true;
@ -132,11 +131,11 @@ namespace Adaptation.Shared
}
if (lines[r].StartsWith("LOGISTICS_1"))
{
for (int i = r; i < lines.Count(); i++)
for (int i = r; i < lines.Length; i++)
{
if (lines[r].StartsWith("END_HEADER"))
break;
logistics.AppendLine(lines[i]);
_ = logistics.AppendLine(lines[i]);
}
break;
}
@ -159,14 +158,14 @@ namespace Adaptation.Shared
StringBuilder stringBuilder = new();
foreach (string bodyLine in bodyLines)
{
stringBuilder.Append('{');
_ = stringBuilder.Append('{');
segments = bodyLine.Trim().Split('\t');
if (!lookForNumbers)
{
for (int c = 1; c < segments.Length; c++)
{
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
}
}
else
@ -175,17 +174,17 @@ namespace Adaptation.Shared
{
value = segments[c].Replace("\"", "\\\"").Replace("\\", "\\\\");
if (string.IsNullOrEmpty(value))
stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,");
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append("null,");
else if (value.All(char.IsDigit))
stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(",");
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":").Append(value).Append(',');
else
stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
_ = stringBuilder.Append('"').Append(columns[c]).Append("\":\"").Append(value).Append("\",");
}
}
stringBuilder.Remove(stringBuilder.Length - 1, 1);
stringBuilder.AppendLine("},");
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.AppendLine("},");
}
stringBuilder.Remove(stringBuilder.Length - 3, 3);
_ = stringBuilder.Remove(stringBuilder.Length - 3, 3);
results = JsonSerializer.Deserialize<JsonElement[]>(string.Concat("[", stringBuilder, "]"));
}
return results;
@ -268,25 +267,13 @@ namespace Adaptation.Shared
return string.Concat(((int)searchFor).ToString().PadLeft(2, '0'), separator, searchFor.ToString().Replace("In", string.Concat(separator, "In")).Replace("Ex", string.Concat(separator, "Ex")));
}
public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ')
{
return GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
}
public static string EquipmentIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.EquipmentIntegration, addSpaces, separator);
public static string BusinessIntegration(bool addSpaces = true, char separator = ' ')
{
return GetString(SearchFor.BusinessIntegration, addSpaces, separator);
}
public static string BusinessIntegration(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.BusinessIntegration, addSpaces, separator);
public static string SystemExport(bool addSpaces = true, char separator = ' ')
{
return GetString(SearchFor.SystemExport, addSpaces, separator);
}
public static string SystemExport(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.SystemExport, addSpaces, separator);
public static string Archive(bool addSpaces = true, char separator = ' ')
{
return GetString(SearchFor.Archive, addSpaces, separator);
}
public static string Archive(bool addSpaces = true, char separator = ' ') => GetString(SearchFor.Archive, addSpaces, separator);
public static string GetLines(Logistics logistics, Properties.IScopeInfo scopeInfo, List<string> names, Dictionary<string, List<string>> keyValuePairs, string dateFormat, string timeFormat, List<string> pairedParameterNames, bool useDateTimeFromSequence = true, string format = "", List<string> ignoreParameterNames = null)
{
@ -301,7 +288,7 @@ namespace Adaptation.Shared
const string columnDate = "Date";
const string columnTime = "Time";
const string firstDuplicate = "_1";
result.AppendLine(scopeInfo.Header);
_ = result.AppendLine(scopeInfo.Header);
StringBuilder line = new();
if (logistics.NullData is null)
nullData = string.Empty;
@ -310,8 +297,8 @@ namespace Adaptation.Shared
int count = (from l in keyValuePairs select l.Value.Count).Min();
for (int r = 0; r < count; r++)
{
line.Clear();
line.Append("!");
_ = line.Clear();
_ = line.Append('!');
foreach (KeyValuePair<string, List<string>> keyValuePair in keyValuePairs)
{
if (!names.Contains(keyValuePair.Key))
@ -323,29 +310,29 @@ namespace Adaptation.Shared
if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
continue;
else
result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
_ = result.Append(line).Append(keyValuePair.Key).Append(';').AppendLine(keyValuePair.Value[r]);
}
else
{
if (useDateTimeFromSequence && keyValuePair.Key == columnDate)
line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
_ = line.Append(logistics.DateTimeFromSequence.ToString(dateFormat));
else if (useDateTimeFromSequence && keyValuePair.Key == columnTime)
line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
_ = line.Append(logistics.DateTimeFromSequence.ToString(timeFormat));
else if (!useDateTimeFromSequence && keyValuePair.Key == columnDate && keyValuePair.Value[r].Length == format.Length)
line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
_ = line.Append(DateTime.ParseExact(keyValuePair.Value[r], format, CultureInfo.InvariantCulture).ToString(dateFormat));
else if (!useDateTimeFromSequence && keyValuePair.Key == columnTime && keyValuePairs.ContainsKey(string.Concat(keyValuePair.Key, firstDuplicate)) && keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r].Length == format.Length)
line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
_ = line.Append(DateTime.ParseExact(keyValuePairs[string.Concat(keyValuePair.Key, firstDuplicate)][r], format, CultureInfo.InvariantCulture).ToString(timeFormat));
else if (string.IsNullOrEmpty(keyValuePair.Value[r]) || keyValuePair.Value[r] == nullData)
line.Append(nullData);
_ = line.Append(nullData);
else
line.Append(keyValuePair.Value[r]);
line.Append(';');
_ = line.Append(keyValuePair.Value[r]);
_ = line.Append(';');
}
}
if (!pairedParameterNames.Any())
{
line.Remove(line.Length - 1, 1);
result.AppendLine(line.ToString());
_ = line.Remove(line.Length - 1, 1);
_ = result.AppendLine(line.ToString());
}
}
return result.ToString();
@ -401,19 +388,19 @@ namespace Adaptation.Shared
vs[s] = segments[s].Length;
}
}
stringBuilder.Clear();
_ = stringBuilder.Clear();
for (int s = 0; s < segments.Length; s++)
stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator);
stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.Append((s + 1).ToString().PadLeft(vs[s], ' ')).Append(outputSeperator);
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
for (int i = group[0]; i <= group[1]; i++)
{
line = lines[i];
stringBuilder.Clear();
_ = stringBuilder.Clear();
segments = line.Split(inputSeperator);
for (int s = 0; s < segments.Length; s++)
stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator);
stringBuilder.Remove(stringBuilder.Length - 1, 1);
_ = stringBuilder.Append(segments[s].PadLeft(vs[s], ' ')).Append(outputSeperator);
_ = stringBuilder.Remove(stringBuilder.Length - 1, 1);
results.Add(stringBuilder.ToString());
}
results.Add(string.Empty);
@ -422,5 +409,3 @@ namespace Adaptation.Shared
}
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface IDescription
{
@ -9,5 +8,3 @@ namespace Adaptation.Shared.Properties
int Index { get; }
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface IFileRead
{
@ -16,5 +15,3 @@ namespace Adaptation.Shared.Properties
string CellInstanceConnectionName { get; }
string ParameterizedModelObjectDefinitionType { get; }
}
}

View File

@ -1,8 +1,7 @@
using System;
using System.Collections.Generic;
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface ILogistics
{
@ -21,5 +20,3 @@ namespace Adaptation.Shared.Properties
public List<Logistics2> Logistics2 { get; set; }
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface ILogistics2
{
@ -13,5 +12,3 @@ namespace Adaptation.Shared.Properties
public string Recipe { get; }
}
}

View File

@ -1,7 +1,6 @@
using System.Collections.Generic;
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface IProcessData
{
@ -9,5 +8,3 @@ namespace Adaptation.Shared.Properties
List<object> Details { get; }
}
}

View File

@ -1,7 +1,6 @@
using System;
namespace Adaptation.Shared.Properties
{
namespace Adaptation.Shared.Properties;
public interface IScopeInfo
{
@ -16,5 +15,3 @@ namespace Adaptation.Shared.Properties
string FileNameWithoutExtension { get; }
}
}

View File

@ -1,5 +1,4 @@
namespace Adaptation.Shared
{
namespace Adaptation.Shared;
public enum Test
{
@ -21,15 +20,20 @@ namespace Adaptation.Shared
DailyRPMXY = 18,
Denton = 9,
DiffusionLength = 45,
GRATXTCenter = 51,
GRATXTEdge = 52, //Largest
GrowthRateXML = 50,
Hall = 10,
HgCV = 23,
JVXRD = 47,
Lehighton = 13,
LogbookCAC = 49,
Microscope = 46,
MonthlyCV = 4,
MonthlyHall = 11,
MonthlyXRD = 32,
Photoreflectance = 22,
PlatoA = 48, //Largest
PlatoA = 48,
RPMAverage = 16,
RPMPLRatio = 17,
RPMXY = 15,
@ -50,8 +54,5 @@ namespace Adaptation.Shared
WeeklyXRDSLStks = 43,
WeeklyXRDXRR = 44,
XRDWeightedAverage = 31,
JVXRD = 47,
XRDXY = 30
}
XRDXY = 30,
}

View File

@ -7,19 +7,16 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass]
public class BIORAD2 : EAFLoggingUnitTesting
{
private static BIORAD2 _EAFLoggingUnitTesting;
internal static BIORAD2 EAFLoggingUnitTesting => _EAFLoggingUnitTesting;
internal static BIORAD2 EAFLoggingUnitTesting { get; private set; }
public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (_EAFLoggingUnitTesting is null)
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
@ -30,10 +27,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (_EAFLoggingUnitTesting is null)
_EAFLoggingUnitTesting = new BIORAD2(testContext);
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = _EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new BIORAD2(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
@ -41,10 +38,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassCleanup()]
public static void ClassCleanup()
{
if (!(_EAFLoggingUnitTesting.Logger is null))
_EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (!(_EAFLoggingUnitTesting is null))
_EAFLoggingUnitTesting.Dispose();
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
@ -52,15 +49,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -7,19 +7,16 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass]
public class BIORAD3 : EAFLoggingUnitTesting
{
private static BIORAD3 _EAFLoggingUnitTesting;
internal static BIORAD3 EAFLoggingUnitTesting => _EAFLoggingUnitTesting;
internal static BIORAD3 EAFLoggingUnitTesting { get; private set; }
public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (_EAFLoggingUnitTesting is null)
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
@ -30,10 +27,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (_EAFLoggingUnitTesting is null)
_EAFLoggingUnitTesting = new BIORAD3(testContext);
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = _EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new BIORAD3(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
@ -41,10 +38,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassCleanup()]
public static void ClassCleanup()
{
if (!(_EAFLoggingUnitTesting.Logger is null))
_EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (!(_EAFLoggingUnitTesting is null))
_EAFLoggingUnitTesting.Dispose();
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
@ -52,15 +49,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -7,19 +7,16 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
namespace _Tests.CreateSelfDescription.Staging.v2_36_3;
[TestClass]
public class MET08THFTIRQS408M : EAFLoggingUnitTesting
{
private static MET08THFTIRQS408M _EAFLoggingUnitTesting;
internal static MET08THFTIRQS408M EAFLoggingUnitTesting => _EAFLoggingUnitTesting;
internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; }
public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (_EAFLoggingUnitTesting is null)
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
@ -30,10 +27,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (_EAFLoggingUnitTesting is null)
_EAFLoggingUnitTesting = new MET08THFTIRQS408M(testContext);
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = _EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new MET08THFTIRQS408M(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
@ -41,10 +38,10 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
[ClassCleanup()]
public static void ClassCleanup()
{
if (!(_EAFLoggingUnitTesting.Logger is null))
_EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (!(_EAFLoggingUnitTesting is null))
_EAFLoggingUnitTesting.Dispose();
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
@ -52,13 +49,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToOpenInsightMetrologyViewer";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -66,13 +63,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToIQSSi";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -80,13 +77,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToOpenInsight";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -94,13 +91,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToOpenInsightMetrologyViewerAttachments";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -108,13 +105,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToAPC";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -122,13 +119,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToSPaCe";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -136,13 +133,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsXToArchive";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -150,13 +147,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsArchive";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
@ -164,15 +161,13 @@ namespace _Tests.CreateSelfDescription.Staging.v2_36_3
{
string check = "~IsDummy";
MethodBase methodBase = new StackFrame().GetMethod();
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -0,0 +1,61 @@
using Adaptation.Shared.Methods;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shared;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass]
public class BIORAD2 : EAFLoggingUnitTesting
{
internal static BIORAD2 EAFLoggingUnitTesting { get; private set; }
public BIORAD2() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BIORAD2(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new BIORAD2(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
public void Staging__v2_39_0__BIORAD2__QS408M()
{
string check = "*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -0,0 +1,61 @@
using Adaptation.Shared.Methods;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shared;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass]
public class BIORAD3 : EAFLoggingUnitTesting
{
internal static BIORAD3 EAFLoggingUnitTesting { get; private set; }
public BIORAD3() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public BIORAD3(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new BIORAD3(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
public void Staging__v2_39_0__BIORAD3__QS408M()
{
string check = "*.txt";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -0,0 +1,173 @@
using Adaptation.Shared.Methods;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shared;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
namespace _Tests.CreateSelfDescription.Staging.v2_39_0;
[TestClass]
public class MET08THFTIRQS408M : EAFLoggingUnitTesting
{
internal static MET08THFTIRQS408M EAFLoggingUnitTesting { get; private set; }
public MET08THFTIRQS408M() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
{
if (EAFLoggingUnitTesting is null)
throw new Exception();
}
public MET08THFTIRQS408M(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
{
}
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
if (EAFLoggingUnitTesting is null)
EAFLoggingUnitTesting = new MET08THFTIRQS408M(testContext);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
}
[ClassCleanup()]
public static void ClassCleanup()
{
if (EAFLoggingUnitTesting.Logger is not null)
EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
if (EAFLoggingUnitTesting is not null)
EAFLoggingUnitTesting.Dispose();
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M()
{
string check = "~IsXToOpenInsightMetrologyViewer";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_()
{
string check = "~IsXToIQSSi";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M__()
{
string check = "~IsXToOpenInsight";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M___()
{
string check = "~IsXToOpenInsightMetrologyViewerAttachments";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M____()
{
string check = "~IsXToAPC";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_____()
{
string check = "~IsXToSPaCe";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M______()
{
string check = "~IsXToArchive";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_______()
{
string check = "~IsArchive";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M________()
{
string check = "~IsDummy";
MethodBase methodBase = new StackFrame().GetMethod();
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
Assert.IsTrue(fileNameAndJson[1].Contains(check));
File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
}
}

View File

@ -1,7 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace _Tests.Extract.Staging.v2_36_3
{
namespace _Tests.Extract.Staging.v2_36_3;
[TestClass]
public class BIORAD2
@ -17,12 +16,7 @@ namespace _Tests.Extract.Staging.v2_36_3
}
[TestMethod]
public void Staging__v2_36_3__BIORAD2__QS408M()
{
_BIORAD2.Staging__v2_36_3__BIORAD2__QS408M();
}
}
public void Staging__v2_36_3__BIORAD2__QS408M() => _BIORAD2.Staging__v2_36_3__BIORAD2__QS408M();
}

View File

@ -8,8 +8,7 @@ using System.IO;
using System.Reflection;
using System.Text.Json;
namespace _Tests.Extract.Staging.v2_36_3
{
namespace _Tests.Extract.Staging.v2_36_3;
[TestClass]
public class BIORAD3
@ -25,10 +24,7 @@ namespace _Tests.Extract.Staging.v2_36_3
}
[TestMethod]
public void Staging__v2_36_3__BIORAD3__QS408M()
{
_BIORAD3.Staging__v2_36_3__BIORAD3__QS408M();
}
public void Staging__v2_36_3__BIORAD3__QS408M() => _BIORAD3.Staging__v2_36_3__BIORAD3__QS408M();
[TestMethod]
public void Staging__v2_36_3__BIORAD3__QS408M637406016892454000__ReactorAndRDS()
@ -44,7 +40,7 @@ namespace _Tests.Extract.Staging.v2_36_3
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!");
Assert.IsNotNull(extractResult.Item4);
Logistics logistics = new Logistics(fileRead);
Logistics logistics = new(fileRead);
dateTime = Adaptation.FileHandlers.QS408M.ProcessData.GetDateTime(logistics, string.Empty);
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
dateTime = Adaptation.FileHandlers.QS408M.ProcessData.GetDateTime(logistics, "Tue Nov 10 12:03:56 1970");
@ -62,8 +58,6 @@ namespace _Tests.Extract.Staging.v2_36_3
}
}
// dotnet build --runtime win-x64
// dotnet test --runtime win-x64 --no-build --filter "FullyQualifiedName~_Tests.Extract.Staging.v2_36_3" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")
// dotnet test --runtime win-x64 --no-build --filter "FullyQualifiedName~_Tests.Extract.Staging.v2_36_3 & ClassName~BIORAD3" --% -- TestRunParameters.Parameter(name=\"Debug\", value=\"Debugger.IsAttached\")

View File

@ -1,7 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace _Tests.Extract.Staging.v2_36_3
{
namespace _Tests.Extract.Staging.v2_36_3;
[TestClass]
public class MET08THFTIRQS408M
@ -17,60 +16,31 @@ namespace _Tests.Extract.Staging.v2_36_3
}
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M__()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M__();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M__() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M__();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M___()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M___();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M___() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M___();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M____()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M____();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M____() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M____();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_____()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_____();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_____() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_____();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M______()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M______();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M______() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M______();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_______()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_______();
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_______() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M_______();
[TestMethod]
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M________()
{
_MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M________();
}
}
public void Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M________() => _MET08THFTIRQS408M.Staging__v2_36_3__MET08THFTIRQS408M__MET08THFTIRQS408M________();
}

View File

@ -0,0 +1,21 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace _Tests.Extract.Staging.v2_39_0;
[TestClass]
public class BIORAD2
{
private static CreateSelfDescription.Staging.v2_39_0.BIORAD2 _BIORAD2;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Staging.v2_39_0.BIORAD2.ClassInitialize(testContext);
_BIORAD2 = CreateSelfDescription.Staging.v2_39_0.BIORAD2.EAFLoggingUnitTesting;
}
[TestMethod]
public void Staging__v2_39_0__BIORAD2__QS408M() => _BIORAD2.Staging__v2_39_0__BIORAD2__QS408M();
}

View File

@ -0,0 +1,59 @@
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.Json;
namespace _Tests.Extract.Staging.v2_39_0;
[TestClass]
public class BIORAD3
{
private static CreateSelfDescription.Staging.v2_39_0.BIORAD3 _BIORAD3;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Staging.v2_39_0.BIORAD3.ClassInitialize(testContext);
_BIORAD3 = CreateSelfDescription.Staging.v2_39_0.BIORAD3.EAFLoggingUnitTesting;
}
[TestMethod]
public void Staging__v2_39_0__BIORAD3__QS408M() => _BIORAD3.Staging__v2_39_0__BIORAD3__QS408M();
[TestMethod]
public void Staging__v2_39_0__BIORAD3__QS408M637406016892454000__ReactorAndRDS()
{
DateTime dateTime;
string check = "*.txt";
_BIORAD3.Staging__v2_39_0__BIORAD3__QS408M();
MethodBase methodBase = new StackFrame().GetMethod();
string[] variables = _BIORAD3.AdaptationTesting.GetVariables(methodBase, check);
Tuple<string, string[], string[]> pdsf = Helpers.Metrology.GetLogisticsColumnsAndBody(variables[2], variables[4]);
IFileRead fileRead = _BIORAD3.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResult = fileRead.ReExtract();
Assert.IsFalse(string.IsNullOrEmpty(extractResult?.Item1));
Assert.IsTrue(extractResult.Item3.Length > 0, "extractResult Array Length check!");
Assert.IsNotNull(extractResult.Item4);
Logistics logistics = new(fileRead);
dateTime = Adaptation.FileHandlers.QS408M.ProcessData.GetDateTime(logistics, string.Empty);
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
dateTime = Adaptation.FileHandlers.QS408M.ProcessData.GetDateTime(logistics, "Tue Nov 10 12:03:56 1970");
Assert.IsTrue(dateTime == logistics.DateTimeFromSequence);
Tuple<string, string[], string[]> pdsfNew = Helpers.Metrology.GetLogisticsColumnsAndBody(fileRead, logistics, extractResult, pdsf);
Helpers.Metrology.CompareSave(variables[5], pdsf, pdsfNew);
string[] json = Helpers.Metrology.GetItem2(pdsf, pdsfNew);
Helpers.Metrology.CompareSaveJSON(variables[5], json);
Assert.IsTrue(json[0] == json[1], "Item2 check!");
string[] join = Helpers.Metrology.GetItem3(pdsf, pdsfNew);
Helpers.Metrology.CompareSaveTSV(variables[5], join);
Assert.IsTrue(join[0] == join[1], "Item3 (Join) check!");
Helpers.Metrology.UpdatePassDirectory(variables[2]);
}
}

View File

@ -0,0 +1,45 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace _Tests.Extract.Staging.v2_39_0;
[TestClass]
public class MET08THFTIRQS408M
{
private static CreateSelfDescription.Staging.v2_39_0.MET08THFTIRQS408M _MET08THFTIRQS408M;
[ClassInitialize]
public static void ClassInitialize(TestContext testContext)
{
CreateSelfDescription.Staging.v2_39_0.MET08THFTIRQS408M.ClassInitialize(testContext);
_MET08THFTIRQS408M = CreateSelfDescription.Staging.v2_39_0.MET08THFTIRQS408M.EAFLoggingUnitTesting;
}
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M__() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M__();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M___() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M___();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M____() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M____();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_____() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_____();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M______() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M______();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_______() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M_______();
[TestMethod]
public void Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M________() => _MET08THFTIRQS408M.Staging__v2_39_0__MET08THFTIRQS408M__MET08THFTIRQS408M________();
}

View File

@ -9,8 +9,7 @@ using System.Linq;
using System.Reflection;
using System.Text.Json;
namespace _Tests.Helpers
{
namespace _Tests.Helpers;
public class Metrology
{
@ -35,7 +34,7 @@ namespace _Tests.Helpers
string[] pdsfFiles;
pdsfFiles = Directory.GetFiles(searchDirectory, searchPattern, SearchOption.TopDirectoryOnly);
if (!pdsfFiles.Any())
Process.Start("explorer.exe", searchDirectory);
_ = Process.Start("explorer.exe", searchDirectory);
Assert.IsTrue(pdsfFiles.Any(), "GetFiles check");
results = GetLogisticsColumnsAndBody(pdsfFiles[0]);
}
@ -59,7 +58,7 @@ namespace _Tests.Helpers
internal static string[] GetItem2(Tuple<string, string[], string[]> pdsf, Tuple<string, string[], string[]> pdsfNew)
{
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions() { WriteIndented = true };
JsonSerializerOptions jsonSerializerOptions = new() { WriteIndented = true };
string jsonOld = JsonSerializer.Serialize(pdsf.Item2, pdsf.Item2.GetType(), jsonSerializerOptions);
string jsonNew = JsonSerializer.Serialize(pdsfNew.Item2, pdsfNew.Item2.GetType(), jsonSerializerOptions);
return new string[] { jsonOld, jsonNew };
@ -109,7 +108,6 @@ namespace _Tests.Helpers
if (after.Length < ticks.Length)
{
connectionName = after;
connectionNameAndTicks = ticks;
}
else
{
@ -129,7 +127,7 @@ namespace _Tests.Helpers
{
if (join[0] != join[1])
{
Process.Start("explorer.exe", textFileDirectory);
_ = Process.Start("explorer.exe", textFileDirectory);
File.WriteAllText(Path.Combine(textFileDirectory, "0.tsv"), join[0]);
File.WriteAllText(Path.Combine(textFileDirectory, "1.tsv"), join[1]);
}
@ -139,7 +137,7 @@ namespace _Tests.Helpers
{
if (json[0] != json[1])
{
Process.Start("explorer.exe", textFileDirectory);
_ = Process.Start("explorer.exe", textFileDirectory);
File.WriteAllText(Path.Combine(textFileDirectory, "0.json"), json[0]);
File.WriteAllText(Path.Combine(textFileDirectory, "1.json"), json[1]);
}
@ -149,12 +147,10 @@ namespace _Tests.Helpers
{
if (pdsf.Item1 != pdsfNew.Item1)
{
Process.Start("explorer.exe", textFileDirectory);
_ = Process.Start("explorer.exe", textFileDirectory);
File.WriteAllText(Path.Combine(textFileDirectory, "0.dat"), pdsf.Item1);
File.WriteAllText(Path.Combine(textFileDirectory, "1.dat"), pdsfNew.Item1);
}
}
}
}

View File

@ -20,8 +20,7 @@ using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace Shared
{
namespace Shared;
public class AdaptationTesting : ISMTP
{
@ -50,20 +49,11 @@ namespace Shared
public Dictionary<string, string> ParameterizedModelObjectDefinitionTypes => _ParameterizedModelObjectDefinitionTypes;
public Dictionary<string, List<Tuple<string, string>>> EquipmentDictionaryEventDescriptions => _EquipmentDictionaryEventDescriptions;
void ISMTP.SendLowPriorityEmailMessage(string subject, string body)
{
throw new NotImplementedException();
}
void ISMTP.SendLowPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
void ISMTP.SendHighPriorityEmailMessage(string subject, string body)
{
throw new NotImplementedException();
}
void ISMTP.SendHighPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
void ISMTP.SendNormalPriorityEmailMessage(string subject, string body)
{
throw new NotImplementedException();
}
void ISMTP.SendNormalPriorityEmailMessage(string subject, string body) => throw new NotImplementedException();
public AdaptationTesting(TestContext testContext, bool skipEquipmentDictionary)
{
@ -83,13 +73,13 @@ namespace Shared
_EquipmentDictionaryEventDescriptions = new Dictionary<string, List<Tuple<string, string>>>();
}
protected string GetEnvironment(TestContext testContext)
protected static string GetEnvironment(TestContext testContext)
{
string result = testContext.TestName.Split('_')[0];
return result;
}
protected string GetHostNameAndPort(string environment)
protected static string GetHostNameAndPort(string environment)
{
string result;
result = environment switch
@ -127,7 +117,7 @@ namespace Shared
return result;
}
protected string GetCellInstanceConnectionName(string cellInstanceConnectionName)
protected static string GetCellInstanceConnectionName(string cellInstanceConnectionName)
{
string result;
if (string.IsNullOrEmpty(cellInstanceConnectionName) || cellInstanceConnectionName[cellInstanceConnectionName.Length - 1] != '_')
@ -135,8 +125,8 @@ namespace Shared
else
{
bool check = false;
List<char> chars = new List<char>();
StringBuilder stringBuilder = new StringBuilder();
List<char> chars = new();
StringBuilder stringBuilder = new();
for (int i = cellInstanceConnectionName.Length - 1; i > -1; i--)
{
if (!check && cellInstanceConnectionName[i] != '_')
@ -147,7 +137,7 @@ namespace Shared
chars.Add(cellInstanceConnectionName[i]);
}
for (int i = chars.Count - 1; i > -1; i--)
stringBuilder.Append(chars[i]);
_ = stringBuilder.Append(chars[i]);
result = stringBuilder.ToString();
}
return result;
@ -202,7 +192,7 @@ namespace Shared
string after = methodBaseName.Substring(before.Length);
string versionDirectory = Path.Combine(testResultsDirectory, _Environment, cellInstanceName, cellInstanceVersionName);
if (!Directory.Exists(versionDirectory))
Directory.CreateDirectory(versionDirectory);
_ = Directory.CreateDirectory(versionDirectory);
comment = segments[segments.Length - 1];
if (after.Length < ticks.Length || after == comment)
{
@ -223,7 +213,7 @@ namespace Shared
ticks = connectionNameAndTicks.Substring(cellInstanceConnectionNameFromMethodBaseName.Length);
}
}
if (string.IsNullOrEmpty(ticks) || string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || !long.TryParse(ticks, out long _))
if (string.IsNullOrEmpty(ticks) || string.IsNullOrEmpty(cellInstanceConnectionNameFromMethodBaseName) || !long.TryParse(ticks, out _))
{
ticks = string.Empty;
comment = string.Empty;
@ -233,7 +223,7 @@ namespace Shared
string methodBaseNameWithActualCICN = GetMethodBaseNameWithActualCICN(methodBaseName, rawCellInstanceName, cellInstanceConnectionNameFromMethodBaseName, cellInstanceConnectionName, ticks);
if (string.IsNullOrEmpty(ticks))
{
textFiles = new string[] { };
textFiles = Array.Empty<string>();
fileFullName = Path.Combine(versionDirectory, methodBaseNameWithActualCICN, $"{cellInstanceConnectionNameFromMethodBaseName}.json");
}
else
@ -243,10 +233,10 @@ namespace Shared
fileFullName = Path.Combine(versionDirectory, segments[0], $"{cellInstanceConnectionNameFromMethodBaseName}.json");
if (!Directory.Exists(textDirectory))
{
textFiles = new string[] { };
textFiles = Array.Empty<string>();
string renameDirectory = Path.Combine(Path.GetDirectoryName(textDirectory), $"_Rename - {Path.GetFileName(textDirectory)}");
Directory.CreateDirectory(renameDirectory);
Process.Start("explorer.exe", renameDirectory);
_ = Directory.CreateDirectory(renameDirectory);
_ = Process.Start("explorer.exe", renameDirectory);
File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileFilter)}.txt"), string.Empty);
File.WriteAllText(Path.Combine(renameDirectory, $"{nameof(FileConnectorConfiguration.SourceFileLocation)}.txt"), string.Empty);
}
@ -255,7 +245,7 @@ namespace Shared
textFiles = Directory.GetFiles(textDirectory, "*.txt", SearchOption.TopDirectoryOnly);
if (!textFiles.Any())
{
Process.Start("explorer.exe", textDirectory);
_ = Process.Start("explorer.exe", textDirectory);
File.WriteAllText(Path.Combine(textDirectory, "_ Why.why"), string.Empty);
}
}
@ -282,54 +272,27 @@ namespace Shared
return results;
}
internal string GetEnvironment(string[] segments)
{
return segments[0];
}
internal static string GetEnvironment(string[] segments) => segments[0];
internal string GetRawCellInstanceName(string[] segments)
{
return segments[1];
}
internal static string GetRawCellInstanceName(string[] segments) => segments[1];
internal string GetCellInstanceName(string[] segments)
{
return segments[2];
}
internal static string GetCellInstanceName(string[] segments) => segments[2];
internal string GetCellInstanceVersionName(string[] segments)
{
return segments[3];
}
internal static string GetCellInstanceVersionName(string[] segments) => segments[3];
internal string GetCellInstanceConnectionNameFromMethodBaseName(string[] segments)
{
return segments[4];
}
internal static string GetCellInstanceConnectionNameFromMethodBaseName(string[] segments) => segments[4];
internal string GetCellInstanceConnectionName(string[] segments)
{
return segments[5];
}
internal static string GetCellInstanceConnectionName(string[] segments) => segments[5];
internal string GetTicks(string[] segments)
{
return segments[6];
}
internal static string GetTicks(string[] segments) => segments[6];
internal string GetComment(string[] segments)
{
return segments[7];
}
internal static string GetComment(string[] segments) => segments[7];
internal FileInfo GetFileName(string[] segments)
{
return new FileInfo(segments[8]);
}
internal static FileInfo GetFileName(string[] segments) => new(segments[8]);
internal string[] GetTextFiles(string[] segments)
internal static string[] GetTextFiles(string[] segments)
{
List<string> results = new List<string>();
List<string> results = new();
if (segments.Length > 8)
{
for (int i = 9; i < segments.Length; i++)
@ -338,24 +301,24 @@ namespace Shared
return results.ToArray();
}
protected Stream ToStream(string @this)
protected static Stream ToStream(string @this)
{
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream);
MemoryStream memoryStream = new();
StreamWriter streamWriter = new(memoryStream);
streamWriter.Write(@this);
streamWriter.Flush();
memoryStream.Position = 0;
return memoryStream;
}
internal T ParseXML<T>(string @this, bool throwExceptions) where T : class
internal static T ParseXML<T>(string @this, bool throwExceptions) where T : class
{
object result = null;
try
{
Stream stream = ToStream(@this.Trim());
XmlReader xmlReader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T), typeof(T).GetNestedTypes());
XmlSerializer xmlSerializer = new(typeof(T), typeof(T).GetNestedTypes());
result = xmlSerializer.Deserialize(xmlReader);
stream.Dispose();
}
@ -367,7 +330,7 @@ namespace Shared
return result as T;
}
protected CellInstanceVersion GetCellInstanceVersion(string url)
protected static CellInstanceVersion GetCellInstanceVersion(string url)
{
CellInstanceVersion result;
byte[] byteArray;
@ -408,11 +371,11 @@ namespace Shared
return result;
}
protected Dictionary<string, int[]> GetComponentModelComponentsIndexes(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
protected static Dictionary<string, int[]> GetComponentModelComponentsIndexes(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
{
Dictionary<string, int[]> results = new Dictionary<string, int[]>();
Dictionary<string, int[]> results = new();
ComponentsCellComponent componentsCellComponent;
if (!(cellInstanceVersion.ComponentModel.Components is null))
if (cellInstanceVersion.ComponentModel.Components is not null)
{
for (int i = 0; i < cellInstanceVersion.ComponentModel.Components.Length; i++)
{
@ -430,7 +393,7 @@ namespace Shared
return results;
}
protected int[] GetCellInstanceConnectionNameIndexes(string cellInstanceConnectionName, Dictionary<string, int[]> componentModelComponentsIndexes)
protected static int[] GetCellInstanceConnectionNameIndexes(string cellInstanceConnectionName, Dictionary<string, int[]> componentModelComponentsIndexes)
{
int[] result;
if (string.IsNullOrEmpty(cellInstanceConnectionName))
@ -444,40 +407,22 @@ namespace Shared
return result;
}
protected bool GetNoEvents(ComponentsCellComponentCellComponent componentsCellComponentCellComponent)
protected string[] GetCSharpTextB(FileInfo fileInfo, string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion)
{
bool result = componentsCellComponentCellComponent.Equipment.EquipmentDictionaries?.CellEquipmentDictionaryReference?.DictionaryName is null;
return result;
}
protected string GetEquipmentDictionaryName(ComponentsCellComponentCellComponent componentsCellComponentCellComponent, bool noEvents, string defaultEquipmentDictionaryName)
{
string result;
if (noEvents)
result = defaultEquipmentDictionaryName;
else
result = componentsCellComponentCellComponent.Equipment.EquipmentDictionaries.CellEquipmentDictionaryReference.DictionaryName;
return result;
}
protected string[] GetCSharpTextB(string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion, FileInfo fileInfo)
{
List<string> results = new List<string>();
List<string> results = new();
string check;
bool noEvents;
string loopName;
string equipmentTypeName;
string equipmentDictionaryName;
string methodName = string.Empty;
string extractText = string.Empty;
string defaultEquipmentDictionaryName;
StringBuilder stringBuilder = new();
string createSelfDescriptionText = string.Empty;
StringBuilder stringBuilder = new StringBuilder();
List<string> componentsCellComponentCellComponentEquipmentNames = new();
string cellInstanceNameWithoutHyphen = cellInstanceName.Replace('-', '_');
ComponentsCellComponentCellComponent componentsCellComponentCellComponent;
List<string> componentsCellComponentCellComponentEquipmentTypeNames = new();
string cellInstanceVersionNameAsCode = cellInstanceVersionName.Replace('.', '_');
List<string> componentsCellComponentCellComponentEquipmentDictionaryNames = new();
const string sourceDirectoryCloaking = nameof(FileConnectorConfiguration.SourceDirectoryCloaking);
for (int i = 1; i < 3; i++)
{
@ -487,14 +432,13 @@ namespace Shared
loopName = "CreateSelfDescription";
else
throw new Exception();
defaultEquipmentDictionaryName = string.Empty;
if (i == 2)
stringBuilder.
_ = stringBuilder.
AppendLine("using Microsoft.VisualStudio.TestTools.UnitTesting;").
AppendLine("using Shared;").
AppendLine("using System.Diagnostics;");
else if (i == 1)
stringBuilder.
_ = stringBuilder.
AppendLine("using Adaptation.Shared.Methods;").
AppendLine("using Microsoft.Extensions.Logging;").
AppendLine("using Microsoft.VisualStudio.TestTools.UnitTesting;").
@ -508,19 +452,19 @@ namespace Shared
AppendLine("using System.Threading;");
else
throw new Exception();
stringBuilder.AppendLine().
_ = stringBuilder.AppendLine().
Append("namespace _Tests.").Append(loopName).Append('.').Append(_Environment).Append('.').AppendLine(cellInstanceVersionNameAsCode).
AppendLine("{").
AppendLine().
AppendLine("[TestClass]");
if (i == 2)
stringBuilder.
_ = stringBuilder.
Append("public class ").AppendLine(cellInstanceNameWithoutHyphen).
AppendLine("{").
AppendLine().
Append("private static CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).Append(" _").Append(cellInstanceNameWithoutHyphen).AppendLine(";");
else if (i == 1)
stringBuilder.
_ = stringBuilder.
Append("public class ").Append(cellInstanceNameWithoutHyphen).AppendLine(" : EAFLoggingUnitTesting").
AppendLine("{").
AppendLine().
@ -529,9 +473,9 @@ namespace Shared
else
throw new Exception();
if (i == 2)
stringBuilder.AppendLine();
_ = stringBuilder.AppendLine();
else if (i == 1)
stringBuilder.
_ = stringBuilder.
AppendLine().
Append("public ").Append(cellInstanceNameWithoutHyphen).AppendLine("() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)").
AppendLine("{").
@ -545,17 +489,17 @@ namespace Shared
AppendLine();
else
throw new Exception();
stringBuilder.
_ = stringBuilder.
AppendLine("[ClassInitialize]").
AppendLine("public static void ClassInitialize(TestContext testContext)").
AppendLine("{");
if (i == 2)
stringBuilder.
_ = stringBuilder.
Append("CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).AppendLine(".ClassInitialize(testContext);").
Append("_").Append(cellInstanceNameWithoutHyphen).Append(" = CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).AppendLine(".EAFLoggingUnitTesting;").
Append('_').Append(cellInstanceNameWithoutHyphen).Append(" = CreateSelfDescription.").Append(_Environment).Append('.').Append(cellInstanceVersionNameAsCode).Append('.').Append(cellInstanceNameWithoutHyphen).AppendLine(".EAFLoggingUnitTesting;").
AppendLine("}");
else if (i == 1)
stringBuilder.
_ = stringBuilder.
AppendLine("if (_EAFLoggingUnitTesting is null)").
Append("_EAFLoggingUnitTesting = new ").Append(cellInstanceNameWithoutHyphen).AppendLine("(testContext);").
AppendLine("_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, \" - ClassInitialize\"));").
@ -566,9 +510,9 @@ namespace Shared
else
throw new Exception();
if (i == 2)
stringBuilder.AppendLine();
_ = stringBuilder.AppendLine();
else if (i == 1)
stringBuilder.
_ = stringBuilder.
AppendLine().
AppendLine("[ClassCleanup()]").
AppendLine("public static void ClassCleanup()").
@ -586,18 +530,8 @@ namespace Shared
if (componentsCellComponent.Children.Length != 1)
continue;
componentsCellComponentCellComponent = componentsCellComponent.Children[0];
noEvents = GetNoEvents(componentsCellComponentCellComponent);
if (noEvents)
continue;
defaultEquipmentDictionaryName = GetEquipmentDictionaryName(componentsCellComponentCellComponent, noEvents, defaultEquipmentDictionaryName);
}
if (string.IsNullOrEmpty(defaultEquipmentDictionaryName))
throw new Exception("At least one dictionary name should be marked as used in EAF CI!");
foreach (ComponentsCellComponent componentsCellComponent in cellInstanceVersion.ComponentModel.Components)
{
if (componentsCellComponent.Children.Length != 1)
continue;
componentsCellComponentCellComponent = componentsCellComponent.Children[0];
if (componentsCellComponentCellComponent.Equipment.EquipmentDictionaries?.CellEquipmentDictionaryReference?.DictionaryName is not null)
componentsCellComponentCellComponentEquipmentDictionaryNames.Add(componentsCellComponentCellComponent.Equipment.EquipmentDictionaries?.CellEquipmentDictionaryReference?.DictionaryName);
componentsCellComponentCellComponentEquipmentNames.Add(componentsCellComponentCellComponent.Equipment.Name);
componentsCellComponentCellComponentEquipmentTypeNames.Add(componentsCellComponentCellComponent.Equipment.EquipmentType.Name);
methodName = $"{_Environment}__{cellInstanceVersionNameAsCode}__{cellInstanceNameWithoutHyphen}__{componentsCellComponentCellComponent.Equipment.Name.Replace('-', '_')}";
@ -607,40 +541,38 @@ namespace Shared
check = (from l in componentsCellComponentCellComponent.Equipment.ConnectionSettings.Setting where l.Name == sourceDirectoryCloaking select l.Value).FirstOrDefault();
if (string.IsNullOrEmpty(check))
check = componentsCellComponentCellComponent.Equipment.SourceFileFilter;
stringBuilder.
_ = stringBuilder.
AppendLine("[TestMethod]").
Append("public void ").Append(methodName).AppendLine("()").
AppendLine("{");
if (i == 2)
stringBuilder.Append("_").Append(cellInstanceNameWithoutHyphen).Append('.').Append(methodName).AppendLine("();");
_ = stringBuilder.Append('_').Append(cellInstanceNameWithoutHyphen).Append('.').Append(methodName).AppendLine("();");
else if (i == 1)
{
if (componentsCellComponentCellComponent.Equipment.EquipmentType.Version != cellInstanceVersionName)
throw new Exception("Versions should match!");
equipmentTypeName = componentsCellComponentCellComponent.Equipment.EquipmentType.Name;
noEvents = GetNoEvents(componentsCellComponentCellComponent);
equipmentDictionaryName = GetEquipmentDictionaryName(componentsCellComponentCellComponent, noEvents, defaultEquipmentDictionaryName);
stringBuilder.
Append("string check = \"").Append(check).AppendLine("\";").
_ = stringBuilder.
Append("string check = \"").Append(check.Split('\\').Last()).AppendLine("\";").
AppendLine("MethodBase methodBase = new StackFrame().GetMethod();").
AppendLine("_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Getting configuration\"));").
AppendLine("string[] fileNameAndJson = _EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);").
AppendLine("Assert.IsTrue(fileNameAndJson[1].Contains(check));").
AppendLine("File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);");
if (componentsCellComponentCellComponent.Equipment.EquipmentType.Name == componentsCellComponentCellComponentEquipmentTypeNames[0])
stringBuilder.
_ = stringBuilder.
AppendLine("IFileRead fileRead = _EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);").
AppendLine("Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));");
stringBuilder.
_ = stringBuilder.
AppendLine("_EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, \" - Exit\"));");
}
else
throw new Exception();
stringBuilder.
_ = stringBuilder.
AppendLine("}").
AppendLine();
}
stringBuilder.
_ = stringBuilder.
AppendLine("}").
AppendLine().
AppendLine("}").
@ -655,14 +587,14 @@ namespace Shared
createSelfDescriptionText = stringBuilder.ToString().Trim();
else
throw new Exception();
stringBuilder.Clear();
_ = stringBuilder.Clear();
}
if (string.IsNullOrEmpty(cellInstanceVersion.FrozenBy))
if (componentsCellComponentCellComponentEquipmentDictionaryNames.Any() && string.IsNullOrEmpty(cellInstanceVersion.FrozenBy))
{
if (!cellInstanceVersion.CellCommunicatingRule.Contains('.') || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception("CellCommunicatingRule not correct in Mango!");
if (!cellInstanceVersion.CellNotCommunicatingRule.Contains('.') || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellNotCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception("CellNotCommunicatingRule not correct in Mango!");
if (!cellInstanceVersion.CellCommunicatingRule.EndsWith(".Communicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception($"{methodName} - CellCommunicatingRule not correct in Mango!");
if (!cellInstanceVersion.CellNotCommunicatingRule.EndsWith(".NotCommunicating") || !(from l in componentsCellComponentCellComponentEquipmentNames where l == cellInstanceVersion.CellNotCommunicatingRule.Split('.')[0] select true).Any())
throw new Exception($"{methodName} - CellNotCommunicatingRule not correct in Mango!");
}
string versionLevelDirectory = Path.GetDirectoryName(fileInfo.DirectoryName);
results.Add(Path.Combine(versionLevelDirectory, $"{cellInstanceName}-0-CreateSelfDescription.txt"));
@ -672,11 +604,12 @@ namespace Shared
return results.ToArray();
}
protected FileConnectorConfiguration GetFileConnectorConfiguration(string json, ComponentsCellComponentCellComponent componentsCellComponentCellComponent)
protected static FileConnectorConfiguration GetFileConnectorConfiguration(string json, ComponentsCellComponentCellComponent componentsCellComponentCellComponent)
{
FileConnectorConfiguration result;
const string sourceDirectoryCloaking = nameof(FileConnectorConfiguration.SourceDirectoryCloaking);
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
JsonSerializerOptions jsonSerializerOptions = new()
{ Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
json = json.Replace(string.Concat("\"", nameof(FileConnectorConfiguration.ConnectionSettings), "\":"), string.Concat("\"Ignore", nameof(FileConnectorConfiguration.ConnectionSettings), "\":"));
result = JsonSerializer.Deserialize<FileConnectorConfiguration>(json, jsonSerializerOptions);
if (string.IsNullOrEmpty(result.SourceFileFilter))
@ -691,7 +624,7 @@ namespace Shared
result.FolderAgeCheckIndividualSubFolders = false;
result.ConnectionSettings = new List<ConnectionSetting>();
result.SourceFileFilters = result.SourceFileFilter.Split('|').ToList();
if (!(componentsCellComponentCellComponent.Equipment?.ConnectionSettings is null))
if (componentsCellComponentCellComponent.Equipment?.ConnectionSettings is not null)
{
foreach (Setting setting in componentsCellComponentCellComponent.Equipment.ConnectionSettings.Setting)
result.ConnectionSettings.Add(new ConnectionSetting(null, null) { Name = setting.Name, Value = setting.Value });
@ -727,7 +660,7 @@ namespace Shared
return result;
}
protected EquipmentTypeVersion GetEquipmentTypeVersion(string url)
protected static EquipmentTypeVersion GetEquipmentTypeVersion(string url)
{
EquipmentTypeVersion result;
byte[] byteArray;
@ -752,7 +685,7 @@ namespace Shared
return result;
}
protected Tuple<string, string, string, EquipmentTypeVersion> GetEquipmentTypeVersionTuple(string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
protected Tuple<string, string, string, EquipmentTypeVersion> GetEquipmentTypeVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName)
{
Tuple<string, string, string, EquipmentTypeVersion> result;
EquipmentTypeVersion equipmentTypeVersion;
@ -786,7 +719,8 @@ namespace Shared
protected IList<ModelObjectParameterDefinition> GetModelObjectParameters(string json)
{
IList<ModelObjectParameterDefinition> results;
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
JsonSerializerOptions jsonSerializerOptions = new()
{ Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
string parameters = "Parameters";
string fileHandlerObjectTypes = nameof(FileHandlerObjectTypes);
@ -835,8 +769,10 @@ namespace Shared
{
if (componentsCellComponentCellComponentEquipment?.EquipmentDictionaries.CellEquipmentDictionaryReference is null)
{
equipmentDictionaryName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryName;
equipmentDictionaryVersionName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryVersion;
// equipmentDictionaryName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryName;
// equipmentDictionaryVersionName = equipmentTypeVersion.Dictionaries.EquipmentTypeDictionaryReference.DictionaryVersion;
equipmentDictionaryName = string.Empty;
equipmentDictionaryVersionName = string.Empty;
}
else
{
@ -848,7 +784,7 @@ namespace Shared
return results;
}
protected EquipmentDictionaryVersion GetEquipmentDictionaryVersion(string url)
protected static EquipmentDictionaryVersion GetEquipmentDictionaryVersion(string url)
{
EquipmentDictionaryVersion result;
string xml;
@ -870,7 +806,7 @@ namespace Shared
return result;
}
protected Tuple<string, string, string, EquipmentDictionaryVersion> GetEquipmentDictionaryVersionTuple(string cellInstanceName, string cellInstanceVersionName, CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName, EquipmentTypeVersion equipmentTypeVersion)
protected Tuple<string, string, string, EquipmentDictionaryVersion> GetEquipmentDictionaryVersionTuple(CellInstanceVersion cellInstanceVersion, string cellInstanceConnectionName, EquipmentTypeVersion equipmentTypeVersion)
{
Tuple<string, string, string, EquipmentDictionaryVersion> result;
string equipmentDictionaryName;
@ -915,6 +851,8 @@ namespace Shared
results = new List<Tuple<string, string>>();
else if (string.IsNullOrEmpty(equipmentDictionaryVersionTuple.Item1))
throw new Exception();
else if (equipmentDictionaryVersionTuple?.Item4?.Events?.Event is null)
results = new List<Tuple<string, string>>();
else if (_EquipmentDictionaryEventDescriptions.ContainsKey(equipmentDictionaryVersionTuple.Item1))
results = _EquipmentDictionaryEventDescriptions[equipmentDictionaryVersionTuple.Item1];
else
@ -933,15 +871,16 @@ namespace Shared
return result;
}
protected Dictionary<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents)
protected Dictionary<string, object> GetKeyValuePairs(string cellInstanceName, string cellInstanceVersionName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, IList<ModelObjectParameterDefinition> modelObjectParameters, string equipmentDictionaryName, List<Tuple<string, string>> equipmentDictionaryIsAlwaysEnabledEvents)
{
Dictionary<string, object> results = new Dictionary<string, object>
Dictionary<string, object> results = new()
{
{ nameof(Environment), _Environment },
{ nameof(HostNameAndPort), _HostNameAndPort },
{ nameof(cellInstanceName), cellInstanceName },
{ nameof(equipmentTypeName), equipmentTypeName },
{ nameof(cellInstanceVersionName), cellInstanceVersionName },
{ nameof(equipmentDictionaryName), equipmentDictionaryName },
{ nameof(cellInstanceConnectionName), cellInstanceConnectionName },
{ nameof(FileConnectorConfiguration), fileConnectorConfiguration },
{ nameof(IList<ModelObjectParameterDefinition>), modelObjectParameters },
@ -960,9 +899,9 @@ namespace Shared
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
Directory.CreateDirectory(fileInfo.Directory.FullName);
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
results = GetCSharpTextB(cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2, fileInfo);
results = GetCSharpTextB(fileInfo, cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2);
return results;
}
@ -975,15 +914,15 @@ namespace Shared
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
Directory.CreateDirectory(fileInfo.Directory.FullName);
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName);
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
Tuple<string, string> parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
Tuple<string, IList<ModelObjectParameterDefinition>> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
Tuple<string, List<Tuple<string, string>>> equipmentDictionaryIsAlwaysEnabledEventsTuple = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
Dictionary<string, object> objects = GetKeyValuePairs(cellInstanceName, cellInstanceVersionName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2);
Dictionary<string, object> objects = GetKeyValuePairs(cellInstanceName, cellInstanceVersionName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, equipmentDictionaryIsAlwaysEnabledEventsTuple.Item2);
string json = JsonSerializer.Serialize(objects, new JsonSerializerOptions { WriteIndented = true });
results = new string[] { fileInfo.FullName, json };
return results;
@ -996,16 +935,19 @@ namespace Shared
FileInfo fileInfo = GetFileName(segments);
string cellInstanceName = GetCellInstanceName(segments);
string cellInstanceVersionName = GetCellInstanceVersionName(segments);
Dictionary<string, string> fileParameter = new Dictionary<string, string>();
Dictionary<string, string> fileParameter = new();
string cellInstanceConnectionName = GetCellInstanceConnectionName(segments);
if (!string.IsNullOrEmpty(cellInstanceConnectionName) && !Directory.Exists(fileInfo.DirectoryName))
Directory.CreateDirectory(fileInfo.Directory.FullName);
Dictionary<string, List<long>> dummyRuns = new Dictionary<string, List<long>>();
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
Dictionary<string, List<long>> dummyRuns = new();
Tuple<string, CellInstanceVersion> cellInstanceVersionTuple = GetCellInstanceVersionTuple(cellInstanceName, cellInstanceVersionName);
Tuple<string, FileConnectorConfiguration> fileConnectorConfigurationTuple = GetFileConnectorConfigurationTuple(cellInstanceVersionTuple, cellInstanceConnectionName);
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceName, cellInstanceVersionName, cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
Tuple<string, string, string, EquipmentTypeVersion> equipmentTypeVersionTuple = GetEquipmentTypeVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName);
Tuple<string, string> parameterizedModelObjectDefinitionTypeTuple = GetParameterizedModelObjectDefinitionTypeTuple(equipmentTypeVersionTuple);
Tuple<string, IList<ModelObjectParameterDefinition>> modelObjectParametersTuple = GetModelObjectParameters(equipmentTypeVersionTuple);
Tuple<string, string, string, EquipmentDictionaryVersion> equipmentDictionaryVersionTuple = GetEquipmentDictionaryVersionTuple(cellInstanceVersionTuple.Item2, cellInstanceConnectionName, equipmentTypeVersionTuple.Item4);
_ = GetEquipmentDictionaryIsAlwaysEnabledEventsTuple(equipmentDictionaryVersionTuple);
if (!string.IsNullOrEmpty(sourceFileLocation) && sourceFileLocation != fileConnectorConfigurationTuple.Item2.SourceFileLocation)
fileConnectorConfigurationTuple.Item2.SourceFileLocation = sourceFileLocation;
if (!string.IsNullOrEmpty(sourceFileFilter) && sourceFileFilter != fileConnectorConfigurationTuple.Item2.SourceFileFilter)
@ -1013,7 +955,7 @@ namespace Shared
fileConnectorConfigurationTuple.Item2.SourceFileFilter = sourceFileFilter;
fileConnectorConfigurationTuple.Item2.SourceFileFilters = sourceFileFilter.Split('|').ToList();
}
result = Adaptation.FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, dummyRuns, useCyclicalForDescription, isEAFHosted: false);
result = Adaptation.FileHandlers.CellInstanceConnectionName.Get(this, fileParameter, cellInstanceName, cellInstanceConnectionName, fileConnectorConfigurationTuple.Item2, equipmentTypeVersionTuple.Item2, parameterizedModelObjectDefinitionTypeTuple.Item2, modelObjectParametersTuple.Item2, equipmentDictionaryVersionTuple.Item2, dummyRuns, useCyclicalForDescription, isEAFHosted: false);
return result;
}
@ -1061,7 +1003,7 @@ namespace Shared
}
}
if (!Directory.Exists(fileInfo.Directory.FullName))
Directory.CreateDirectory(fileInfo.Directory.FullName);
_ = Directory.CreateDirectory(fileInfo.Directory.FullName);
if (!fileInfo.Exists)
throw new Exception();
string json = File.ReadAllText(fileInfo.FullName);
@ -1073,7 +1015,8 @@ namespace Shared
JsonElement fileConnectorConfigurationJsonElement = jsonElement.GetProperty(nameof(FileConnectorConfiguration));
if (fileConnectorConfigurationJsonElement.ValueKind != JsonValueKind.Object)
throw new Exception();
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
JsonSerializerOptions jsonSerializerOptions = new()
{ Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) } };
FileConnectorConfiguration fileConnectorConfiguration = JsonSerializer.Deserialize<FileConnectorConfiguration>(fileConnectorConfigurationJsonElement.ToString(), jsonSerializerOptions);
if (!string.IsNullOrEmpty(sourceFileFilter))
fileConnectorConfiguration.SourceFileFilter = sourceFileFilter;
@ -1114,6 +1057,5 @@ namespace Shared
}
}
}
// namespace _Tests.Helpers { public class AdaptationTesting { } }
// 2022-02-02 -> AdaptationTesting

View File

@ -1,8 +1,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace Shared
{
namespace Shared;
public class EAFLoggingUnitTesting : LoggingUnitTesting, IDisposable
{
@ -20,11 +19,6 @@ namespace Shared
_AdaptationTesting = new AdaptationTesting(testContext, skipEquipmentDictionary);
}
public new void Dispose()
{
base.Dispose();
}
}
public new void Dispose() => base.Dispose();
}

View File

@ -2,8 +2,7 @@ using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Shared
{
namespace Shared;
public class IsEnvironment
{
@ -167,5 +166,3 @@ namespace Shared
}
}
}

View File

@ -5,8 +5,7 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace Shared
{
namespace Shared;
public class LoggingUnitTesting : UnitTesting, IDisposable
{
@ -36,7 +35,7 @@ namespace Shared
{
LogLevel logLevel;
IConfigurationSection configurationSection;
List<LogLevel> logLevels = new List<LogLevel>();
List<LogLevel> logLevels = new();
string defaultLogLevelSection = "Logging:LogLevel:Default";
string log4netProviderLogLevelSection = "Logging:LogLevel:Log4netProvider";
string[] sections = new string[] { defaultLogLevelSection, log4netProviderLogLevelSection };
@ -67,7 +66,7 @@ namespace Shared
{
string result = string.Empty;
string traceFile;
List<string> directories = new List<string>();
List<string> directories = new();
Environment.SpecialFolder[] specialFolders = new Environment.SpecialFolder[]
{
Environment.SpecialFolder.LocalApplicationData,
@ -89,7 +88,7 @@ namespace Shared
try
{
if (!Directory.Exists(result))
Directory.CreateDirectory(result);
_ = Directory.CreateDirectory(result);
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
File.WriteAllText(traceFile, traceFile);
File.Delete(traceFile);
@ -103,11 +102,6 @@ namespace Shared
return result;
}
public void Dispose()
{
_LoggerFactory.Dispose();
}
}
public void Dispose() => _LoggerFactory.Dispose();
}

View File

@ -1,7 +1,7 @@
using System.Xml.Serialization;
namespace Shared.PasteSpecialXml.EAF.XML.API.ConfigurationData
{
namespace Shared.PasteSpecialXml.EAF.XML.API.ConfigurationData;
[XmlRoot(ElementName = "ChildBackboneMembers", Namespace = "http://schemas.datacontract.org/2004/07/EafManagement.Configuration.Services")]
public class ChildBackboneMembers
{
@ -21,5 +21,3 @@ namespace Shared.PasteSpecialXml.EAF.XML.API.ConfigurationData
[XmlAttribute(AttributeName = "i", Namespace = "http://www.w3.org/2000/xmlns/")]
public string I { get; set; }
}
}

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