Builds but needs tested

This commit is contained in:
Mike Phares 2022-03-25 18:13:23 -07:00
parent a6abe8fdbd
commit 1f607cbbed
113 changed files with 12922 additions and 5993 deletions

7292
APC Viewer/.vscode/format-report.json vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,16 @@
<SccLocalPath>SAK</SccLocalPath> <SccLocalPath>SAK</SccLocalPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<LangVersion>9.0</LangVersion>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>APCViewer</RootNamespace>
<RuntimeFrameworkVersion>5.0.2</RuntimeFrameworkVersion>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
<UserSecretsId>d71a673c-be39-45b5-ae5f-4c22639be045</UserSecretsId> <ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<RootNamespace>APCViewer</RootNamespace>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows> <IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX> <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux> <IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
@ -27,23 +31,35 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" /> <PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
<PackageReference Include="Log4net" Version="2.0.12" /> </ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.5" /> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" /> <PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" /> </ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" /> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" /> <PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00021" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.1.4" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.1.4" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.1.4" /> </ItemGroup>
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" /> <ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\images\" /> <Folder Include="wwwroot\images\" />
<Folder Include="wwwroot\js\html5shiv\3.7.2\" /> <Folder Include="wwwroot\js\html5shiv\3.7.2\" />
<Folder Include="wwwroot\js\respond\1.4.2\" /> <Folder Include="wwwroot\js\respond\1.4.2\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="appsettings.Staging.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,16 @@
<h3>Counter</h3>
<p>
Current Count: @i
</p>
<button @onclick="IncrementCounter" class="btn btn-primary">Click Me</button>
@code {
int i = 0;
private void IncrementCounter()
{
i += 1;
}
}

View File

@ -0,0 +1,83 @@
using APCViewer.Models.Stateless.Methods;
using IFX.Shared;
using Microsoft.AspNetCore.Mvc;
using Serilog.Context;
using System.Text.Json;
namespace APCViewer.Controllers;
public class BackgroundController : Controller, Models.Properties.IBackgroundController, IBackgroundController
{
protected readonly List<Exception> _Exceptions;
protected readonly string _AppSettingsURLs;
protected readonly string _IsEnvironmentProfile;
protected readonly string _IsPrimaryInstance;
protected readonly string _Message;
protected readonly string _WorkingDirectory;
public List<Exception> Exceptions => _Exceptions;
public string AppSettingsURLs => _AppSettingsURLs;
public string IsEnvironmentProfile => _IsEnvironmentProfile;
public string IsPrimaryInstance => _IsPrimaryInstance;
public string Message => _Message;
public string WorkingDirectory => _WorkingDirectory;
private readonly Serilog.ILogger _Log;
private readonly Models.Methods.IBackground _BackgroundMethods;
public BackgroundController(IsEnvironment isEnvironment, Models.AppSettings appSettings, Singleton.Background background)
{
_Message = background.Message;
_BackgroundMethods = background;
_AppSettingsURLs = appSettings.URLs;
_Exceptions = background.Exceptions;
_IsEnvironmentProfile = isEnvironment.Profile;
_WorkingDirectory = background.WorkingDirectory;
_Log = Serilog.Log.ForContext<BackgroundController>();
Models.Methods.IBackground backgroundMethods = background;
_IsPrimaryInstance = backgroundMethods.IsPrimaryInstance().ToString();
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
public ActionResult Index(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null)
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{
_Log.Debug("() => ...");
if (message_clear.HasValue && message_clear.Value)
_BackgroundMethods.ClearMessage();
if (exceptions_clear.HasValue && exceptions_clear.Value)
_Exceptions.Clear();
if (set_is_primary_instance.HasValue)
{
if (set_is_primary_instance.Value)
_BackgroundMethods.SetIsPrimaryInstance();
else
_BackgroundMethods.ClearIsPrimaryInstance();
}
string message;
if (string.IsNullOrWhiteSpace(_Message))
message = "N/A";
else
message = _Message;
List<Exception> exceptions = new();
foreach (Exception exception in _Exceptions)
exceptions.Add(exception);
ViewBag.Message = message;
ViewBag.Exceptions = exceptions;
ViewBag.URLs = _AppSettingsURLs;
ViewBag.Profile = _IsEnvironmentProfile;
ViewBag.WorkingDirectory = _WorkingDirectory;
ViewBag.IsPrimaryInstance = _IsPrimaryInstance;
ViewBag.ExceptionsCount = string.Concat("Exception(s) - ", exceptions.Count);
return View();
}
}
}

View File

@ -1,352 +1,300 @@
using APCViewer.Models; using APCViewer.Models;
using APCViewer.Models.Methods;
using APCViewer.Singleton; using APCViewer.Singleton;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Shared;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Text; using System.Text;
using System.Web; using System.Web;
namespace APCViewer.Controllers namespace APCViewer.Controllers;
public class HomeController : Controller, IHomeController
{ {
public class HomeController : Controller, IHomeController private readonly Serilog.ILogger _Log;
private readonly Background _Background;
private readonly IBackground _BackgroundMethods;
public HomeController(Background background)
{ {
_Background = background;
private readonly Log _Log; _BackgroundMethods = background;
private readonly Singleton.IBackground _Background; _Log = Serilog.Log.ForContext<HomeController>();
private readonly IHttpContextAccessor _HttpContextAccessor;
public HomeController(ILogger<HomeController> logger, Singleton.IBackground background, IHttpContextAccessor httpContextAccessor)
{
_Log = new Log(logger);
_Background = background;
_HttpContextAccessor = httpContextAccessor;
}
public ActionResult Index()
{
return View();
}
public ActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public ActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
public ActionResult Encode(string value = null)
{
string result = string.Empty;
if (!string.IsNullOrEmpty(value))
result = HttpUtility.UrlEncode(value);
return Content(result, "text/plain");
}
public ActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, bool? logistics_clear = null)
{
_Background.SendStatusOk();
if (message_clear.HasValue && message_clear.Value)
_Background.ClearMessage();
if (exceptions_clear.HasValue && exceptions_clear.Value)
_Background.Exceptions.Clear();
if (set_is_primary_instance.HasValue)
{
if (set_is_primary_instance.Value)
_Background.SetIsPrimaryInstance();
else
_Background.ClearIsPrimaryInstance();
}
if (logistics_clear.HasValue && logistics_clear.Value)
_Background.LogisticsClear();
string message;
if (string.IsNullOrWhiteSpace(_Background.Message))
message = "N/A";
else
message = _Background.Message;
//Response.AppendToLog(_Background.Message);
List<Exception> exceptions = new();
foreach (Exception exception in _Background.Exceptions)
exceptions.Add(exception);
ViewBag.Message = message;
ViewBag.Exceptions = exceptions;
ViewBag.URLs = _Background.AppSettings.URLs;
ViewBag.Profile = _Background.IsEnvironment.Profile;
ViewBag.WorkingDirectory = _Background.WorkingDirectory;
ViewBag.IsPrimaryInstance = _Background.IsPrimaryInstance();
ViewBag.ExceptionsCount = string.Concat("Exception(s) - ", exceptions.Count);
return View();
}
public ActionResult PDSF(string directory = null, string filter = null, bool is_gaN = false, bool is_Si = false)
{
Tuple<int, object, object, string> tuple = _Background.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forPDSF: true);
ViewBag.Files = tuple.Item1;
ViewBag.Grouped = tuple.Item2;
ViewBag.Sorted = tuple.Item3;
ViewBag.Directory = tuple.Item4;
return View();
}
private StringBuilder GetPDSFHtml(string pdsfFile)
{
StringBuilder result = new();
result.AppendLine("<html><body><table border = '1'>");
if (string.IsNullOrEmpty(pdsfFile))
throw new Exception("<tr><td>Invalid input</td></tr>");
else if (!System.IO.File.Exists(pdsfFile))
result.AppendLine("<tr><td>File doesn't exist!</td></tr>");
else
{
bool header = true;
bool body = false;
bool footer = false;
string logisticsSegment;
List<string> logistics = new();
string[] pdsfLines = System.IO.File.ReadAllLines(pdsfFile);
foreach (string pdsfLine in pdsfLines)
{
if (pdsfLine.StartsWith("LOGISTICS_"))
{
logisticsSegment = pdsfLine.Split('\t')[0];
if (!logistics.Contains(logisticsSegment))
{
logistics.Add(logisticsSegment);
result.AppendLine("</table><hr /><table border = '1'>");
}
}
if (pdsfLine.StartsWith("NUM_DATA_ROWS") || pdsfLine.StartsWith("END_HEADER"))
{
body = false;
footer = true;
result.AppendLine("</table><hr /><table border = '1'>");
}
if (header)
result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (body)
result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (footer)
{
if (pdsfLine.StartsWith("DELIMITER"))
result.Append("<tr><td>").Append(pdsfLine.Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else
result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
}
else
throw new Exception();
if (pdsfLine.StartsWith("END_OFFSET"))
{
header = false;
body = true;
result.AppendLine("</table><hr /><table border = '1'>");
}
}
}
result.AppendLine("</table></body>");
return result;
}
public ContentResult ViewPDSF(string id = null)
{
string pdsfFile;
StringBuilder result = new();
if (!id.Contains('_'))
result.AppendLine("<html><body><table border = '1'><tr><td>A) Error: Invalid input</td></tr></table></body>");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
result.AppendLine("<html><body><table border = '1'><tr><td>B) Error: Invalid input</td></tr></table></body>");
else
{
pdsfFile = _Background.GetPDSF(sequence);
result = GetPDSFHtml(pdsfFile);
}
}
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadPDSF(string id = null)
{
string pdsfFile;
if (!id.Contains('_'))
throw new Exception("A) Error: Invalid input");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
throw new Exception("B) Error: Invalid input");
else
pdsfFile = _Background.GetPDSF(sequence);
}
return File(pdsfFile, "text/plain", Path.GetFileName(pdsfFile));
}
public ContentResult ViewCustomPDSF(string pdsf_file = null)
{
StringBuilder result = GetPDSFHtml(pdsf_file);
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadCustomPDSF(string pdsf_file = null)
{
if (string.IsNullOrEmpty(pdsf_file))
throw new Exception("Error: Invalid input");
else if (!System.IO.File.Exists(pdsf_file))
throw new Exception("Error: file does not exist");
return File(pdsf_file, "text/plain", Path.GetFileName(pdsf_file));
}
public ActionResult IPDSF(string directory = null, string filter = null, bool is_gaN = false, bool is_Si = false)
{
Tuple<int, object, object, string> tuple = _Background.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forIPDSF: true);
ViewBag.Files = tuple.Item1;
ViewBag.Grouped = tuple.Item2;
ViewBag.Sorted = tuple.Item3;
ViewBag.Directory = tuple.Item4;
return View();
}
private StringBuilder GetIPDSFHtml(string ipdsfFile)
{
StringBuilder result = new();
result.AppendLine("<html><body><table border = '1'>");
if (string.IsNullOrEmpty(ipdsfFile))
throw new Exception("<tr><td>Invalid input</td></tr>");
else if (!System.IO.File.Exists(ipdsfFile))
result.AppendLine("<tr><td>File doesn't exist!</td></tr>");
else
{
bool header = true;
bool body = false;
bool footer = false;
string logisticsSegment;
List<string> logistics = new();
string[] ipdsfLines = System.IO.File.ReadAllLines(ipdsfFile);
foreach (string ipdsfLine in ipdsfLines)
{
if (ipdsfLine.StartsWith("LOGISTICS_"))
{
logisticsSegment = ipdsfLine.Split('\t')[0];
if (!logistics.Contains(logisticsSegment))
{
logistics.Add(logisticsSegment);
result.AppendLine("</table><hr /><table border = '1'>");
}
}
if (ipdsfLine.StartsWith("NUM_DATA_ROWS") || ipdsfLine.StartsWith("END_HEADER"))
{
body = false;
footer = true;
result.AppendLine("</table><hr /><table border = '1'>");
}
if (header)
result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (body)
result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (footer)
{
if (ipdsfLine.StartsWith("DELIMITER"))
result.Append("<tr><td>").Append(ipdsfLine.Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else
result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
}
else
throw new Exception();
if (ipdsfLine.StartsWith("END_OFFSET"))
{
header = false;
body = true;
result.AppendLine("</table><hr /><table border = '1'>");
}
}
}
result.AppendLine("</table></body>");
return result;
}
public ContentResult ViewIPDSF(string id = null)
{
string ipdsfFile;
StringBuilder result = new();
if (!id.Contains('_'))
result.AppendLine("<html><body><table border = '1'><tr><td>A) Error: Invalid input</td></tr></table></body>");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
result.AppendLine("<html><body><table border = '1'><tr><td>B) Error: Invalid input</td></tr></table></body>");
else
{
ipdsfFile = _Background.GetIPDSF(sequence);
result = GetIPDSFHtml(ipdsfFile);
}
}
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadIPDSF(string id = null)
{
string ipdsfFile;
if (!id.Contains('_'))
throw new Exception("A) Error: Invalid input");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
throw new Exception("B) Error: Invalid input");
else
ipdsfFile = _Background.GetIPDSF(sequence);
}
return File(ipdsfFile, "text/plain", Path.GetFileName(ipdsfFile));
}
public ContentResult ViewCustomIPDSF(string ipdsf_file = null)
{
StringBuilder result = GetIPDSFHtml(ipdsf_file);
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadCustomIPDSF(string ipdsf_file = null)
{
if (string.IsNullOrEmpty(ipdsf_file))
throw new Exception("Error: Invalid input");
else if (!System.IO.File.Exists(ipdsf_file))
throw new Exception("Error: file does not exist");
return File(ipdsf_file, "text/plain", Path.GetFileName(ipdsf_file));
}
public ActionResult TimePivot(bool is_gaN = false, bool is_Si = false)
{
Tuple<List<string[]>, List<string[]>> tuple = _Background.GetTimePivot(isGaN: is_gaN, isSi: is_Si);
ViewBag.forIPDSF = tuple.Item1;
ViewBag.forPDSF = tuple.Item2;
return View();
}
IActionResult IHomeController.Background(bool? message_clear, bool? exceptions_clear, bool? set_is_primary_instance, bool? logistics_clear) => throw new NotImplementedException();
IActionResult IHomeController.DownloadCustomIPDSF(string ipdsf_file) => throw new NotImplementedException();
IActionResult IHomeController.DownloadCustomPDSF(string pdsf_file) => throw new NotImplementedException();
IActionResult IHomeController.DownloadIPDSF(string id) => throw new NotImplementedException();
IActionResult IHomeController.DownloadPDSF(string id) => throw new NotImplementedException();
IActionResult IHomeController.Encode(string value) => throw new NotImplementedException();
IActionResult IHomeController.Error() => throw new NotImplementedException();
IActionResult IHomeController.Index() => throw new NotImplementedException();
IActionResult IHomeController.IPDSF(string directory, string filter, bool is_gaN, bool is_Si) => throw new NotImplementedException();
IActionResult IHomeController.PDSF(string directory, string filter, bool is_gaN, bool is_Si) => throw new NotImplementedException();
IActionResult IHomeController.Privacy() => throw new NotImplementedException();
IActionResult IHomeController.TimePivot(bool is_gaN, bool is_Si) => throw new NotImplementedException();
} }
} public ActionResult Index() => View();
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "L:\net5.0\APCViewer"
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\net5.0\APCViewer" public ActionResult Privacy() => View();
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\.jenkins\publish\manual-Mesa-0\APCViewer"
//http://mestsa005.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=APC%20Viewer [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
// http://mestsa02ec.ec.local:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=APC%20Viewer public ActionResult Error() => View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
//sc create APCViewer_5003 binPath="D:\.jenkins\publish\manual-Mesa-0\APCViewer\APC Viewer.exe"
public ActionResult Encode(string value = "")
{
string result = string.Empty;
if (!string.IsNullOrEmpty(value))
result = HttpUtility.UrlEncode(value);
return Content(result, "text/plain");
}
public ActionResult TestTry()
{
ActionResult result;
try
{
throw new Exception("This is a test");
}
catch (Exception ex)
{
result = Content(string.Concat(ex.Message, Environment.NewLine, Environment.NewLine, ex.StackTrace));
}
return result;
}
public ActionResult PDSF(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false)
{
Tuple<int, object, object, string?> tuple = _Background.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forPDSF: true);
ViewBag.Files = tuple.Item1;
ViewBag.Grouped = tuple.Item2;
ViewBag.Sorted = tuple.Item3;
ViewBag.Directory = tuple.Item4;
return View();
}
private static StringBuilder GetPDSFHtml(string? pdsfFile)
{
StringBuilder result = new();
_ = result.AppendLine("<html><body><table border = '1'>");
if (string.IsNullOrEmpty(pdsfFile))
throw new Exception("<tr><td>Invalid input</td></tr>");
else if (!System.IO.File.Exists(pdsfFile))
_ = result.AppendLine("<tr><td>File doesn't exist!</td></tr>");
else
{
bool header = true;
bool body = false;
bool footer = false;
string logisticsSegment;
List<string> logistics = new();
string[] pdsfLines = System.IO.File.ReadAllLines(pdsfFile);
foreach (string pdsfLine in pdsfLines)
{
if (pdsfLine.StartsWith("LOGISTICS_"))
{
logisticsSegment = pdsfLine.Split('\t')[0];
if (!logistics.Contains(logisticsSegment))
{
logistics.Add(logisticsSegment);
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
}
if (pdsfLine.StartsWith("NUM_DATA_ROWS") || pdsfLine.StartsWith("END_HEADER"))
{
body = false;
footer = true;
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
if (header)
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (body)
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (footer)
{
if (pdsfLine.StartsWith("DELIMITER"))
_ = result.Append("<tr><td>").Append(pdsfLine.Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
}
else
throw new Exception();
if (pdsfLine.StartsWith("END_OFFSET"))
{
header = false;
body = true;
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
}
}
_ = result.AppendLine("</table></body>");
return result;
}
public ContentResult ViewPDSF(string? id = null)
{
string pdsfFile;
StringBuilder result = new();
if (string.IsNullOrEmpty(id) || !id.Contains('_'))
_ = result.AppendLine("<html><body><table border = '1'><tr><td>A) Error: Invalid input</td></tr></table></body>");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
_ = result.AppendLine("<html><body><table border = '1'><tr><td>B) Error: Invalid input</td></tr></table></body>");
else
{
pdsfFile = _Background.GetPDSF(sequence);
result = GetPDSFHtml(pdsfFile);
}
}
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadPDSF(string? id = null)
{
string pdsfFile;
if (string.IsNullOrEmpty(id) || !id.Contains('_'))
throw new Exception("A) Error: Invalid input");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
throw new Exception("B) Error: Invalid input");
else
pdsfFile = _Background.GetPDSF(sequence);
}
return File(pdsfFile, "text/plain", Path.GetFileName(pdsfFile));
}
public ContentResult ViewCustomPDSF(string? pdsf_file = null)
{
StringBuilder result = GetPDSFHtml(pdsf_file);
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadCustomPDSF(string? pdsf_file = null)
{
if (string.IsNullOrEmpty(pdsf_file))
throw new Exception("Error: Invalid input");
else if (!System.IO.File.Exists(pdsf_file))
throw new Exception("Error: file does not exist");
return File(pdsf_file, "text/plain", Path.GetFileName(pdsf_file));
}
public ActionResult IPDSF(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false)
{
Tuple<int, object, object, string?> tuple = _Background.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forIPDSF: true);
ViewBag.Files = tuple.Item1;
ViewBag.Grouped = tuple.Item2;
ViewBag.Sorted = tuple.Item3;
ViewBag.Directory = tuple.Item4;
return View();
}
private static StringBuilder GetIPDSFHtml(string? ipdsfFile)
{
StringBuilder result = new();
_ = result.AppendLine("<html><body><table border = '1'>");
if (string.IsNullOrEmpty(ipdsfFile))
throw new Exception("<tr><td>Invalid input</td></tr>");
else if (!System.IO.File.Exists(ipdsfFile))
_ = result.AppendLine("<tr><td>File doesn't exist!</td></tr>");
else
{
bool header = true;
bool body = false;
bool footer = false;
string logisticsSegment;
List<string> logistics = new();
string[] ipdsfLines = System.IO.File.ReadAllLines(ipdsfFile);
foreach (string ipdsfLine in ipdsfLines)
{
if (ipdsfLine.StartsWith("LOGISTICS_"))
{
logisticsSegment = ipdsfLine.Split('\t')[0];
if (!logistics.Contains(logisticsSegment))
{
logistics.Add(logisticsSegment);
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
}
if (ipdsfLine.StartsWith("NUM_DATA_ROWS") || ipdsfLine.StartsWith("END_HEADER"))
{
body = false;
footer = true;
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
if (header)
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (body)
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else if (footer)
{
if (ipdsfLine.StartsWith("DELIMITER"))
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
else
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine("&nbsp;</td></tr>");
}
else
throw new Exception();
if (ipdsfLine.StartsWith("END_OFFSET"))
{
header = false;
body = true;
_ = result.AppendLine("</table><hr /><table border = '1'>");
}
}
}
_ = result.AppendLine("</table></body>");
return result;
}
public ContentResult ViewIPDSF(string? id = null)
{
string ipdsfFile;
StringBuilder result = new();
if (string.IsNullOrEmpty(id) || !id.Contains('_'))
_ = result.AppendLine("<html><body><table border = '1'><tr><td>A) Error: Invalid input</td></tr></table></body>");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
_ = result.AppendLine("<html><body><table border = '1'><tr><td>B) Error: Invalid input</td></tr></table></body>");
else
{
ipdsfFile = _Background.GetIPDSF(sequence);
result = GetIPDSFHtml(ipdsfFile);
}
}
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadIPDSF(string? id = null)
{
string ipdsfFile;
if (string.IsNullOrEmpty(id) || !id.Contains('_'))
throw new Exception("A) Error: Invalid input");
else
{
if (!long.TryParse(id.Split('_')[1], out long sequence))
throw new Exception("B) Error: Invalid input");
else
ipdsfFile = _Background.GetIPDSF(sequence);
}
return File(ipdsfFile, "text/plain", Path.GetFileName(ipdsfFile));
}
public ContentResult ViewCustomIPDSF(string? ipdsf_file = null)
{
StringBuilder result = GetIPDSFHtml(ipdsf_file);
return Content(result.ToString(), "text/html");
}
public ActionResult DownloadCustomIPDSF(string? ipdsf_file = null)
{
if (string.IsNullOrEmpty(ipdsf_file))
throw new Exception("Error: Invalid input");
else if (!System.IO.File.Exists(ipdsf_file))
throw new Exception("Error: file does not exist");
return File(ipdsf_file, "text/plain", Path.GetFileName(ipdsf_file));
}
public ActionResult TimePivot(bool is_gaN = false, bool is_Si = false)
{
Tuple<List<string[]>, List<string[]>> tuple = _Background.GetTimePivot(isGaN: is_gaN, isSi: is_Si);
ViewBag.forIPDSF = tuple.Item1;
ViewBag.forPDSF = tuple.Item2;
return View();
}
}

View File

@ -1,9 +0,0 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:APCViewer.Controllers.HomeController.GetPDSFHtml(System.String)~System.Text.StringBuilder")]
[assembly: SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "<Pending>", Scope = "member", Target = "~M:APCViewer.Controllers.HomeController.GetIPDSFHtml(System.String)~System.Text.StringBuilder")]

View File

@ -1,168 +1,168 @@
using APCViewer.Singleton; using APCViewer.Models.Methods;
using Microsoft.Extensions.Configuration; using APCViewer.Models.Stateless;
using Microsoft.Extensions.DependencyInjection; using APCViewer.Models.Stateless.Methods;
using Microsoft.Extensions.Hosting; using APCViewer.Singleton;
using Microsoft.Extensions.Logging; using IFX.Shared;
using System; using Serilog.Context;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace APCViewer.HostedService namespace APCViewer.HostedService;
public class TimedHostedService : IHostedService
{ {
public class TimedHostedService : IHostedService, IDisposable private readonly Timer _APCDataTimer;
private readonly Timer _EDADataTimer;
private readonly Timer _EAFLogDataTimer;
private readonly int _ExecutionCount;
private readonly List<Timer> _Timers;
private readonly Serilog.ILogger _Log;
private readonly Background _Background;
private readonly IsEnvironment _IsEnvironment;
private readonly IBackground _BackgroundMethods;
public TimedHostedService(IsEnvironment isEnvironment, Background background)
{ {
_Timers = new();
_ExecutionCount = 0;
_Background = background;
_IsEnvironment = isEnvironment;
_BackgroundMethods = background;
_Log = Serilog.Log.ForContext<TimedHostedService>();
_APCDataTimer = new Timer(APCDataCallback, null, Timeout.Infinite, Timeout.Infinite);
_EAFLogDataTimer = new Timer(EAFLogDataCallback, null, Timeout.Infinite, Timeout.Infinite);
_EDADataTimer = new Timer(EDADataCallback, null, Timeout.Infinite, Timeout.Infinite);
}
private readonly int _ExecutionCount; public Task StartAsync(CancellationToken stoppingToken)
private readonly WebClient _WebClient; {
private readonly Background _Background; string? methodName = IMethodName.GetActualAsyncMethodName();
private readonly IConfiguration _Configuration; using (LogContext.PushProperty("MethodName", methodName))
private readonly ILogger<TimedHostedService> _Log;
private Timer _APCDataTimer;
private Timer _EDADataTimer;
private Timer _EAFLogDataTimer;
public TimedHostedService(Background background, IConfiguration configuration, IServiceProvider serviceProvider)
{ {
_ExecutionCount = 0; _Log.Info(string.Concat("Timed Hosted Service: ", _IsEnvironment.Profile, ":", Environment.ProcessId, " running."));
_Background = background; int milliSeconds = 3000;
_Configuration = configuration; if (_IsEnvironment.Development)
_WebClient = serviceProvider.GetRequiredService<WebClient>();
_Log = serviceProvider.GetRequiredService<ILogger<TimedHostedService>>();
//_HttpContextAccessor = serviceProvider.GetRequiredService<IHttpContextAccessor>();
_WebClient = serviceProvider.GetRequiredService<WebClient>();
}
public Task StartAsync(CancellationToken stoppingToken)
{
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _Background.IsEnvironment.Profile, ":", Environment.ProcessId, " running."));
_Background.Update(_Log, _WebClient);
if (_Background.IsEnvironment.Development)
{ {
int milliSeconds = 3000;
if (milliSeconds == 0) if (milliSeconds == 0)
{ } { }
} }
else if (_Background.IsEnvironment.Staging) else if (_IsEnvironment.Staging)
{ {
int milliSeconds = 3000; _ = _APCDataTimer.Change(milliSeconds, Timeout.Infinite);
_APCDataTimer = new Timer(APCDataCallback, null, milliSeconds, Timeout.Infinite); _Timers.Add(_APCDataTimer);
_Background.Timers.Add(_APCDataTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EAFLogDataTimer = new Timer(EAFLogDataCallback, null, milliSeconds, Timeout.Infinite); _ = _EAFLogDataTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_EAFLogDataTimer); _Timers.Add(_EAFLogDataTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EDADataTimer = new Timer(EDADataCallback, null, milliSeconds, Timeout.Infinite); _ = _EDADataTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_EDADataTimer); _Timers.Add(_EDADataTimer);
milliSeconds += 2000; milliSeconds += 2000;
} }
else if (_Background.IsEnvironment.Production) else if (_IsEnvironment.Production)
{ {
int milliSeconds = 3000; _ = _APCDataTimer.Change(milliSeconds, Timeout.Infinite);
_APCDataTimer = new Timer(APCDataCallback, null, milliSeconds, Timeout.Infinite); _Timers.Add(_APCDataTimer);
_Background.Timers.Add(_APCDataTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EAFLogDataTimer = new Timer(EAFLogDataCallback, null, milliSeconds, Timeout.Infinite); _ = _EAFLogDataTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_EAFLogDataTimer); _Timers.Add(_EAFLogDataTimer);
milliSeconds += 2000; milliSeconds += 2000;
_EDADataTimer = new Timer(EDADataCallback, null, milliSeconds, Timeout.Infinite); _ = _EDADataTimer.Change(milliSeconds, Timeout.Infinite);
_Background.Timers.Add(_EDADataTimer); _Timers.Add(_EDADataTimer);
milliSeconds += 2000; milliSeconds += 2000;
} }
else else
throw new Exception(); throw new Exception();
if (_Background.IsEnvironment.Staging || _Background.IsEnvironment.Production)
{
string countDirectory = _Background.GetCountDirectory("Start");
string checkDirectory = Path.GetPathRoot(countDirectory);
if (Directory.Exists(checkDirectory))
Directory.CreateDirectory(countDirectory);
}
return Task.CompletedTask;
} }
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken stoppingToken) public Task StopAsync(CancellationToken stoppingToken)
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{ {
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _Background.IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping.")); _Log.Info(string.Concat("Timed Hosted Service: ", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping."));
_Background.Stop(immediate: true); _BackgroundMethods.Stop(immediate: true);
for (short i = 0; i < short.MaxValue; i++) for (short i = 0; i < short.MaxValue; i++)
{ {
Thread.Sleep(500); Thread.Sleep(500);
if (_ExecutionCount == 0) if (_ExecutionCount == 0)
break; break;
} }
return Task.CompletedTask;
} }
return Task.CompletedTask;
}
public void Dispose() private void APCDataCallback(object? state)
{
try
{ {
_Background.Dispose(); string? methodName = IMethodName.GetActualAsyncMethodName();
} using (LogContext.PushProperty("MethodName", methodName))
private void APCDataCallback(object state)
{
try
{ {
if (_Background.IsPrimaryInstance()) if (_BackgroundMethods.IsPrimaryInstance())
_Background.APCDataCallback(); _Background.APCDataCallback();
} }
catch (Exception e) { _Background.Catch(e); }
try
{
TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_APCDataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Background.Catch(e); }
} }
catch (Exception e) { _Log.Error(e, "Error: "); }
private void EDADataCallback(object state) try
{ {
try TimeSpan timeSpan;
if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_ = _APCDataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Log.Error(e, "Error: "); }
}
private void EDADataCallback(object? state)
{
try
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{ {
if (_Background.IsPrimaryInstance()) if (_BackgroundMethods.IsPrimaryInstance())
_Background.EDADataCallback(); _Background.EDADataCallback();
} }
catch (Exception e) { _Background.Catch(e); }
try
{
TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_EDADataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Background.Catch(e); }
} }
catch (Exception e) { _Log.Error(e, "Error: "); }
private void EAFLogDataCallback(object state) try
{ {
try TimeSpan timeSpan;
if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_ = _EDADataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Log.Error(e, "Error: "); }
}
private void EAFLogDataCallback(object? state)
{
try
{
string? methodName = IMethodName.GetActualAsyncMethodName();
using (LogContext.PushProperty("MethodName", methodName))
{ {
if (_Background.IsPrimaryInstance()) if (_BackgroundMethods.IsPrimaryInstance())
_Background.EAFLogDataCallback(); _Background.EAFLogDataCallback();
} }
catch (Exception e) { _Background.Catch(e); }
try
{
TimeSpan timeSpan;
if (!_Background.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_EAFLogDataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Background.Catch(e); }
} }
catch (Exception e) { _Log.Error(e, "Error: "); }
try
{
TimeSpan timeSpan;
if (!_BackgroundMethods.IsPrimaryInstance())
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
else
timeSpan = new TimeSpan(DateTime.Now.AddMinutes(1).Ticks - DateTime.Now.Ticks);
_ = _EAFLogDataTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
}
catch (Exception e) { _Log.Error(e, "Error: "); }
} }
} }

View File

@ -0,0 +1,167 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace IFX.Shared;
public class IsEnvironment
{
public enum Name
{
LinuxDevelopment,
LinuxProduction,
LinuxStaging,
OSXDevelopment,
OSXProduction,
OSXStaging,
WindowsDevelopment,
WindowsProduction,
WindowsStaging
}
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
public bool Development { get; private set; }
public bool Linux { get; private set; }
public bool OSX { get; private set; }
public bool Production { get; private set; }
public bool Staging { get; private set; }
public bool Windows { get; private set; }
public string Profile { get; private set; }
public string AppSettingsFileName { get; private set; }
public string? ASPNetCoreEnvironment { get; private set; }
public IsEnvironment(string testCategory)
{
if (testCategory.EndsWith(".json"))
{
Production = testCategory == "appsettings.json";
Staging = testCategory.EndsWith(nameof(Staging));
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Development = testCategory.EndsWith(nameof(Development));
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
}
else
{
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
{
Staging = isStaging;
Production = isProduction;
Development = isDevelopment;
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
{
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
Production = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
Development = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else
{
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount);
}
private string GetProfile()
{
string result;
if (Windows && Production)
result = nameof(Production);
else if (Windows && Staging)
result = nameof(Staging);
else if (Windows && Development)
result = nameof(Development);
else if (Linux && Production)
result = nameof(Name.LinuxProduction);
else if (Linux && Staging)
result = nameof(Name.LinuxStaging);
else if (Linux && Development)
result = nameof(Name.LinuxDevelopment);
else if (OSX && Production)
result = nameof(Name.OSXProduction);
else if (OSX && Staging)
result = nameof(Name.OSXStaging);
else if (OSX && Development)
result = nameof(Name.OSXDevelopment);
else
throw new Exception();
return result;
}
private string GetAppSettingsFileName(int? processesCount)
{
string result;
if (Production)
{
if (processesCount is null)
result = "appsettings.json";
else
result = $"appsettings.{processesCount}.json";
}
else
{
string environment;
if (Staging)
environment = nameof(Staging);
else if (Development)
environment = nameof(Development);
else
throw new Exception();
if (processesCount is null)
result = $"appsettings.{environment}.json";
else
result = $"appsettings.{environment}.{processesCount}.json";
}
return result;
}
public static string GetEnvironmentName(IsEnvironment isEnvironment)
{
string result;
if (isEnvironment.Windows)
result = nameof(IsEnvironment.Windows);
else if (isEnvironment.Linux)
result = nameof(IsEnvironment.Linux);
else if (isEnvironment.OSX)
result = nameof(IsEnvironment.OSX);
else
throw new Exception();
return result;
}
}

View File

@ -0,0 +1,93 @@
#pragma warning disable SYSLIB0022
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace IFX.Shared;
public static class RijndaelEncryption
{
/// <summary>
/// Change the Inputkey GUID when you use this code in your own program.
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
/// Generated 2021-08-10
/// </summary>
internal const string _Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
/// <summary>
/// Encrypt the given text and give the byte array back as a BASE64 string
/// </summary>
/// <param name="text">The text to encrypt</param>
/// <param name="salt">The pasword salt</param>
/// <returns>The encrypted text</returns>
public static string Encrypt(string text, string salt)
{
string result;
if (string.IsNullOrEmpty(text))
throw new ArgumentNullException(nameof(text));
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
MemoryStream msEncrypt = new();
using (CryptoStream csEncrypt = new(msEncrypt, encryptor, CryptoStreamMode.Write))
using (StreamWriter swEncrypt = new(csEncrypt))
swEncrypt.Write(text);
result = Convert.ToBase64String(msEncrypt.ToArray());
return result;
}
/// <summary>
/// Checks if a string is base64 encoded
/// </summary>
/// <param name="base64String">The base64 encoded string</param>
/// <returns></returns>
public static bool IsBase64String(string base64String)
{
bool result;
base64String = base64String.Trim();
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
return result;
}
/// <summary>
/// Decrypts the given text
/// </summary>
/// <param name="cipherText">The encrypted BASE64 text</param>
/// <param name="salt">The pasword salt</param>
/// <returns>De gedecrypte text</returns>
public static string Decrypt(string cipherText, string salt)
{
if (string.IsNullOrEmpty(cipherText))
throw new ArgumentNullException(nameof(cipherText));
if (!IsBase64String(cipherText))
throw new Exception("The cipherText input parameter is not base64 encoded");
string text;
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
byte[] cipher = Convert.FromBase64String(cipherText);
using (MemoryStream msDecrypt = new(cipher))
{
using CryptoStream csDecrypt = new(msDecrypt, decryptor, CryptoStreamMode.Read);
using StreamReader srDecrypt = new(csDecrypt);
text = srDecrypt.ReadToEnd();
}
return text;
}
/// <summary>
/// Create a new RijndaelManaged class and initialize it
/// </summary>
/// <param name="salt">The pasword salt</param>
/// <returns></returns>
private static RijndaelManaged NewRijndaelManaged(string salt)
{
if (salt == null)
throw new ArgumentNullException(nameof(salt));
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
Rfc2898DeriveBytes key = new(_Inputkey, saltBytes);
RijndaelManaged aesAlg = new();
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
return aesAlg;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -2,47 +2,46 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Library.Eaf.Core namespace Library.Eaf.Core;
public class Backbone
{ {
public class Backbone public const string STATE_ERROR = "Error";
{ public const string STATE_OFFLINE = "Offline";
public const string STATE_ERROR = "Error"; public const string STATE_RUNNING = "Running";
public const string STATE_OFFLINE = "Offline"; public const string STATE_SHUTDOWN = "Shutting Down";
public const string STATE_RUNNING = "Running"; public const string STATE_STARTING = "Starting";
public const string STATE_SHUTDOWN = "Shutting Down";
public const string STATE_STARTING = "Starting";
protected Backbone() { } protected Backbone() { }
[NotNull] [NotNull]
public static Backbone Instance { get; } public static Backbone Instance { get; }
[NotNull] [NotNull]
public ILoggingSetupManager LoggingConfigurationManager { get; set; } public ILoggingSetupManager LoggingConfigurationManager { get; set; }
public BackboneStatusCache Status { get; } public BackboneStatusCache Status { get; }
public bool IsAutomatedRestartActive { get; } public bool IsAutomatedRestartActive { get; }
public bool IsReadyForRestart { get; } public bool IsReadyForRestart { get; }
public string StartTime { get; } public string StartTime { get; }
public string State { get; } public string State { get; }
public string Name { get; } public string Name { get; }
public string ConfigurationServiceAddress { get; } public string ConfigurationServiceAddress { get; }
public string CellName { get; } public string CellName { get; }
protected bool IsInitialized { get; set; } protected bool IsInitialized { get; set; }
protected Dictionary<string, BackboneComponent> BackboneComponents { get; } protected Dictionary<string, BackboneComponent> BackboneComponents { get; }
public void AddBackboneComponent(BackboneComponent backboneComponent) { } 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.")] [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 List<StatusItem> GetAllStatuses() => throw new NotImplementedException();
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); } public BackboneComponent GetBackboneComponentById(string id) => throw new NotImplementedException();
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); } public List<T> GetBackboneComponentsOfType<T>() => throw new NotImplementedException();
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); } public List<BackboneComponent> GetBackboneComponentsOfType(Type type) => throw new NotImplementedException();
public void RegisterSubprocess(int pid) { } public void RegisterSubprocess(int pid) { }
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
public void SetStatus(string statusName, string statusValue) { } public void SetStatus(string statusName, string statusValue) { }
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")] [Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
public void SetStatus(BackboneComponent source, string statusName, string statusValue) { } public void SetStatus(BackboneComponent source, string statusName, string statusValue) { }
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { } protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
protected virtual void StopAllComponents() { } protected virtual void StopAllComponents() { }
protected void StopComponents(List<BackboneComponent> components) { } protected void StopComponents(List<BackboneComponent> components) { }
} }
}

View File

@ -1,24 +1,21 @@
using System; using System;
namespace Library.Eaf.Core.Smtp namespace Library.Eaf.Core.Smtp;
public class EmailMessage
{ {
public EmailMessage() { }
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
public class EmailMessage public string Body { get; }
{ public MailPriority Priority { get; }
public EmailMessage() { } public string Subject { get; }
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
public string Body { get; } public EmailMessage PriorityHigh() => throw new NotImplementedException();
public MailPriority Priority { get; } public EmailMessage PriorityLow() => throw new NotImplementedException();
public string Subject { get; } 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 Library.Eaf.Core.Smtp namespace Library.Eaf.Core.Smtp;
public interface ISmtp
{ {
void Send(EmailMessage message);
public interface ISmtp }
{
void Send(EmailMessage message);
}
}

View File

@ -1,11 +1,8 @@
namespace Library.Eaf.Core.Smtp namespace Library.Eaf.Core.Smtp;
public enum MailPriority
{ {
Low = 0,
public enum MailPriority Normal = 1,
{ High = 2
Low = 0, }
Normal = 1,
High = 2
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,15 @@
using Library.PeerGroup.GCL.Annotations; using Library.PeerGroup.GCL.Annotations;
namespace Library.Eaf.EquipmentCore.Control namespace Library.Eaf.EquipmentCore.Control;
public interface IEquipmentControl : IPackageSource
{ {
public interface IEquipmentControl : IPackageSource [NotNull]
{ IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
[NotNull] [NotNull]
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; } IEquipmentDataCollection DataCollection { get; }
[NotNull] [NotNull]
IEquipmentDataCollection DataCollection { get; } IEquipmentCommandService Commands { get; }
[NotNull] [NotNull]
IEquipmentCommandService Commands { get; } IConnectionControl Connection { get; }
[NotNull] }
IConnectionControl Connection { get; }
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,37 +3,36 @@ using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Library.Eaf.EquipmentCore.Control namespace Library.Eaf.EquipmentCore.Control;
{
public interface IEquipmentDataCollection
{
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
ISelfDescriptionLookup SelfDescriptionLookup { get; }
EquipmentSelfDescription SelfDescription { get; }
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
IDataTracingHandler DataTracingHandler { get; }
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value); public interface IEquipmentDataCollection
void NotifyDataTracingAvailable(bool isAvailable); {
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler); IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
void RegisterDataTracingHandler(IDataTracingHandler handler); ISelfDescriptionLookup SelfDescriptionLookup { get; }
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler); EquipmentSelfDescription SelfDescription { get; }
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler); IEnumerable<DataCollectionRequest> ActiveRequests { get; }
void TriggerDeactivate(DataCollectionRequest deactivateRequest); IDataTracingHandler DataTracingHandler { get; }
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage); ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters); void NotifyDataTracingAvailable(bool isAvailable);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage); void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride); void RegisterDataTracingHandler(IDataTracingHandler handler);
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage); void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride); void TriggerDeactivate(DataCollectionRequest deactivateRequest);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage); void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters); void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerPerformanceRestored(); void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
void TriggerPerformanceWarning(); void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters); void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage); void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp); void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
} void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
} void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
void TriggerPerformanceRestored();
void TriggerPerformanceWarning();
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
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 Library.Eaf.EquipmentCore.Control namespace Library.Eaf.EquipmentCore.Control;
public interface IPackageSource
{ {
public interface IPackageSource }
{
}
}

View File

@ -2,19 +2,18 @@
using Library.PeerGroup.GCL.Annotations; using Library.PeerGroup.GCL.Annotations;
using System; using System;
namespace Library.Eaf.EquipmentCore.DataCollection.Reporting namespace Library.Eaf.EquipmentCore.DataCollection.Reporting;
public class ParameterValue
{ {
public class ParameterValue public ParameterValue(EquipmentParameter definition, object value) { }
{ public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
public ParameterValue(EquipmentParameter definition, object value) { }
public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
public virtual object Value { get; protected internal set; } public virtual object Value { get; protected internal set; }
[NotNull] [NotNull]
public EquipmentParameter Definition { get; } public EquipmentParameter Definition { get; }
public DateTime Timestamp { get; protected set; } public DateTime Timestamp { get; protected set; }
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); } public virtual ParameterValue Clone(EquipmentParameter newDefinition) => throw new NotImplementedException();
public override string ToString() { return base.ToString(); } public override string ToString() => base.ToString();
} }
}

View File

@ -1,24 +1,22 @@
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes; using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
namespace Library.Eaf.EquipmentCore.SelfDescription.ElementDescription namespace Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
public class EquipmentParameter
{ {
public class EquipmentParameter public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
{ public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { } public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
public string Name { get; } public string Name { get; }
public string Id { get; } public string Id { get; }
public string Description { get; } public string Description { get; }
public string SourcePath { get; } public string SourcePath { get; }
public string SourceEquipment { get; } public string SourceEquipment { get; }
public ParameterTypeDefinition TypeDefinition { get; } public ParameterTypeDefinition TypeDefinition { get; }
public bool IsTransient { get; } public bool IsTransient { get; }
public bool IsReadOnly { get; } public bool IsReadOnly { get; }
public override string ToString() { return base.ToString(); } public override string ToString() => base.ToString();
public string ToStringWithDetails() { return base.ToString(); } public string ToStringWithDetails() => base.ToString();
} }
}

View File

@ -1,12 +1,11 @@
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
{
public class Field
{
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
public string Name { get; } public class Field
public string Description { get; } {
public ParameterTypeDefinition TypeDefinition { get; } public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
public bool CanBeNull { get; }
} public string Name { get; }
} public string Description { get; }
public ParameterTypeDefinition TypeDefinition { get; }
public bool CanBeNull { get; }
}

View File

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

View File

@ -1,12 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
public class StructuredType : ParameterTypeDefinition
{ {
public class StructuredType : ParameterTypeDefinition
{
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { } public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
public IList<Field> Fields { get; } public IList<Field> Fields { get; }
} }
}

View File

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

View File

@ -1,26 +1,25 @@
using System; using System;
namespace Library.Eaf.Management.ConfigurationData.CellAutomation namespace Library.Eaf.Management.ConfigurationData.CellAutomation;
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
public class ModelObjectParameterDefinition : IConfigurationObject
{ {
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)] public ModelObjectParameterDefinition() { }
public class ModelObjectParameterDefinition : IConfigurationObject public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
{ public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
public ModelObjectParameterDefinition() { }
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public virtual long Id { get; set; } public virtual long Id { get; set; }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public virtual string Name { get; set; } public virtual string Name { get; set; }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public virtual string Value { get; set; } public virtual string Value { get; set; }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public virtual ModelObjectParameterType ValueType { get; set; } public virtual ModelObjectParameterType ValueType { get; set; }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataMemberAttribute]
public virtual string EnumType { get; set; } public virtual string EnumType { get; set; }
public virtual ModelObjectParameterDefinition Clone() { return null; } public virtual ModelObjectParameterDefinition? Clone() => null;
public virtual bool IsValidValue(string value) { return false; } public virtual bool IsValidValue(string value) => false;
} }
}

View File

@ -1,17 +1,16 @@
namespace Library.Eaf.Management.ConfigurationData.CellAutomation namespace Library.Eaf.Management.ConfigurationData.CellAutomation;
public enum ModelObjectParameterType
{ {
public enum ModelObjectParameterType String = 0,
{ Bool = 1,
String = 0, Byte = 2,
Bool = 1, SignedByte = 3,
Byte = 2, Integer = 4,
SignedByte = 3, UnsignedInteger = 5,
Integer = 4, LongInteger = 6,
UnsignedInteger = 5, UnsignedLongInteger = 7,
LongInteger = 6, Double = 8,
UnsignedLongInteger = 7, Float = 9,
Double = 8, Enum = 10
Float = 9, }
Enum = 10
}
}

View File

@ -1,44 +1,43 @@
using Library.PeerGroup.GCL.SecsDriver; using Library.PeerGroup.GCL.SecsDriver;
using System; using System;
namespace Library.Eaf.Management.ConfigurationData.Semiconductor.CellInstances namespace Library.Eaf.Management.ConfigurationData.Semiconductor.CellInstances;
{
[System.Runtime.Serialization.DataContractAttribute]
public class SecsConnectionConfiguration
{
public SecsConnectionConfiguration() { }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataContractAttribute]
public virtual TimeSpan T6HsmsControlMessage { get; set; } public class SecsConnectionConfiguration
[System.Runtime.Serialization.DataMemberAttribute] {
public virtual TimeSpan T5ConnectionSeperation { get; set; } public SecsConnectionConfiguration() { }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T4InterBlock { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T6HsmsControlMessage { get; set; }
public virtual TimeSpan T3MessageReply { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T5ConnectionSeperation { get; set; }
public virtual TimeSpan T2Protocol { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T4InterBlock { get; set; }
public virtual TimeSpan T1InterCharacter { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T3MessageReply { get; set; }
public virtual SerialBaudRate? BaudRate { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T2Protocol { get; set; }
public virtual SecsTransportType? PortType { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan T1InterCharacter { get; set; }
public virtual long? Port { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual SerialBaudRate? BaudRate { get; set; }
public virtual TimeSpan LinkTestTimer { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual SecsTransportType? PortType { get; set; }
public virtual string Host { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual long? Port { get; set; }
public virtual long? DeviceId { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual TimeSpan LinkTestTimer { get; set; }
public virtual HsmsSessionMode? SessionMode { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual string Host { get; set; }
public virtual HsmsConnectionMode? ConnectionMode { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual long? DeviceId { get; set; }
public virtual TimeSpan T7ConnectionIdle { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
[System.Runtime.Serialization.DataMemberAttribute] public virtual HsmsSessionMode? SessionMode { get; set; }
public virtual TimeSpan T8NetworkIntercharacter { get; set; } [System.Runtime.Serialization.DataMemberAttribute]
} public virtual HsmsConnectionMode? ConnectionMode { get; set; }
} [System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T7ConnectionIdle { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
}

View File

@ -1,13 +1,12 @@
namespace Library.Ifx.Eaf.Common.Configuration namespace Library.Ifx.Eaf.Common.Configuration;
{
[System.Runtime.Serialization.DataContractAttribute]
public class ConnectionSetting
{
public ConnectionSetting(string name, string value) { }
[System.Runtime.Serialization.DataMemberAttribute] [System.Runtime.Serialization.DataContractAttribute]
public string Name { get; set; } public class ConnectionSetting
[System.Runtime.Serialization.DataMemberAttribute] {
public string Value { get; set; } public ConnectionSetting(string name, string value) { }
}
} [System.Runtime.Serialization.DataMemberAttribute]
public string Name { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string Value { get; set; }
}

View File

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

View File

@ -2,34 +2,33 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component namespace Library.Ifx.Eaf.EquipmentConnector.File.Component;
public class FilePathGenerator
{ {
public class FilePathGenerator public const char PLACEHOLDER_IDENTIFIER = '%';
{ public const char PLACEHOLDER_SEPARATOR = ':';
public const char PLACEHOLDER_IDENTIFIER = '%'; public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
public const char PLACEHOLDER_SEPARATOR = ':'; public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName";
public const string PLACEHOLDER_NOT_AVAILABLE = "NA"; public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension";
public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName"; public const string PLACEHOLDER_DATE_TIME = "DateTime";
public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension"; public const string PLACEHOLDER_SUB_FOLDER = "SubFolder";
public const string PLACEHOLDER_DATE_TIME = "DateTime"; public const string PLACEHOLDER_CELL_NAME = "CellName";
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, 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, 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, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string>? customPattern = null) => throw new NotImplementedException();
protected string SubFolderPath { get; } protected string SubFolderPath { get; }
protected FileConnectorConfiguration Configuration { get; } protected FileConnectorConfiguration Configuration { get; }
protected File File { get; } protected File File { get; }
protected bool IsErrorFile { get; } protected bool IsErrorFile { get; }
protected string DefaultPlaceHolderValue { get; } protected string DefaultPlaceHolderValue { get; }
public string GetFullTargetPath() { throw new NotImplementedException(); } public string GetFullTargetPath() => throw new NotImplementedException();
public virtual string GetTargetFileName() { throw new NotImplementedException(); } public virtual string GetTargetFileName() => throw new NotImplementedException();
public string GetTargetFolder(bool throwExceptionIfNotExist = true) { 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 GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException();
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); } protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException();
protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); } protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException();
} }
}

View File

@ -2,134 +2,133 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Library.Ifx.Eaf.EquipmentConnector.File.Configuration namespace Library.Ifx.Eaf.EquipmentConnector.File.Configuration;
[System.Runtime.Serialization.DataContractAttribute]
public class FileConnectorConfiguration
{ {
[System.Runtime.Serialization.DataContractAttribute] public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
public class FileConnectorConfiguration public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? TriggerOnChanged { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? PostProcessingRetries { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? CopySourceFolderStructure { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string AlternateTargetFolder { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? FileHandleTimeout { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? DeleteEmptySourceSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? IdleEventWaitTimeInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string FileAgeThreshold { get; set; }
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual ZipModeEnum? ZipMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipErrorTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ZipFileSubFolderLevel { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string DefaultPlaceHolderValue { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? UseZip64Mode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public List<ConnectionSetting> ConnectionSettings { get; set; }
public string SourceDirectoryCloaking { get; set; }
public string FolderAgeThreshold { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileScanningIntervalInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? TriggerOnCreated { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileFilter { get; set; }
public List<string> SourceFileFilters { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? IncludeSubDirectories { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileHandleWaitTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public IfFileExistEnum? IfFileExistAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ConnectionRetryInterval { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PreProcessingModeEnum? PreProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? PostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileAmount { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileName { get; set; }
public void Initialize() => throw new NotImplementedException();
public enum PostProcessingModeEnum
{ {
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360; None = 0,
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15; Move = 1,
Copy = 2,
[System.Runtime.Serialization.DataMemberAttribute] Rename = 3,
public virtual bool? TriggerOnChanged { get; set; } Zip = 4,
[System.Runtime.Serialization.DataMemberAttribute] Delete = 5,
public virtual long? PostProcessingRetries { get; set; } MoveFolder = 6,
[System.Runtime.Serialization.DataMemberAttribute] CopyFolder = 7,
public virtual bool? CopySourceFolderStructure { get; set; } DeleteFolder = 8
[System.Runtime.Serialization.DataMemberAttribute]
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string AlternateTargetFolder { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? FileHandleTimeout { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? DeleteEmptySourceSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? IdleEventWaitTimeInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string FileAgeThreshold { get; set; }
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual ZipModeEnum? ZipMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ZipErrorTargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ZipFileSubFolderLevel { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string DefaultPlaceHolderValue { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public bool? UseZip64Mode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public List<ConnectionSetting> ConnectionSettings { get; set; }
public string SourceDirectoryCloaking { get; set; }
public string FolderAgeThreshold { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileScanningIntervalInSeconds { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? TriggerOnCreated { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string SourceFileFilter { get; set; }
public List<string> SourceFileFilters { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual bool? IncludeSubDirectories { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileLocation { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string TargetFileName { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? FileHandleWaitTime { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public IfFileExistEnum? IfFileExistAction { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public long? ConnectionRetryInterval { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PreProcessingModeEnum? PreProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? PostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public virtual long? ZipFileAmount { get; set; }
[System.Runtime.Serialization.DataMemberAttribute]
public string ErrorTargetFileName { get; set; }
public void Initialize() { throw new NotImplementedException(); }
public enum PostProcessingModeEnum
{
None = 0,
Move = 1,
Copy = 2,
Rename = 3,
Zip = 4,
Delete = 5,
MoveFolder = 6,
CopyFolder = 7,
DeleteFolder = 8
}
public enum PreProcessingModeEnum
{
None = 0,
Process = 1
}
public enum IfFileExistEnum
{
Overwrite = 0,
LeaveFiles = 1,
Delete = 2
}
public enum IfPostProcessingFailsEnum
{
LeaveFiles = 0,
Delete = 1
}
public enum FileScanningOptionEnum
{
FileWatcher = 0,
TimeBased = 1
}
public enum ZipModeEnum
{
ZipByAmountOrTime = 0,
ZipByFileName = 1,
ZipBySubFolderName = 2
}
public enum FileAgeFilterEnum
{
IgnoreNewer = 0,
IgnoreOlder = 1
}
} }
} public enum PreProcessingModeEnum
{
None = 0,
Process = 1
}
public enum IfFileExistEnum
{
Overwrite = 0,
LeaveFiles = 1,
Delete = 2
}
public enum IfPostProcessingFailsEnum
{
LeaveFiles = 0,
Delete = 1
}
public enum FileScanningOptionEnum
{
FileWatcher = 0,
TimeBased = 1
}
public enum ZipModeEnum
{
ZipByAmountOrTime = 0,
ZipByFileName = 1,
ZipBySubFolderName = 2
}
public enum FileAgeFilterEnum
{
IgnoreNewer = 0,
IgnoreOlder = 1
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,16 +1,15 @@
namespace Library.PeerGroup.GCL.SecsDriver namespace Library.PeerGroup.GCL.SecsDriver;
public enum SerialBaudRate
{ {
public enum SerialBaudRate Baud9600 = 0,
{ Baud19200 = 1,
Baud9600 = 0, Baud4800 = 2,
Baud19200 = 1, Baud2400 = 3,
Baud4800 = 2, Baud1200 = 4,
Baud2400 = 3, Baud300 = 5,
Baud1200 = 4, Baud150 = 6,
Baud300 = 5, Baud38400 = 7,
Baud150 = 6, Baud57600 = 8,
Baud38400 = 7, Baud115200 = 9
Baud57600 = 8, }
Baud115200 = 9
}
}

View File

@ -1,12 +1,46 @@
namespace APCViewer.Models using System.Text.Json;
using System.Text.Json.Serialization;
namespace APCViewer.Models;
public class AppSettings
{ {
public class AppSettings
protected string _Company;
protected string _EncryptedPassword;
protected string _MonARessource;
protected string _Server;
protected string _ServiceUser;
protected string _URLs;
protected string _WorkingDirectoryName;
public string Company => _Company;
public string EncryptedPassword => _EncryptedPassword;
public string MonARessource => _MonARessource;
public string Server => _Server;
public string ServiceUser => _ServiceUser;
public string URLs => _URLs;
public string WorkingDirectoryName => _WorkingDirectoryName;
// public AppSettings()
// {
// }
[JsonConstructor]
public AppSettings(string company, string encryptedPassword, string monARessource, string server, string serviceUser, string urls, string workingDirectoryName)
{ {
public string Company { get; set; } _Company = company;
public string EncryptedPassword { get; set; } _EncryptedPassword = encryptedPassword;
public string MonARessource { get; set; } _MonARessource = monARessource;
public string Server { get; set; } _Server = server;
public string ServiceUser { get; set; } _ServiceUser = serviceUser;
public string URLs { get; set; } _URLs = urls;
_WorkingDirectoryName = workingDirectoryName;
} }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
} }

View File

@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
namespace APCViewer.Models.Binder;
public class AppSettings
{
[Display(Name = "Company"), Required] public string Company { get; set; }
[Display(Name = "Encrypted Password"), Required] public string EncryptedPassword { get; set; }
[Display(Name = "MonARessource"), Required] public string MonARessource { get; set; }
[Display(Name = "Server"), Required] public string Server { get; set; }
[Display(Name = "Service User"), Required] public string ServiceUser { get; set; }
[Display(Name = "URLs"), Required] public string URLs { get; set; }
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
public AppSettings()
{
Company = string.Empty;
EncryptedPassword = string.Empty;
MonARessource = string.Empty;
Server = string.Empty;
ServiceUser = string.Empty;
URLs = string.Empty;
WorkingDirectoryName = string.Empty;
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}

View File

@ -1,9 +1,8 @@
namespace APCViewer.Models namespace APCViewer.Models;
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); public class ErrorViewModel
} {
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
} }

View File

@ -1,91 +0,0 @@
namespace APCViewer.Models
{
public interface IBackground
{
void APCDataCallback();
// public void DataForApc(string workingDirectory, bool isGaN = false, bool isSi = false)
// {
// long ticks = DateTime.Now.Ticks;
// string server = GetServer(debugIsNotEC: false);
// Logic2019Q2 logic2019Q2 = new Logic2019Q2(_Log);
// Logic2020Q3 logic2020Q3 = new Logic2020Q3(_Log);
// string[] equipmentTypes = GetEquipmentTypes(isGaN, isSi);
// Dictionary<string, string> pdsfFiles = new Dictionary<string, string>();
// Dictionary<string, object> apcLogistics = new Dictionary<string, object>();
// Dictionary<string, object> edaLogistics = new Dictionary<string, object>();
// Dictionary<string, object> eafLogLogistics = new Dictionary<string, object>();
// logic2019Q2.Data(server, equipmentTypes, apcLogistics, pdsfFiles, isAPC: true);
// Tuple<int, object, object, string> tuple = logic2020Q3.SetViewBag(apcLogistics, edaLogistics, eafLogLogistics, directory: null, filter: null, forPDSF: true, forIPDSF: false);
// if (tuple is null) { }
// List<string[]> timePivot = logic2020Q3.GetTimePivot(equipmentTypes, apcLogistics, edaLogistics, eafLogLogistics, forPDSF: true, forIPDSF: false);
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// List<string> list = new List<string>();
// StringBuilder stringBuilder = new StringBuilder();
// foreach (string[] segments in timePivot)
// {
// foreach (string segment in segments)
// stringBuilder.Append(segment).Append('\t');
// list.Add(stringBuilder.ToString());
// stringBuilder.Clear();
// }
// ShowWindow(workingDirectory, ShowWindowCommand.ShowMaximized, list);
// }
void EAFLogDataCallback();
// public void DataForEafLog(string workingDirectory, bool isGaN = false, bool isSi = false)
// {
// long ticks = DateTime.Now.Ticks;
// string server = GetServer(debugIsNotEC: false);
// Logic2019Q2 logic2019Q2 = new Logic2019Q2(_Log);
// Logic2020Q3 logic2020Q3 = new Logic2020Q3(_Log);
// string[] equipmentTypes = GetEquipmentTypes(isGaN, isSi);
// Dictionary<string, string> pdsfFiles = new Dictionary<string, string>();
// Dictionary<string, object> apcLogistics = new Dictionary<string, object>();
// Dictionary<string, object> edaLogistics = new Dictionary<string, object>();
// Dictionary<string, object> eafLogLogistics = new Dictionary<string, object>();
// logic2019Q2.Data(server, equipmentTypes, eafLogLogistics, pdsfFiles, isEAFLog: true);
// Tuple<int, object, object, string> tuple = logic2020Q3.SetViewBag(apcLogistics, edaLogistics, eafLogLogistics, directory: null, filter: null, forPDSF: false, forIPDSF: true);
// if (tuple is null) { }
// List<string[]> timePivot = logic2020Q3.GetTimePivot(equipmentTypes, apcLogistics, edaLogistics, eafLogLogistics, forPDSF: false, forIPDSF: true);
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// List<string> list = new List<string>();
// StringBuilder stringBuilder = new StringBuilder();
// foreach (string[] segments in timePivot)
// {
// foreach (string segment in segments)
// stringBuilder.Append(segment).Append('\t');
// list.Add(stringBuilder.ToString());
// stringBuilder.Clear();
// }
// ShowWindow(workingDirectory, ShowWindowCommand.ShowMaximized, list);
// }
void EDADataCallback();
// public void DataForEda(string workingDirectory, bool isGaN = false, bool isSi = false)
// {
// long ticks = DateTime.Now.Ticks;
// string server = GetServer(debugIsNotEC: true);
// Logic2019Q2 logic2019Q2 = new Logic2019Q2(_Log);
// Logic2020Q3 logic2020Q3 = new Logic2020Q3(_Log);
// string[] equipmentTypes = GetEquipmentTypes(isGaN, isSi);
// Dictionary<string, string> pdsfFiles = new Dictionary<string, string>();
// Dictionary<string, object> apcLogistics = new Dictionary<string, object>();
// Dictionary<string, object> edaLogistics = new Dictionary<string, object>();
// Dictionary<string, object> eafLogLogistics = new Dictionary<string, object>();
// logic2019Q2.Data(server, equipmentTypes, edaLogistics, pdsfFiles, isEDA: true);
// Tuple<int, object, object, string> tuple = logic2020Q3.SetViewBag(apcLogistics, edaLogistics, eafLogLogistics, directory: null, filter: null, forPDSF: true, forIPDSF: false);
// if (tuple is null) { }
// List<string[]> timePivot = logic2020Q3.GetTimePivot(equipmentTypes, apcLogistics, edaLogistics, eafLogLogistics, forPDSF: true, forIPDSF: false);
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
// List<string> list = new List<string>();
// StringBuilder stringBuilder = new StringBuilder();
// foreach (string[] segments in timePivot)
// {
// foreach (string segment in segments)
// stringBuilder.Append(segment).Append('\t');
// list.Add(stringBuilder.ToString());
// stringBuilder.Clear();
// }
// ShowWindow(workingDirectory, ShowWindowCommand.ShowMaximized, list);
// }
}
}

View File

@ -1,25 +1,11 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace APCViewer.Models namespace APCViewer.Controllers;
{
public interface IHomeController
{
IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, bool? logistics_clear = null);
IActionResult DownloadCustomIPDSF(string ipdsf_file = null);
IActionResult DownloadCustomPDSF(string pdsf_file = null);
IActionResult DownloadIPDSF(string id = null);
IActionResult DownloadPDSF(string id = null);
IActionResult Encode(string value = null);
IActionResult Error();
IActionResult Index();
IActionResult IPDSF(string directory = null, string filter = null, bool is_gaN = false, bool is_Si = false);
IActionResult PDSF(string directory = null, string filter = null, bool is_gaN = false, bool is_Si = false);
IActionResult Privacy();
IActionResult TimePivot(bool is_gaN = false, bool is_Si = false);
ContentResult ViewCustomIPDSF(string ipdsf_file = null);
ContentResult ViewCustomPDSF(string pdsf_file = null);
ContentResult ViewIPDSF(string id = null);
ContentResult ViewPDSF(string id = null);
}
public interface IHomeController
{
ActionResult Encode(string value = "");
ActionResult Error();
ActionResult Index();
ActionResult Privacy();
} }

View File

@ -0,0 +1,19 @@
namespace APCViewer.Models.Methods;
public interface IBackground
{
void Update();
void ClearMessage();
List<string> DoBackup();
bool IsPrimaryInstance();
void Stop(bool immediate);
void SetIsPrimaryInstance();
string GetPDSF(long Sequence);
void ClearIsPrimaryInstance();
string GetIPDSF(long Sequence);
void Catch(Exception exception);
Tuple<List<string[]>, List<string[]>> GetTimePivot(bool isGaN = false, bool isSi = false);
Tuple<int, object, object, string> SetViewBag(string directory, string filter, bool isGaN = false, bool isSi = false, bool forPDSF = false, bool forIPDSF = false);
}

View File

@ -0,0 +1,6 @@
namespace APCViewer.Models.Properties;
public interface IBackground
{
}

View File

@ -0,0 +1,10 @@
namespace APCViewer.Models.Properties;
public interface IBackgroundController
{
public List<Exception> Exceptions { get; }
public string Message { get; }
public string WorkingDirectory { get; }
}

View File

@ -0,0 +1,24 @@
using System.Text.Json;
namespace APCViewer.Models.Stateless;
public abstract class AppSettings
{
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
{
Models.AppSettings? result;
Models.Binder.AppSettings appSettings = configurationRoot.Get<Models.Binder.AppSettings>();
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
if (result is null)
throw new Exception(json);
if (string.IsNullOrEmpty(result.Company))
throw new Exception(json);
string jsonThis = result.ToString();
if (jsonThis != json)
throw new Exception(json);
return result;
}
}

View File

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace APCViewer.Models.Stateless.Methods;
public interface IBackgroundController
{
ActionResult Index(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null);
static string GetRouteName() => nameof(IBackgroundController).Replace("Controller", string.Empty)[1..];
}

View File

@ -0,0 +1,10 @@
using System.Runtime.CompilerServices;
namespace APCViewer.Models.Stateless.Methods;
public interface IMethodName
{
static string? GetActualAsyncMethodName([CallerMemberName] string? name = null) => name;
}

View File

@ -0,0 +1,8 @@
namespace APCViewer.Models.Stateless.Methods;
public interface IWorkingDirectory
{
static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName) => WorkingDirectory.GetWorkingDirectory(executingAssemblyName, subDirectoryName);
}

View File

@ -0,0 +1,50 @@
namespace APCViewer.Models.Stateless.Methods;
internal abstract class WorkingDirectory
{
internal static string GetWorkingDirectory(string? executingAssemblyName, string subDirectoryName)
{
string result = string.Empty;
if (executingAssemblyName is null)
throw new Exception();
string traceFile;
List<string> directories = new();
Environment.SpecialFolder[] specialFolders = new Environment.SpecialFolder[]
{
Environment.SpecialFolder.LocalApplicationData,
Environment.SpecialFolder.ApplicationData,
Environment.SpecialFolder.History,
Environment.SpecialFolder.CommonApplicationData,
Environment.SpecialFolder.InternetCache
};
foreach (Environment.SpecialFolder specialFolder in specialFolders)
directories.Add(Path.Combine(Environment.GetFolderPath(specialFolder), subDirectoryName, executingAssemblyName));
foreach (string directory in directories)
{
for (int i = 1; i < 3; i++)
{
if (i == 1)
result = directory;
else
result = string.Concat("D", directory[1..]);
try
{
if (!Directory.Exists(result))
_ = Directory.CreateDirectory(result);
traceFile = string.Concat(result, @"\", DateTime.Now.Ticks, ".txt");
File.WriteAllText(traceFile, traceFile);
File.Delete(traceFile);
break;
}
catch (Exception) { result = string.Empty; }
}
if (!string.IsNullOrEmpty(result))
break;
}
if (string.IsNullOrEmpty(result))
throw new Exception("Unable to set working directory!");
return result;
}
}

View File

@ -0,0 +1,10 @@
namespace APCViewer.Models.Stateless;
public static class SerilogExtensionMethods
{
internal static void Warn(this Serilog.ILogger log, string messageTemplate) => log.Warning(messageTemplate);
internal static void Info(this Serilog.ILogger log, string messageTemplate) => log.Information(messageTemplate);
}

View File

@ -1,40 +1,90 @@
using Microsoft.AspNetCore.Hosting; using APCViewer.HostedService;
using Microsoft.Extensions.Configuration; using APCViewer.Models;
using Microsoft.Extensions.Hosting; using APCViewer.Models.Stateless.Methods;
using Shared; using IFX.Shared;
using System.Diagnostics; using Serilog;
using System.Reflection;
namespace APCViewer namespace APCViewer;
public class Program
{ {
public class Program public static int Main(string[] args)
{ {
LoggerConfiguration loggerConfiguration = new();
public static void Main(string[] args) // ConsoleLoggerConfigurationExtensions.Console(loggerConfiguration.WriteTo);
Assembly assembly = Assembly.GetExecutingAssembly();
string? assemblyName = assembly.GetName()?.Name;
if (string.IsNullOrEmpty(assemblyName))
throw new Exception();
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
AppSettings appSettings = Models.Stateless.AppSettings.Get(webApplicationBuilder.Configuration);
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
throw new Exception("Working directory name must have a value!");
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
Log.Logger = loggerConfiguration.CreateLogger();
Serilog.ILogger log = Log.ForContext<Program>();
try
{ {
CreateHostBuilder(args).Build().Run(); IsEnvironment isEnvironment = new(webApplicationBuilder.Environment.IsDevelopment(), webApplicationBuilder.Environment.IsStaging(), webApplicationBuilder.Environment.IsProduction());
} Singleton.Background background = new(isEnvironment, appSettings, workingDirectory);
if (isEnvironment.Development && !string.IsNullOrEmpty("storage.UrlRoot"))
throw new Exception();
_ = webApplicationBuilder.Services.AddControllersWithViews();
// _ = webApplicationBuilder.Services.AddRazorPages(configure => configure.Conventions.AuthorizeFolder("/Admin").AddPageRoute("/index", "{*url}"));
_ = webApplicationBuilder.Services.AddRazorPages();
_ = webApplicationBuilder.Services.AddSingleton<AppSettings, AppSettings>(_ => appSettings);
_ = webApplicationBuilder.Services.AddSingleton<IsEnvironment, IsEnvironment>(_ => isEnvironment);
_ = webApplicationBuilder.Services.AddSingleton<Singleton.Background, Singleton.Background>(_ => background);
_ = webApplicationBuilder.Services.AddHostedService(t => new TimedHostedService(isEnvironment, background));
_ = webApplicationBuilder.Services.AddSwaggerGen();
WebApplication webApplication = webApplicationBuilder.Build();
if (isEnvironment.Development)
{
webApplication.UseWebAssemblyDebugging();
if (!string.IsNullOrEmpty("storage.UrlRoot"))
{
Environment.ExitCode = -1;
webApplication.Lifetime.StopApplication();
}
_ = webApplication.UseSwagger();
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "APC Viewer API V1"));
}
else
{
_ = webApplication.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
_ = webApplication.UseHsts();
}
_ = webApplication.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
_ = ApplicationBuilderSerilogClientExtensions.UseSerilogIngestion(webApplication);
_ = SerilogApplicationBuilderExtensions.UseSerilogRequestLogging(webApplication);
_ = webApplication.UseDeveloperExceptionPage();
_ = webApplication.UseHttpsRedirection();
_ = webApplication.UseBlazorFrameworkFiles();
_ = webApplication.UseStaticFiles();
_ = webApplication.UseRouting();
_ = webApplication.MapRazorPages();
_ = webApplication.MapControllers();
_ = webApplication.MapFallbackToFile("index.html");
log.Information("Starting Web Application");
webApplication.Run();
public static IHostBuilder CreateHostBuilder(string[] args) return 0;
}
catch (Exception ex)
{ {
IHostBuilder result; log.Fatal(ex, "Host terminated unexpectedly");
IsEnvironment isEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached); return 1;
result = Host.CreateDefaultBuilder(args) }
.UseWindowsService() finally
.ConfigureAppConfiguration((context, configuration) => {
{ Log.CloseAndFlush();
configuration
.AddEnvironmentVariables()
.AddCommandLine(args)
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true);
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
return result;
} }
} }
} }

View File

@ -10,183 +10,168 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
namespace Shared namespace Shared;
public class Description
{ {
public class Description public enum RowColumn
{ {
Test = 1000,
public enum RowColumn Count,
{ Index
Test = 1000,
Count,
Index
}
public enum LogisticsColumn
{
EventName = 2000,
NullData,
JobID,
Sequence,
MesEntity,
ReportFullPath,
ProcessJobID,
MID
}
public enum Param
{
String = 0,
Integer = 2,
Double = 3,
Boolean = 4,
StructuredType = 5
}
internal const string FileFound = "FileFound";
public List<EquipmentParameter> EquipmentParameters { get; private set; }
public List<ParameterTypeDefinition> ParameterTypeDefinitions { get; private set; }
private readonly bool _UseCyclical;
private readonly List<string> _HeaderNames;
private readonly Dictionary<string, int> _KeyIndexPairs;
private readonly ParameterTypeDefinition _StructuredType;
private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider;
public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl)
{
_KeyIndexPairs = new Dictionary<string, int>();
_HeaderNames = configDataBase.GetHeaderNames(logic);
_UseCyclical = configDataBase.UseCyclicalForDescription;
_StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List<Field>());
_FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider();
EquipmentParameters = new List<EquipmentParameter>();
ParameterTypeDefinitions = new List<ParameterTypeDefinition> { _StructuredType };
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false);
List<ParameterValue> results = GetParameterValues(equipmentControl, keyValuePairsCollection);
}
private List<ParameterValue> GetParameterValues(IEquipmentControl equipmentControl, Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection)
{
List<ParameterValue> results = new List<ParameterValue>();
Enum param;
object value;
Enum[] @params;
string description;
List<object[]> list;
EquipmentParameter equipmentParameter;
ParameterTypeDefinition parameterTypeDefinition;
bool addToEquipmentParameters = !EquipmentParameters.Any();
foreach (KeyValuePair<string, List<Tuple<Enum, string, string, object>>> keyValuePair in keyValuePairsCollection)
{
if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key))
continue;
@params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray();
if (@params.Length != 1)
throw new Exception();
if (keyValuePair.Value[0].Item2 != keyValuePair.Key)
throw new Exception();
param = @params[0];
if (!addToEquipmentParameters)
equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]];
else
{
description = keyValuePair.Value[0].Item3;
_KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count());
if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key)))
parameterTypeDefinition = _StructuredType;
else
parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString());
equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description);
EquipmentParameters.Add(equipmentParameter);
}
if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key))
value = keyValuePair.Value[0].Item4;
else
{
list = new List<object[]>();
for (int i = 0; i < keyValuePair.Value.Count; i++)
list.Add(new object[] { i, keyValuePair.Value[i].Item4 });
value = list;
}
if (equipmentControl is null || !(param is Param.StructuredType))
results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now));
else
results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value));
}
return results;
}
public List<ParameterValue> GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary<string, object> keyValuePairs = null)
{
List<ParameterValue> results = new List<ParameterValue>();
if (_UseCyclical && (i is null || i.Value > 0))
throw new Exception();
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
Enum param;
Tuple<Enum, string, string, object> tuple;
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = new Dictionary<string, List<Tuple<Enum, string, string, object>>>();
for (int r = i.Value; r < jsonElements.Length; r++)
{
foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array)
{
param = Param.StructuredType;
//jValue = jObject.Value<JValue>("Item1");
throw new NotImplementedException("Item1");
}
else
{
switch (jsonProperty.Value.ValueKind)
{
case JsonValueKind.String:
param = Param.String;
break;
case JsonValueKind.Number:
param = Param.Double;
break;
case JsonValueKind.True:
case JsonValueKind.False:
param = Param.Boolean;
break;
case JsonValueKind.Null:
param = Param.String;
break;
default:
param = Param.StructuredType;
break;
}
}
tuple = new Tuple<Enum, string, string, object>(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString());
if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name))
keyValuePairsCollection.Add(jsonProperty.Name, new List<Tuple<Enum, string, string, object>>());
keyValuePairsCollection[jsonProperty.Name].Add(tuple);
}
if (!_UseCyclical)
break;
}
results = GetParameterValues(equipmentControl, keyValuePairsCollection);
return results;
}
public static string GetCellName()
{
string result;
if (Backbone.Instance?.CellName is null)
result = string.Empty;
else
result = Backbone.Instance.CellName;
if (result.Contains("-IO"))
result = result.Replace("-IO", string.Empty);
return result;
}
} }
} public enum LogisticsColumn
{
EventName = 2000,
NullData,
JobID,
Sequence,
MesEntity,
ReportFullPath,
ProcessJobID,
MID
}
public enum Param
{
String = 0,
Integer = 2,
Double = 3,
Boolean = 4,
StructuredType = 5
}
internal const string FileFound = "FileFound";
public List<EquipmentParameter> EquipmentParameters { get; private set; }
public List<ParameterTypeDefinition> ParameterTypeDefinitions { get; private set; }
private readonly bool _UseCyclical;
private readonly List<string> _HeaderNames;
private readonly Dictionary<string, int> _KeyIndexPairs;
private readonly ParameterTypeDefinition _StructuredType;
private readonly FileConnectorParameterTypeDefinitionProvider _FileConnectorParameterTypeDefinitionProvider;
public Description(ILogic logic, ConfigDataBase configDataBase, IEquipmentControl equipmentControl)
{
_KeyIndexPairs = new Dictionary<string, int>();
_HeaderNames = configDataBase.GetHeaderNames(logic);
_UseCyclical = configDataBase.UseCyclicalForDescription;
_StructuredType = new StructuredType(nameof(StructuredType), string.Empty, new List<Field>());
_FileConnectorParameterTypeDefinitionProvider = new FileConnectorParameterTypeDefinitionProvider();
EquipmentParameters = new List<EquipmentParameter>();
ParameterTypeDefinitions = new List<ParameterTypeDefinition> { _StructuredType };
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = configDataBase.GetParameterInfo(logic, allowNull: false);
List<ParameterValue> results = GetParameterValues(equipmentControl, keyValuePairsCollection);
}
private List<ParameterValue> GetParameterValues(IEquipmentControl equipmentControl, Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection)
{
List<ParameterValue> results = new();
Enum param;
object value;
Enum[] @params;
string description;
List<object[]> list;
EquipmentParameter equipmentParameter;
ParameterTypeDefinition parameterTypeDefinition;
bool addToEquipmentParameters = !EquipmentParameters.Any();
foreach (KeyValuePair<string, List<Tuple<Enum, string, string, object>>> keyValuePair in keyValuePairsCollection)
{
if (!addToEquipmentParameters && !_KeyIndexPairs.ContainsKey(keyValuePair.Key))
continue;
@params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray();
if (@params.Length != 1)
throw new Exception();
if (keyValuePair.Value[0].Item2 != keyValuePair.Key)
throw new Exception();
param = @params[0];
if (!addToEquipmentParameters)
equipmentParameter = EquipmentParameters[_KeyIndexPairs[keyValuePair.Key]];
else
{
description = keyValuePair.Value[0].Item3;
_KeyIndexPairs.Add(keyValuePair.Key, EquipmentParameters.Count());
if (param is Param.StructuredType || (_UseCyclical && !_HeaderNames.Contains(keyValuePair.Key)))
parameterTypeDefinition = _StructuredType;
else
parameterTypeDefinition = _FileConnectorParameterTypeDefinitionProvider.GetParameterTypeDefinition(param.ToString());
equipmentParameter = new EquipmentParameter(keyValuePair.Key, parameterTypeDefinition, description);
EquipmentParameters.Add(equipmentParameter);
}
if (!_UseCyclical || _HeaderNames.Contains(keyValuePair.Key))
value = keyValuePair.Value[0].Item4;
else
{
list = new List<object[]>();
for (int i = 0; i < keyValuePair.Value.Count; i++)
list.Add(new object[] { i, keyValuePair.Value[i].Item4 });
value = list;
}
if (equipmentControl is null || param is not Param.StructuredType)
results.Add(new ParameterValue(equipmentParameter, value, DateTime.Now));
else
results.Add(equipmentControl.DataCollection.CreateParameterValue(equipmentParameter, value));
}
return results;
}
public List<ParameterValue> GetParameterValues(ILogic logic, IEquipmentControl equipmentControl, JsonElement jsonElement, int? i = null, Dictionary<string, object>? keyValuePairs = null)
{
_ = new List<ParameterValue>();
if (_UseCyclical && (i is null || i.Value > 0))
throw new Exception();
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
Enum param;
Tuple<Enum, string, string, object> tuple;
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairsCollection = new();
for (int r = i.Value; r < jsonElements.Length; r++)
{
foreach (JsonProperty jsonProperty in jsonElement[r].EnumerateObject())
{
if (jsonProperty.Value.ValueKind is JsonValueKind.Object or JsonValueKind.Array)
{
param = Param.StructuredType;
//jValue = jObject.Value<JValue>("Item1");
throw new NotImplementedException("Item1");
}
else
{
param = jsonProperty.Value.ValueKind switch
{
JsonValueKind.String => Param.String,
JsonValueKind.Number => Param.Double,
JsonValueKind.True or JsonValueKind.False => Param.Boolean,
JsonValueKind.Null => Param.String,
_ => Param.StructuredType,
};
}
tuple = new Tuple<Enum, string, string, object>(param, jsonProperty.Name, string.Empty, jsonProperty.Value.ToString());
if (!keyValuePairsCollection.ContainsKey(jsonProperty.Name))
keyValuePairsCollection.Add(jsonProperty.Name, new List<Tuple<Enum, string, string, object>>());
keyValuePairsCollection[jsonProperty.Name].Add(tuple);
}
if (!_UseCyclical)
break;
}
List<ParameterValue> results = GetParameterValues(equipmentControl, keyValuePairsCollection);
return results;
}
public static string GetCellName()
{
string result;
if (Backbone.Instance?.CellName is null)
result = string.Empty;
else
result = Backbone.Instance.CellName;
if (result.Contains("-IO"))
result = result.Replace("-IO", string.Empty);
return result;
}
}

View File

@ -1,53 +1,50 @@
namespace Shared namespace Shared;
public enum EquipmentType
{ {
FileEquipment,
public enum EquipmentType SemiEquipment,
{ //
FileEquipment, DEP08EGANAIXG5,
SemiEquipment, //
// MET08ANLYSDIFAAST230_Semi,
DEP08EGANAIXG5, MET08DDUPSFS6420,
// MET08DDUPSP1TBI,
MET08ANLYSDIFAAST230_Semi, MET08RESIHGCV,
MET08DDUPSFS6420, MET08RESIMAPCDE,
MET08DDUPSP1TBI, MET08THFTIRQS408M,
MET08RESIHGCV, MET08THFTIRSTRATUS,
MET08RESIMAPCDE, //
MET08THFTIRQS408M, MET08AFMD3100,
MET08THFTIRSTRATUS, MET08BVHGPROBE,
// MET08CVHGPROBE802B150,
MET08AFMD3100, MET08CVHGPROBE802B150_Monthly,
MET08BVHGPROBE, MET08CVHGPROBE802B150_Weekly,
MET08CVHGPROBE802B150, MET08DDINCAN8620,
MET08CVHGPROBE802B150_Monthly, MET08DDINCAN8620_Daily,
MET08CVHGPROBE802B150_Weekly, MET08EBEAMINTEGRITY26,
MET08DDINCAN8620, MET08HALLHL5580,
MET08DDINCAN8620_Daily, MET08HALLHL5580_Monthly,
MET08EBEAMINTEGRITY26, MET08HALLHL5580_Weekly,
MET08HALLHL5580, MET08MESMICROSCOPE,
MET08HALLHL5580_Monthly, MET08NDFRESIMAP151C,
MET08HALLHL5580_Weekly, MET08NDFRESIMAP151C_Verification,
MET08MESMICROSCOPE, MET08PLMAPRPM,
MET08NDFRESIMAP151C, MET08PLMAPRPM_Daily,
MET08NDFRESIMAP151C_Verification, MET08PLMAPRPM_Verification,
MET08PLMAPRPM, MET08PLMPPLATO,
MET08PLMAPRPM_Daily, MET08PRFUSB4000,
MET08PLMAPRPM_Verification, MET08PRFUSB4000_Daily,
MET08PLMPPLATO, MET08PRFUSB4000_Monthly,
MET08PRFUSB4000, MET08PRFUSB4000_Weekly,
MET08PRFUSB4000_Daily, MET08PRFUSB4000_Verification,
MET08PRFUSB4000_Monthly, MET08PRFUSB4000_Villach,
MET08PRFUSB4000_Weekly, MET08UVH44GS100M,
MET08PRFUSB4000_Verification, MET08VPDSUBCON,
MET08PRFUSB4000_Villach, MET08WGEOMX203641Q,
MET08UVH44GS100M, MET08WGEOMX203641Q_Verification,
MET08VPDSUBCON, MET08XRDXPERTPROMRDXL,
MET08WGEOMX203641Q, MET08XRDXPERTPROMRDXL_Monthly,
MET08WGEOMX203641Q_Verification, MET08XRDXPERTPROMRDXL_Weekly,
MET08XRDXPERTPROMRDXL, METBRXRAYJV7300L
MET08XRDXPERTPROMRDXL_Monthly, }
MET08XRDXPERTPROMRDXL_Weekly,
METBRXRAYJV7300L
}
}

View File

@ -4,13 +4,11 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.Json; using System.Text.Json;
namespace Shared namespace Shared;
public interface IProcessData
{ {
public interface IProcessData
{
Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configData, List<FileInfo> fileInfoCollection); Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configData, List<FileInfo> fileInfoCollection);
} }
}

View File

@ -1,26 +1,23 @@
using Shared.Metrology; using Shared.Metrology;
using System.Collections.Generic; using System.Collections.Generic;
namespace Shared namespace Shared;
public interface IProcessDataDescription
{ {
public interface IProcessDataDescription int Test { get; set; }
{ int Count { get; set; }
int Index { get; set; }
IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase);
IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase);
List<IProcessDataDescription> GetDescription(ILogic logic, ConfigDataBase configDataBase, List<Test> tests, IProcessData iProcessData);
List<string> GetDetailNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetHeaderNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test);
List<string> GetNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase);
string GetEventDescription();
int Test { get; set; } }
int Count { get; set; }
int Index { get; set; }
IProcessDataDescription GetDefault(ILogic logic, ConfigDataBase configDataBase);
IProcessDataDescription GetDisplayNames(ILogic logic, ConfigDataBase configDataBase);
List<IProcessDataDescription> GetDescription(ILogic logic, ConfigDataBase configDataBase, List<Test> tests, IProcessData iProcessData);
List<string> GetDetailNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetHeaderNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetIgnoreParameterNames(ILogic logic, ConfigDataBase configDataBase, Test test);
List<string> GetNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetPairedParameterNames(ILogic logic, ConfigDataBase configDataBase);
List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase);
string GetEventDescription();
}
}

View File

@ -1,21 +1,18 @@
using System; using System;
namespace Shared namespace Shared;
public interface IScopeInfo
{ {
public interface IScopeInfo Enum Enum { get; }
{ string HTML { get; }
string Title { get; }
string FileName { get; }
int TestValue { get; }
string Header { get; }
string QueryFilter { get; }
string FileNameWithoutExtension { get; }
EquipmentType EquipmentType { get; }
Enum Enum { get; } }
string HTML { get; }
string Title { get; }
string FileName { get; }
int TestValue { get; }
string Header { get; }
string QueryFilter { get; }
string FileNameWithoutExtension { get; }
EquipmentType EquipmentType { get; }
}
}

View File

@ -2,170 +2,167 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Shared namespace Shared;
public class IsEnvironment
{ {
public class IsEnvironment public enum Name
{ {
LinuxDevelopment,
public enum Name LinuxProduction,
{ LinuxStaging,
LinuxDevelopment, OSXDevelopment,
LinuxProduction, OSXProduction,
LinuxStaging, OSXStaging,
OSXDevelopment, WindowsDevelopment,
OSXProduction, WindowsProduction,
OSXStaging, WindowsStaging
WindowsDevelopment,
WindowsProduction,
WindowsStaging
}
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
public bool Development { get; private set; }
public bool Linux { get; private set; }
public bool OSX { get; private set; }
public bool Production { get; private set; }
public bool Staging { get; private set; }
public bool Windows { get; private set; }
public string Profile { get; private set; }
public string AppSettingsFileName { get; private set; }
public string ASPNetCoreEnvironment { get; private set; }
public IsEnvironment(string testCategory)
{
if (testCategory.EndsWith(".json"))
{
Production = testCategory == "appsettings.json";
Staging = testCategory.EndsWith(nameof(Staging));
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Development = testCategory.EndsWith(nameof(Development));
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
}
else
{
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
{
Staging = isStaging;
Production = isProduction;
Development = isDevelopment;
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
{
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
Production = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
Development = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else
{
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount);
}
private string GetProfile()
{
string result;
if (Windows && Production)
result = nameof(Production);
else if (Windows && Staging)
result = nameof(Staging);
else if (Windows && Development)
result = nameof(Development);
else if (Linux && Production)
result = nameof(Name.LinuxProduction);
else if (Linux && Staging)
result = nameof(Name.LinuxStaging);
else if (Linux && Development)
result = nameof(Name.LinuxDevelopment);
else if (OSX && Production)
result = nameof(Name.OSXProduction);
else if (OSX && Staging)
result = nameof(Name.OSXStaging);
else if (OSX && Development)
result = nameof(Name.OSXDevelopment);
else
throw new Exception();
return result;
}
private string GetAppSettingsFileName(int? processesCount)
{
string result;
if (Production)
{
if (processesCount is null)
result = "appsettings.json";
else
result = $"appsettings.{processesCount}.json";
}
else
{
string environment;
if (Staging)
environment = nameof(Staging);
else if (Development)
environment = nameof(Development);
else
throw new Exception();
if (processesCount is null)
result = $"appsettings.{environment}.json";
else
result = $"appsettings.{environment}.{processesCount}.json";
}
return result;
}
public static string GetEnvironmentName(IsEnvironment isEnvironment)
{
string result;
if (isEnvironment.Windows)
result = nameof(IsEnvironment.Windows);
else if (isEnvironment.Linux)
result = nameof(IsEnvironment.Linux);
else if (isEnvironment.OSX)
result = nameof(IsEnvironment.OSX);
else
throw new Exception();
return result;
}
} }
} public bool DebuggerWasAttachedDuringConstructor { get; private set; }
public bool Development { get; private set; }
public bool Linux { get; private set; }
public bool OSX { get; private set; }
public bool Production { get; private set; }
public bool Staging { get; private set; }
public bool Windows { get; private set; }
public string Profile { get; private set; }
public string AppSettingsFileName { get; private set; }
public string ASPNetCoreEnvironment { get; private set; }
public IsEnvironment(string testCategory)
{
if (testCategory.EndsWith(".json"))
{
Production = testCategory == "appsettings.json";
Staging = testCategory.EndsWith(nameof(Staging));
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Development = testCategory.EndsWith(nameof(Development));
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
}
else
{
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
{
Staging = isStaging;
Production = isProduction;
Development = isDevelopment;
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
}
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
{
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
Production = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
Development = true;
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
throw new Exception();
else
{
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
}
Profile = GetProfile();
AppSettingsFileName = GetAppSettingsFileName(processesCount);
}
private string GetProfile()
{
string result;
if (Windows && Production)
result = nameof(Production);
else if (Windows && Staging)
result = nameof(Staging);
else if (Windows && Development)
result = nameof(Development);
else if (Linux && Production)
result = nameof(Name.LinuxProduction);
else if (Linux && Staging)
result = nameof(Name.LinuxStaging);
else if (Linux && Development)
result = nameof(Name.LinuxDevelopment);
else if (OSX && Production)
result = nameof(Name.OSXProduction);
else if (OSX && Staging)
result = nameof(Name.OSXStaging);
else if (OSX && Development)
result = nameof(Name.OSXDevelopment);
else
throw new Exception();
return result;
}
private string GetAppSettingsFileName(int? processesCount)
{
string result;
if (Production)
{
if (processesCount is null)
result = "appsettings.json";
else
result = $"appsettings.{processesCount}.json";
}
else
{
string environment;
if (Staging)
environment = nameof(Staging);
else if (Development)
environment = nameof(Development);
else
throw new Exception();
if (processesCount is null)
result = $"appsettings.{environment}.json";
else
result = $"appsettings.{environment}.{processesCount}.json";
}
return result;
}
public static string GetEnvironmentName(IsEnvironment isEnvironment)
{
string result;
if (isEnvironment.Windows)
result = nameof(IsEnvironment.Windows);
else if (isEnvironment.Linux)
result = nameof(IsEnvironment.Linux);
else if (isEnvironment.OSX)
result = nameof(IsEnvironment.OSX);
else
throw new Exception();
return result;
}
}

View File

@ -3,243 +3,228 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
namespace Shared namespace Shared;
public class Logistics
{ {
public class Logistics public object NullData { get; private set; }
public string JobID { get; private set; } //CellName
public long Sequence { get; private set; } //Ticks
public DateTime DateTimeFromSequence { get; private set; }
public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; }
public string MesEntity { get; private set; } //SPC
public string ReportFullPath { get; private set; } //Extract file
public string ProcessJobID { get; internal set; } //Reactor (duplicate but I want it in the logistics)
public string MID { get; internal set; } //Lot & Pocket || Lot
public List<string> Tags { get; internal set; }
public List<string> Logistics1 { get; internal set; }
public List<Logistics2> Logistics2 { get; internal set; }
public Logistics()
{ {
DateTime dateTime = DateTime.Now;
NullData = null;
JobID = Description.GetCellName();
Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
MesEntity = DefaultMesEntity(dateTime);
ReportFullPath = string.Empty;
ProcessJobID = nameof(ProcessJobID);
MID = nameof(MID);
Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
}
public object NullData { get; private set; } public Logistics(object nullData, Dictionary<string, string> cellNames, Dictionary<string, string> mesEntities, FileInfo fileInfo, bool useSplitForMID, int? fileInfoLength = null)
public string JobID { get; private set; } //CellName {
public long Sequence { get; private set; } //Ticks NullData = nullData;
public DateTime DateTimeFromSequence { get; private set; } string mesEntity = string.Empty;
public double TotalSecondsSinceLastWriteTimeFromSequence { get; private set; } string jobID = Description.GetCellName();
public string MesEntity { get; private set; } //SPC DateTime dateTime = fileInfo.LastWriteTime;
public string ReportFullPath { get; private set; } //Extract file if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value)
public string ProcessJobID { get; internal set; } //Reactor (duplicate but I want it in the logistics) dateTime = dateTime.AddTicks(-1);
public string MID { get; internal set; } //Lot & Pocket || Lot if (string.IsNullOrEmpty(jobID))
public List<string> Tags { get; internal set; } {
public List<string> Logistics1 { get; internal set; } if (cellNames.Count == 1)
public List<Logistics2> Logistics2 { get; internal set; } jobID = cellNames.ElementAt(0).Key;
else
public Logistics() {
string reportFullPathLower = fileInfo.FullName.ToLower();
foreach (KeyValuePair<string, string> element in cellNames)
{
if (reportFullPathLower.Contains(element.Key) || reportFullPathLower.Contains(element.Value))
{
jobID = element.Key;
break;
}
}
}
}
if (string.IsNullOrEmpty(jobID))
throw new Exception();
if (mesEntities.ContainsKey(jobID))
mesEntity = mesEntities[jobID];
else if (mesEntities.Count == 1)
mesEntity = mesEntities.ElementAt(0).Value;
//
if (string.IsNullOrEmpty(mesEntity))
throw new Exception();
JobID = jobID;
Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
MesEntity = mesEntity;
ReportFullPath = fileInfo.FullName;
ProcessJobID = nameof(ProcessJobID);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
if (useSplitForMID)
{
if (fileNameWithoutExtension.IndexOf(".") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim();
if (fileNameWithoutExtension.IndexOf("_") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim();
if (fileNameWithoutExtension.IndexOf("-") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim();
}
MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower());
Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
}
public Logistics(string reportFullPath, string logistics)
{
string key;
DateTime dateTime;
string[] segments;
Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1"))
{ {
DateTime dateTime = DateTime.Now;
NullData = null; NullData = null;
JobID = Description.GetCellName(); JobID = "null";
dateTime = new FileInfo(reportFullPath).LastWriteTime;
Sequence = dateTime.Ticks; Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime; DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
MesEntity = DefaultMesEntity(dateTime); MesEntity = DefaultMesEntity(dateTime);
ReportFullPath = string.Empty; ReportFullPath = reportFullPath;
ProcessJobID = nameof(ProcessJobID); ProcessJobID = "R##";
MID = nameof(MID); MID = "null";
Tags = new List<string>(); Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList(); Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>(); Logistics2 = new List<Logistics2>();
} }
else
public Logistics(object nullData, Dictionary<string, string> cellNames, Dictionary<string, string> mesEntities, FileInfo fileInfo, bool useSplitForMID, int? fileInfoLength = null)
{ {
NullData = nullData; string logistics1Line1 = Logistics1[0];
string mesEntity = string.Empty; key = "NULL_DATA=";
string jobID = Description.GetCellName(); if (!logistics1Line1.Contains(key))
DateTime dateTime = fileInfo.LastWriteTime; NullData = null;
if (fileInfoLength.HasValue && fileInfo.Length < fileInfoLength.Value) else
dateTime = dateTime.AddTicks(-1);
if (string.IsNullOrEmpty(jobID))
{ {
if (cellNames.Count == 1) segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
jobID = cellNames.ElementAt(0).Key; NullData = segments[1].Split(';')[0];
else }
{ key = "JOBID=";
string reportFullPathLower = fileInfo.FullName.ToLower(); if (!logistics1Line1.Contains(key))
foreach (var element in cellNames) JobID = "null";
{ else
if (reportFullPathLower.Contains(element.Key) || reportFullPathLower.Contains(element.Value)) {
{ segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
jobID = element.Key; JobID = segments[1].Split(';')[0];
break; }
} key = "SEQUENCE=";
} if (!logistics1Line1.Contains(key))
} dateTime = new FileInfo(reportFullPath).LastWriteTime;
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks)
dateTime = new FileInfo(reportFullPath).LastWriteTime;
else
dateTime = new DateTime(sequence);
} }
if (string.IsNullOrEmpty(jobID))
throw new Exception();
if (mesEntities.ContainsKey(jobID))
mesEntity = mesEntities[jobID];
else if (mesEntities.Count == 1)
mesEntity = mesEntities.ElementAt(0).Value;
//
if (string.IsNullOrEmpty(mesEntity))
throw new Exception();
JobID = jobID;
Sequence = dateTime.Ticks; Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime; DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds; TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
MesEntity = mesEntity; DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime;
ReportFullPath = fileInfo.FullName; if (TotalSecondsSinceLastWriteTimeFromSequence > 600)
ProcessJobID = nameof(ProcessJobID);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
if (useSplitForMID)
{ {
if (fileNameWithoutExtension.IndexOf(".") > -1) if (lastWriteTime != dateTime)
fileNameWithoutExtension = fileNameWithoutExtension.Split('.')[0].Trim(); try
if (fileNameWithoutExtension.IndexOf("_") > -1) { File.SetLastWriteTime(reportFullPath, dateTime); }
fileNameWithoutExtension = fileNameWithoutExtension.Split('_')[0].Trim(); catch (Exception) { }
if (fileNameWithoutExtension.IndexOf("-") > -1)
fileNameWithoutExtension = fileNameWithoutExtension.Split('-')[0].Trim();
} }
MID = string.Concat(fileNameWithoutExtension.Substring(0, 1).ToUpper(), fileNameWithoutExtension.Substring(1).ToLower()); key = "MES_ENTITY=";
Tags = new List<string>(); if (!logistics1Line1.Contains(key))
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
}
public Logistics(string reportFullPath, string logistics)
{
string key;
DateTime dateTime;
string[] segments;
Logistics1 = logistics.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (!Logistics1.Any() || !Logistics1[0].StartsWith("LOGISTICS_1"))
{
NullData = null;
JobID = "null";
dateTime = new FileInfo(reportFullPath).LastWriteTime;
Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
MesEntity = DefaultMesEntity(dateTime); MesEntity = DefaultMesEntity(dateTime);
ReportFullPath = reportFullPath;
ProcessJobID = "R##";
MID = "null";
Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
}
else else
{ {
string logistics1Line1 = Logistics1[0]; segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
key = "NULL_DATA="; MesEntity = segments[1].Split(';')[0];
if (!logistics1Line1.Contains(key))
NullData = null;
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
NullData = segments[1].Split(';')[0];
}
key = "JOBID=";
if (!logistics1Line1.Contains(key))
JobID = "null";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
JobID = segments[1].Split(';')[0];
}
key = "SEQUENCE=";
if (!logistics1Line1.Contains(key))
dateTime = new FileInfo(reportFullPath).LastWriteTime;
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
if (!long.TryParse(segments[1].Split(';')[0].Split('.')[0], out long sequence) || sequence < new DateTime(1999, 1, 1).Ticks)
dateTime = new FileInfo(reportFullPath).LastWriteTime;
else
dateTime = new DateTime(sequence);
}
Sequence = dateTime.Ticks;
DateTimeFromSequence = dateTime;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTime).TotalSeconds;
DateTime lastWriteTime = new FileInfo(reportFullPath).LastWriteTime;
if (TotalSecondsSinceLastWriteTimeFromSequence > 600)
{
if (lastWriteTime != dateTime)
try
{ File.SetLastWriteTime(reportFullPath, dateTime); }
catch (Exception) { }
}
key = "MES_ENTITY=";
if (!logistics1Line1.Contains(key))
MesEntity = DefaultMesEntity(dateTime);
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
MesEntity = segments[1].Split(';')[0];
}
ReportFullPath = reportFullPath;
key = "PROCESS_JOBID=";
if (!logistics1Line1.Contains(key))
ProcessJobID = "R##";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
ProcessJobID = segments[1].Split(';')[0];
}
key = "MID=";
if (!logistics1Line1.Contains(key))
MID = "null";
else
{
segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
MID = segments[1].Split(';')[0];
}
} }
Logistics2 logistics2; ReportFullPath = reportFullPath;
Tags = new List<string>(); key = "PROCESS_JOBID=";
Logistics2 = new List<Logistics2>(); if (!logistics1Line1.Contains(key))
for (int i = 1; i < Logistics1.Count(); i++) ProcessJobID = "R##";
else
{ {
if (Logistics1[i].StartsWith("LOGISTICS_2")) segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
{ ProcessJobID = segments[1].Split(';')[0];
logistics2 = new Logistics2(Logistics1[i]);
Logistics2.Add(logistics2);
}
} }
for (int i = Logistics1.Count() - 1; i > -1; i--) key = "MID=";
if (!logistics1Line1.Contains(key))
MID = "null";
else
{ {
if (Logistics1[i].StartsWith("LOGISTICS_2")) segments = logistics1Line1.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
Logistics1.RemoveAt(i); MID = segments[1].Split(';')[0];
} }
} }
Logistics2 logistics2;
public Logistics ShallowCopy() Tags = new List<string>();
Logistics2 = new List<Logistics2>();
for (int i = 1; i < Logistics1.Count(); i++)
{ {
return (Logistics)MemberwiseClone(); if (Logistics1[i].StartsWith("LOGISTICS_2"))
{
logistics2 = new Logistics2(Logistics1[i]);
Logistics2.Add(logistics2);
}
} }
for (int i = Logistics1.Count() - 1; i > -1; i--)
private string DefaultMesEntity(DateTime dateTime)
{ {
return string.Concat(dateTime.Ticks, "_MES_ENTITY"); if (Logistics1[i].StartsWith("LOGISTICS_2"))
} Logistics1.RemoveAt(i);
internal string GetLotViaMostCommonMethod()
{
return MID.Substring(0, MID.Length - 2);
}
internal string GetPocketNumberViaMostCommonMethod()
{
return MID.Substring(MID.Length - 2);
}
internal void Update(string dateTime, string processJobID, string mid)
{
if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted))
dateTimeCasted = DateTime.Now;
NullData = null;
//JobID = Description.GetCellName();
Sequence = dateTimeCasted.Ticks;
DateTimeFromSequence = dateTimeCasted;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds;
//MesEntity = DefaultMesEntity(dateTime);
//ReportFullPath = string.Empty;
ProcessJobID = processJobID;
MID = mid;
Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
} }
} }
} public Logistics ShallowCopy() => (Logistics)MemberwiseClone();
private string DefaultMesEntity(DateTime dateTime) => string.Concat(dateTime.Ticks, "_MES_ENTITY");
internal string GetLotViaMostCommonMethod() => MID.Substring(0, MID.Length - 2);
internal string GetPocketNumberViaMostCommonMethod() => MID.Substring(MID.Length - 2);
internal void Update(string dateTime, string processJobID, string mid)
{
if (!DateTime.TryParse(dateTime, out DateTime dateTimeCasted))
dateTimeCasted = DateTime.Now;
NullData = null;
//JobID = Description.GetCellName();
Sequence = dateTimeCasted.Ticks;
DateTimeFromSequence = dateTimeCasted;
TotalSecondsSinceLastWriteTimeFromSequence = (DateTime.Now - dateTimeCasted).TotalSeconds;
//MesEntity = DefaultMesEntity(dateTime);
//ReportFullPath = string.Empty;
ProcessJobID = processJobID;
MID = mid;
Tags = new List<string>();
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
Logistics2 = new List<Logistics2>();
}
}

View File

@ -1,80 +1,78 @@
using System; using System;
namespace Shared namespace Shared;
public class Logistics2
{ {
public class Logistics2
public string MID { get; private set; }
public string RunNumber { get; private set; }
public string SatelliteGroup { get; private set; }
public string PartNumber { get; private set; }
public string PocketNumber { get; private set; }
public string WaferLot { get; private set; }
public string Recipe { get; private set; }
public Logistics2(string logistics2)
{ {
string key;
public string MID { get; private set; } string[] segments;
public string RunNumber { get; private set; } key = "JOBID=";
public string SatelliteGroup { get; private set; } if (!logistics2.Contains(key))
public string PartNumber { get; private set; } MID = "null";
public string PocketNumber { get; private set; } else
public string WaferLot { get; private set; }
public string Recipe { get; private set; }
public Logistics2(string logistics2)
{ {
string key; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
string[] segments; MID = segments[1].Split(';')[0];
key = "JOBID="; }
if (!logistics2.Contains(key)) key = "MID=";
MID = "null"; if (!logistics2.Contains(key))
else RunNumber = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
MID = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} RunNumber = segments[1].Split(';')[0];
key = "MID="; }
if (!logistics2.Contains(key)) key = "INFO=";
RunNumber = "null"; if (!logistics2.Contains(key))
else SatelliteGroup = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
RunNumber = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} SatelliteGroup = segments[1].Split(';')[0];
key = "INFO="; }
if (!logistics2.Contains(key)) key = "PRODUCT=";
SatelliteGroup = "null"; if (!logistics2.Contains(key))
else PartNumber = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
SatelliteGroup = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} PartNumber = segments[1].Split(';')[0];
key = "PRODUCT="; }
if (!logistics2.Contains(key)) key = "CHAMBER=";
PartNumber = "null"; if (!logistics2.Contains(key))
else PocketNumber = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
PartNumber = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} PocketNumber = segments[1].Split(';')[0];
key = "CHAMBER="; }
if (!logistics2.Contains(key)) key = "WAFER_ID=";
PocketNumber = "null"; if (!logistics2.Contains(key))
else WaferLot = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
PocketNumber = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} WaferLot = segments[1].Split(';')[0];
key = "WAFER_ID="; }
if (!logistics2.Contains(key)) key = "PPID=";
WaferLot = "null"; if (!logistics2.Contains(key))
else Recipe = "null";
{ else
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries); {
WaferLot = segments[1].Split(';')[0]; segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
} Recipe = segments[1].Split(';')[0];
key = "PPID=";
if (!logistics2.Contains(key))
Recipe = "null";
else
{
segments = logistics2.Split(new string[] { key }, StringSplitOptions.RemoveEmptyEntries);
Recipe = segments[1].Split(';')[0];
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -7,404 +7,380 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace Shared.Metrology namespace Shared.Metrology;
public class ConfigDataBase
{ {
public class ConfigDataBase public bool UseCyclicalForDescription { get; protected set; }
public Dictionary<string, string> CellNames { get; protected set; }
public Dictionary<string, string> MesEntities { get; protected set; }
public IProcessDataDescription ProcessDataDescription { get; protected set; }
public bool IsEvent { get; private set; }
public EventName EventName => _EventName;
public bool EafHosted { get; private set; }
public string CellName { get; private set; }
public bool IsSourceTimer { get; private set; }
public EquipmentType EquipmentType => _EquipmentType;
public string EquipmentElementName { get; private set; }
public bool IsDatabaseExportToIPDSF { get; private set; }
public EquipmentType? EquipmentConnection => _EquipmentConnection;
public FileConnectorConfiguration FileConnectorConfiguration { get; private set; }
protected readonly EventName _EventName;
protected readonly EquipmentType _EquipmentType;
protected readonly EquipmentType? _EquipmentConnection;
protected readonly Dictionary<string, string> _Reactors;
public ConfigDataBase(string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, bool isEAFHosted)
{ {
CellName = cellName;
public bool UseCyclicalForDescription { get; protected set; } EafHosted = isEAFHosted;
public Dictionary<string, string> CellNames { get; protected set; } EquipmentType equipmentTypeValue;
public Dictionary<string, string> MesEntities { get; protected set; } _Reactors = new Dictionary<string, string>();
public IProcessDataDescription ProcessDataDescription { get; protected set; } CellNames = new Dictionary<string, string>();
MesEntities = new Dictionary<string, string>();
public bool IsEvent { get; private set; } EquipmentElementName = cellInstanceConnectionName;
public EventName EventName => _EventName; FileConnectorConfiguration = fileConnectorConfiguration;
public bool EafHosted { get; private set; } string[] segments = parameterizedModelObjectDefinitionType.Split('.');
public string CellName { get; private set; } IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt"));
public bool IsSourceTimer { get; private set; } string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty);
public EquipmentType EquipmentType => _EquipmentType; IsDatabaseExportToIPDSF = (fileConnectorConfiguration.SourceFileLocation.Contains("DatabaseExport"));
public string EquipmentElementName { get; private set; } if (!Enum.TryParse(segments[segments.Length - 1], out EventName eventNameValue))
public bool IsDatabaseExportToIPDSF { get; private set; } throw new Exception(cellInstanceConnectionName);
public EquipmentType? EquipmentConnection => _EquipmentConnection; if (!Enum.TryParse(cellInstanceConnectionNameBase, out equipmentTypeValue))
public FileConnectorConfiguration FileConnectorConfiguration { get; private set; } _EquipmentConnection = null;
else
protected readonly EventName _EventName; _EquipmentConnection = equipmentTypeValue;
protected readonly EquipmentType _EquipmentType; string suffix = eventNameValue switch
protected readonly EquipmentType? _EquipmentConnection;
protected readonly Dictionary<string, string> _Reactors;
public ConfigDataBase(string cellName, string cellInstanceConnectionName, FileConnectorConfiguration fileConnectorConfiguration, string equipmentTypeName, string parameterizedModelObjectDefinitionType, bool isEAFHosted)
{ {
CellName = cellName; EventName.FileRead => string.Empty,
EafHosted = isEAFHosted; EventName.FileReadDaily => "_Daily",
EquipmentType equipmentTypeValue; EventName.FileReadWeekly => "_Weekly",
_Reactors = new Dictionary<string, string>(); EventName.FileReadMonthly => "_Monthly",
CellNames = new Dictionary<string, string>(); EventName.FileReadVerification => "_Verification",
MesEntities = new Dictionary<string, string>(); _ => throw new Exception(cellInstanceConnectionName),
EquipmentElementName = cellInstanceConnectionName; };
FileConnectorConfiguration = fileConnectorConfiguration; string parameterizedModelObjectDefinitionTypeAppended = string.Concat(segments[0], suffix);
string[] segments = parameterizedModelObjectDefinitionType.Split('.'); IsEvent = cellInstanceConnectionNameBase != parameterizedModelObjectDefinitionTypeAppended;
IsSourceTimer = (fileConnectorConfiguration.SourceFileFilter.StartsWith("*Timer.txt")); _EventName = eventNameValue;
string cellInstanceConnectionNameBase = cellInstanceConnectionName.Replace("-", string.Empty); if (!Enum.TryParse(parameterizedModelObjectDefinitionTypeAppended, out equipmentTypeValue))
IsDatabaseExportToIPDSF = (fileConnectorConfiguration.SourceFileLocation.Contains("DatabaseExport")); throw new Exception(cellInstanceConnectionName);
if (!Enum.TryParse(segments[segments.Length - 1], out EventName eventNameValue)) _EquipmentType = equipmentTypeValue;
throw new Exception(cellInstanceConnectionName); if (!isEAFHosted && equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended)
if (!Enum.TryParse(cellInstanceConnectionNameBase, out equipmentTypeValue)) throw new Exception(cellInstanceConnectionName);
_EquipmentConnection = null;
else
_EquipmentConnection = equipmentTypeValue;
string suffix;
switch (eventNameValue)
{
case EventName.FileRead:
suffix = string.Empty;
break;
case EventName.FileReadDaily:
suffix = "_Daily";
break;
case EventName.FileReadWeekly:
suffix = "_Weekly";
break;
case EventName.FileReadMonthly:
suffix = "_Monthly";
break;
case EventName.FileReadVerification:
suffix = "_Verification";
break;
default:
throw new Exception(cellInstanceConnectionName);
}
string parameterizedModelObjectDefinitionTypeAppended = string.Concat(segments[0], suffix);
IsEvent = cellInstanceConnectionNameBase != parameterizedModelObjectDefinitionTypeAppended;
_EventName = eventNameValue;
if (!Enum.TryParse(parameterizedModelObjectDefinitionTypeAppended, out equipmentTypeValue))
throw new Exception(cellInstanceConnectionName);
_EquipmentType = equipmentTypeValue;
if (!isEAFHosted && equipmentTypeName != parameterizedModelObjectDefinitionTypeAppended)
throw new Exception(cellInstanceConnectionName);
}
public string GetEventName()
{
string result = EventName.ToString();
return result;
}
public string GetEquipmentType()
{
string result = EquipmentConnection.ToString();
return result;
}
public string GetEventDescription()
{
string result = ProcessDataDescription.GetEventDescription();
return result;
}
public IProcessDataDescription GetDefault(ILogic logic)
{
IProcessDataDescription result = ProcessDataDescription.GetDefault(logic, this);
return result;
}
public IProcessDataDescription GetDisplayNames(ILogic logic)
{
IProcessDataDescription result = ProcessDataDescription.GetDisplayNames(logic, this);
return result;
}
public List<string> GetDetailNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetDetailNames(logic, this);
return results;
}
public List<string> GetHeaderNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetHeaderNames(logic, this);
return results;
}
public List<string> GetNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetNames(logic, this);
return results;
}
public List<string> GetPairedParameterNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetPairedParameterNames(logic, this);
return results;
}
public List<string> GetParameterNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetParameterNames(logic, this);
return results;
}
public List<IProcessDataDescription> GetDescription(ILogic logic, List<Test> tests, IProcessData iProcessData)
{
List<IProcessDataDescription> results = ProcessDataDescription.GetDescription(logic, this, tests, iProcessData);
return results;
}
public string GetCurrentReactor(ILogic logic)
{
string result = string.Empty;
foreach (KeyValuePair<string, string> keyValuePair in _Reactors)
{
foreach (string filePrefix in keyValuePair.Value.Split('|'))
{
if (logic.Logistics.MID.StartsWith(filePrefix) || (EventName != EventName.FileRead && MesEntities.ContainsKey(logic.Logistics.JobID) && keyValuePair.Value == MesEntities[logic.Logistics.JobID]))
{
result = keyValuePair.Key;
break;
}
}
}
if (string.IsNullOrEmpty(result) && _Reactors.Count == 1)
result = _Reactors.ElementAt(0).Key;
return result;
}
protected JsonElement GetDefaultJsonElement(ILogic logic)
{
JsonElement result;
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDefault(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
result = (JsonElement)@object;
return result;
}
public Dictionary<string, List<Tuple<Enum, string, string, object>>> GetParameterInfo(ILogic logic, bool allowNull)
{
Dictionary<string, List<Tuple<Enum, string, string, object>>> results = new Dictionary<string, List<Tuple<Enum, string, string, object>>>();
string description;
Enum param;
Tuple<Enum, string, string, object> tuple;
JsonElement defaultJsonElement = GetDefaultJsonElement(logic);
Dictionary<string, string> keyValuePairs = GetDisplayNamesJsonElement(logic);
foreach (JsonProperty jsonProperty in defaultJsonElement.EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array)
{
description = string.Empty;
param = Description.Param.StructuredType;
//jValue = jObject.Value<JValue>("Item1");
throw new NotImplementedException("Item1");
}
else
{
switch (jsonProperty.Value.ValueKind)
{
case JsonValueKind.String:
param = Description.Param.String;
break;
case JsonValueKind.Number:
param = Description.Param.Double;
break;
case JsonValueKind.True:
case JsonValueKind.False:
param = Description.Param.Boolean;
break;
case JsonValueKind.Null:
param = Description.Param.String;
break;
default:
param = Description.Param.StructuredType;
break;
}
}
if (!keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name];
tuple = new Tuple<Enum, string, string, object>(param, jsonProperty.Name, description, jsonProperty.Value.ToString());
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, new List<Tuple<Enum, string, string, object>>());
results[jsonProperty.Name].Add(tuple);
}
return results;
}
protected void WriteExportAliases(ILogic logic, string cellName, string equipmentElementName)
{
int i = 0;
Enum param;
object value;
Enum[] @params;
string description;
StringBuilder stringBuilder = new StringBuilder();
string shareRoot = @"\\messv02ecc1.ec.local\EC_EDA";
string shareDirectory = string.Concat(shareRoot, @"\Staging\Pdsf\", cellName, @"\ExportAliases\", equipmentElementName);
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairs;
if (!(logic is null))
keyValuePairs = GetParameterInfo(logic, allowNull: false);
else
keyValuePairs = new Dictionary<string, List<Tuple<Enum, string, string, object>>>();
stringBuilder.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
if (!Directory.Exists(shareRoot))
return;
if (!Directory.Exists(shareDirectory))
Directory.CreateDirectory(shareDirectory);
string shareFile = string.Concat(shareDirectory, @"\", DateTime.Now.Ticks, ".csv");
foreach (KeyValuePair<string, List<Tuple<Enum, string, string, object>>> keyValuePair in keyValuePairs)
{
i += 1;
@params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray();
if (@params.Length != 1)
throw new Exception();
if (keyValuePair.Value[0].Item2 != keyValuePair.Key)
throw new Exception();
param = @params[0];
if (!(param is Description.Param.String))
stringBuilder.AppendLine($"\"{keyValuePair.Key}\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{keyValuePair.Key}\";\"\";\"{cellName}/{EquipmentElementName}/{EventName}\";\"\";\"True\"");
else
{
description = keyValuePair.Value[0].Item3.Split('|')[0];
if (string.IsNullOrEmpty(description))
continue;
value = keyValuePair.Value[0].Item4;
stringBuilder.AppendLine($"\"'{description}'\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{value}\";\"\";\"{cellName}/{EquipmentElementName}/{EventName}\";\"\";\"True\"");
}
}
if (keyValuePairs.Any())
File.WriteAllText(shareFile, stringBuilder.ToString());
}
public Dictionary<string, string> GetDisplayNamesJsonElement(ILogic logic)
{
Dictionary<string, string> results = new Dictionary<string, string>();
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, string.Empty);
if (jsonProperty.Value is JsonElement jsonPropertyValue)
results[jsonProperty.Name] = jsonPropertyValue.ToString();
}
return results;
}
public List<string> GetIgnoreParameterNames(ILogic logic, Test test, bool includePairedParameterNames)
{
List<string> results = ProcessDataDescription.GetIgnoreParameterNames(logic, this, test);
if (includePairedParameterNames)
{
string value;
List<string> pairedParameterNames = ProcessDataDescription.GetPairedParameterNames(logic, this);
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (!(@object is JsonElement jsonElement))
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array)
throw new Exception();
value = jsonProperty.Value.ToString();
if (!results.Contains(jsonProperty.Name) && pairedParameterNames.Contains(jsonProperty.Name) && (string.IsNullOrEmpty(value) || value[0] == '|'))
results.Add(jsonProperty.Name);
}
}
return results;
}
public List<Duplicator.Description> GetProcessDataDescriptions(JsonElement jsonElement)
{
List<Duplicator.Description> results;
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
results = JsonSerializer.Deserialize<List<Duplicator.Description>>(jsonElement.ToString(), jsonSerializerOptions);
return results;
}
public Dictionary<Test, List<Duplicator.Description>> GetKeyValuePairs(List<Duplicator.Description> processDataDescriptions)
{
Dictionary<Test, List<Duplicator.Description>> results = new Dictionary<Test, List<Duplicator.Description>>();
Test testKey;
for (int i = 0; i < processDataDescriptions.Count; i++)
{
testKey = (Test)processDataDescriptions[i].Test;
if (!results.ContainsKey(testKey))
results.Add(testKey, new List<Duplicator.Description>());
results[testKey].Add(processDataDescriptions[i]);
}
return results;
}
public Dictionary<string, List<string>> GetKeyValuePairs(JsonElement jsonElement, List<Duplicator.Description> processDataDescriptions, Test test)
{
Dictionary<string, List<string>> results = new Dictionary<string, List<string>>();
Test testKey;
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
if (processDataDescriptions.Count != jsonElements.Length)
throw new Exception();
for (int i = 0; i < processDataDescriptions.Count; i++)
{
testKey = (Test)processDataDescriptions[i].Test;
if (testKey != test)
continue;
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Object || jsonProperty.Value.ValueKind == JsonValueKind.Array)
throw new Exception();
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, new List<string>());
results[jsonProperty.Name].Add(jsonProperty.Value.ToString());
}
}
return results;
}
protected void VerifyProcessDataDescription(ILogic logic)
{
string description;
bool allowNull = false;
JsonElement defaultJsonElement = GetDefaultJsonElement(logic);
Dictionary<string, string> keyValuePairs = GetDisplayNamesJsonElement(logic);
JsonProperty[] jsonProperties = defaultJsonElement.EnumerateObject().ToArray();
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (!(jsonProperty.Value.ValueKind is JsonValueKind.String) || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
}
}
public List<IProcessDataDescription> GetIProcessDataDescriptions(JsonElement jsonElement)
{
List<IProcessDataDescription> results = new List<IProcessDataDescription>();
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
object @object;
Type type = ProcessDataDescription.GetType();
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
for (int i = 0; i < jsonElements.Length; i++)
{
@object = JsonSerializer.Deserialize(jsonElements[i].ToString(), type, jsonSerializerOptions);
if (!(@object is IProcessDataDescription processDataDescription))
continue;
results.Add(processDataDescription);
}
return results;
}
} }
} public string GetEventName()
{
string result = EventName.ToString();
return result;
}
public string GetEquipmentType()
{
string result = EquipmentConnection.ToString();
return result;
}
public string GetEventDescription()
{
string result = ProcessDataDescription.GetEventDescription();
return result;
}
public IProcessDataDescription GetDefault(ILogic logic)
{
IProcessDataDescription result = ProcessDataDescription.GetDefault(logic, this);
return result;
}
public IProcessDataDescription GetDisplayNames(ILogic logic)
{
IProcessDataDescription result = ProcessDataDescription.GetDisplayNames(logic, this);
return result;
}
public List<string> GetDetailNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetDetailNames(logic, this);
return results;
}
public List<string> GetHeaderNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetHeaderNames(logic, this);
return results;
}
public List<string> GetNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetNames(logic, this);
return results;
}
public List<string> GetPairedParameterNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetPairedParameterNames(logic, this);
return results;
}
public List<string> GetParameterNames(ILogic logic)
{
List<string> results = ProcessDataDescription.GetParameterNames(logic, this);
return results;
}
public List<IProcessDataDescription> GetDescription(ILogic logic, List<Test> tests, IProcessData iProcessData)
{
List<IProcessDataDescription> results = ProcessDataDescription.GetDescription(logic, this, tests, iProcessData);
return results;
}
public string GetCurrentReactor(ILogic logic)
{
string result = string.Empty;
foreach (KeyValuePair<string, string> keyValuePair in _Reactors)
{
foreach (string filePrefix in keyValuePair.Value.Split('|'))
{
if (logic.Logistics.MID.StartsWith(filePrefix) || (EventName != EventName.FileRead && MesEntities.ContainsKey(logic.Logistics.JobID) && keyValuePair.Value == MesEntities[logic.Logistics.JobID]))
{
result = keyValuePair.Key;
break;
}
}
}
if (string.IsNullOrEmpty(result) && _Reactors.Count == 1)
result = _Reactors.ElementAt(0).Key;
return result;
}
protected JsonElement GetDefaultJsonElement(ILogic logic)
{
JsonElement result;
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDefault(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
result = (JsonElement)@object;
return result;
}
public Dictionary<string, List<Tuple<Enum, string, string, object>>> GetParameterInfo(ILogic logic, bool allowNull)
{
Dictionary<string, List<Tuple<Enum, string, string, object>>> results = new();
string description;
Enum param;
Tuple<Enum, string, string, object> tuple;
JsonElement defaultJsonElement = GetDefaultJsonElement(logic);
Dictionary<string, string> keyValuePairs = GetDisplayNamesJsonElement(logic);
foreach (JsonProperty jsonProperty in defaultJsonElement.EnumerateObject())
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (jsonProperty.Value.ValueKind is JsonValueKind.Object or JsonValueKind.Array)
{
description = string.Empty;
param = Description.Param.StructuredType;
//jValue = jObject.Value<JValue>("Item1");
throw new NotImplementedException("Item1");
}
else
{
param = jsonProperty.Value.ValueKind switch
{
JsonValueKind.String => Description.Param.String,
JsonValueKind.Number => Description.Param.Double,
JsonValueKind.True or JsonValueKind.False => Description.Param.Boolean,
JsonValueKind.Null => Description.Param.String,
_ => Description.Param.StructuredType,
};
}
if (!keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name];
tuple = new Tuple<Enum, string, string, object>(param, jsonProperty.Name, description, jsonProperty.Value.ToString());
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, new List<Tuple<Enum, string, string, object>>());
results[jsonProperty.Name].Add(tuple);
}
return results;
}
protected void WriteExportAliases(ILogic logic, string cellName, string equipmentElementName)
{
int i = 0;
Enum param;
object value;
Enum[] @params;
string description;
StringBuilder stringBuilder = new();
string shareRoot = @"\\messv02ecc1.ec.local\EC_EDA";
string shareDirectory = string.Concat(shareRoot, @"\Staging\Pdsf\", cellName, @"\ExportAliases\", equipmentElementName);
Dictionary<string, List<Tuple<Enum, string, string, object>>> keyValuePairs;
if (logic is not null)
keyValuePairs = GetParameterInfo(logic, allowNull: false);
else
keyValuePairs = new Dictionary<string, List<Tuple<Enum, string, string, object>>>();
_ = stringBuilder.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
if (!Directory.Exists(shareRoot))
return;
if (!Directory.Exists(shareDirectory))
_ = Directory.CreateDirectory(shareDirectory);
string shareFile = string.Concat(shareDirectory, @"\", DateTime.Now.Ticks, ".csv");
foreach (KeyValuePair<string, List<Tuple<Enum, string, string, object>>> keyValuePair in keyValuePairs)
{
i += 1;
@params = (from l in keyValuePair.Value select l.Item1).Distinct().ToArray();
if (@params.Length != 1)
throw new Exception();
if (keyValuePair.Value[0].Item2 != keyValuePair.Key)
throw new Exception();
param = @params[0];
if (param is not Description.Param.String)
_ = stringBuilder.AppendLine($"\"{keyValuePair.Key}\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{keyValuePair.Key}\";\"\";\"{cellName}/{EquipmentElementName}/{EventName}\";\"\";\"True\"");
else
{
description = keyValuePair.Value[0].Item3.Split('|')[0];
if (string.IsNullOrEmpty(description))
continue;
value = keyValuePair.Value[0].Item4;
_ = stringBuilder.AppendLine($"\"'{description}'\";\"\";\"\";\"\";\"\";\"\";\"{i}\";\"{cellName}/{EquipmentElementName}/{value}\";\"\";\"{cellName}/{EquipmentElementName}/{EventName}\";\"\";\"True\"");
}
}
if (keyValuePairs.Any())
File.WriteAllText(shareFile, stringBuilder.ToString());
}
public Dictionary<string, string> GetDisplayNamesJsonElement(ILogic logic)
{
Dictionary<string, string> results = new();
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, string.Empty);
if (jsonProperty.Value is JsonElement jsonPropertyValue)
results[jsonProperty.Name] = jsonPropertyValue.ToString();
}
return results;
}
public List<string> GetIgnoreParameterNames(ILogic logic, Test test, bool includePairedParameterNames)
{
List<string> results = ProcessDataDescription.GetIgnoreParameterNames(logic, this, test);
if (includePairedParameterNames)
{
string value;
List<string> pairedParameterNames = ProcessDataDescription.GetPairedParameterNames(logic, this);
IProcessDataDescription processDataDescription = ProcessDataDescription.GetDisplayNames(logic, this);
string json = JsonSerializer.Serialize(processDataDescription, processDataDescription.GetType());
object @object = JsonSerializer.Deserialize<object>(json);
if (@object is not JsonElement jsonElement)
throw new Exception();
foreach (JsonProperty jsonProperty in jsonElement.EnumerateObject())
{
if (jsonProperty.Value.ValueKind is JsonValueKind.Object or JsonValueKind.Array)
throw new Exception();
value = jsonProperty.Value.ToString();
if (!results.Contains(jsonProperty.Name) && pairedParameterNames.Contains(jsonProperty.Name) && (string.IsNullOrEmpty(value) || value[0] == '|'))
results.Add(jsonProperty.Name);
}
}
return results;
}
public List<Duplicator.Description> GetProcessDataDescriptions(JsonElement jsonElement)
{
List<Duplicator.Description> results;
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
JsonSerializerOptions jsonSerializerOptions = new()
{ NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
results = JsonSerializer.Deserialize<List<Duplicator.Description>>(jsonElement.ToString(), jsonSerializerOptions);
return results;
}
public Dictionary<Test, List<Duplicator.Description>> GetKeyValuePairs(List<Duplicator.Description> processDataDescriptions)
{
Dictionary<Test, List<Duplicator.Description>> results = new();
Test testKey;
for (int i = 0; i < processDataDescriptions.Count; i++)
{
testKey = (Test)processDataDescriptions[i].Test;
if (!results.ContainsKey(testKey))
results.Add(testKey, new List<Duplicator.Description>());
results[testKey].Add(processDataDescriptions[i]);
}
return results;
}
public Dictionary<string, List<string>> GetKeyValuePairs(JsonElement jsonElement, List<Duplicator.Description> processDataDescriptions, Test test)
{
Dictionary<string, List<string>> results = new();
Test testKey;
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
if (processDataDescriptions.Count != jsonElements.Length)
throw new Exception();
for (int i = 0; i < processDataDescriptions.Count; i++)
{
testKey = (Test)processDataDescriptions[i].Test;
if (testKey != test)
continue;
foreach (JsonProperty jsonProperty in jsonElements[i].EnumerateObject())
{
if (jsonProperty.Value.ValueKind is JsonValueKind.Object or JsonValueKind.Array)
throw new Exception();
if (!results.ContainsKey(jsonProperty.Name))
results.Add(jsonProperty.Name, new List<string>());
results[jsonProperty.Name].Add(jsonProperty.Value.ToString());
}
}
return results;
}
protected void VerifyProcessDataDescription(ILogic logic)
{
string description;
bool allowNull = false;
JsonElement defaultJsonElement = GetDefaultJsonElement(logic);
Dictionary<string, string> keyValuePairs = GetDisplayNamesJsonElement(logic);
JsonProperty[] jsonProperties = defaultJsonElement.EnumerateObject().ToArray();
foreach (JsonProperty jsonProperty in jsonProperties)
{
if (jsonProperty.Value.ValueKind == JsonValueKind.Null && !allowNull)
throw new Exception();
if (jsonProperty.Value.ValueKind is not JsonValueKind.String || !keyValuePairs.ContainsKey(jsonProperty.Name))
description = string.Empty;
else
description = keyValuePairs[jsonProperty.Name].Split('|')[0];
}
}
public List<IProcessDataDescription> GetIProcessDataDescriptions(JsonElement jsonElement)
{
List<IProcessDataDescription> results = new();
if (jsonElement.ValueKind != JsonValueKind.Array)
throw new Exception();
object @object;
Type type = ProcessDataDescription.GetType();
JsonElement[] jsonElements = jsonElement.EnumerateArray().ToArray();
JsonSerializerOptions jsonSerializerOptions = new()
{ NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString };
for (int i = 0; i < jsonElements.Length; i++)
{
@object = JsonSerializer.Deserialize(jsonElements[i].ToString(), type, jsonSerializerOptions);
if (@object is not IProcessDataDescription processDataDescription)
continue;
results.Add(processDataDescription);
}
return results;
}
}

View File

@ -1,13 +1,10 @@
namespace Shared.Metrology namespace Shared.Metrology;
public enum EventName
{ {
FileRead,
public enum EventName FileReadDaily,
{ FileReadMonthly,
FileRead, FileReadVerification,
FileReadDaily, FileReadWeekly
FileReadMonthly, }
FileReadVerification,
FileReadWeekly
}
}

View File

@ -6,43 +6,40 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.Json; using System.Text.Json;
namespace Shared.Metrology namespace Shared.Metrology;
public interface ILogic
{ {
public interface ILogic ILogic ShallowCopy();
{ Logistics Logistics { get; }
ILogic ShallowCopy(); void ConfigurationRestore();
Logistics Logistics { get; } void CreateSelfDescription();
void CreateSelfDescription(IEquipmentControl equipment, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration configuration, IList<ModelObjectParameterDefinition> modelObjectParameterDefinitions, EquipmentType? equipmentType, EventName? eventName);
bool Extract(string reportFullPath, string eventName);
string GetConfigurationErrorTargetFileLocation();
string GetConfigurationSourceFileLocation();
string GetConfigurationTarget2FileLocation();
string GetConfigurationTargetFileLocation();
string GetConfigurationTargetFileName();
Tuple<string, JsonElement?, List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile);
string GetReportFullPath(Dictionary<string, object> keyValuePairs);
string GetTarget2FileLocation();
void Move(string reportFullPath, Tuple<string, JsonElement?, List<FileInfo>> extractResults, Exception? exception = null);
string ReExtract(string searchDirectory, string sourceFileFilter);
void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums);
ConfigDataBase ReflectionCreateSelfDescriptionV2(string json);
string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true);
string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
void SetFileParameter(string key, string value);
void SetFileParameterLotID(string value, bool includeLogisticsSequence = false);
void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true);
void SetFileParameterSystemDateTimeToLogisticsSequence();
void SetPlaceHolder(string reportFullPath, string key, string value);
void SetTarget2FileLocation(string value);
void ConfigurationRestore(); }
void CreateSelfDescription();
void CreateSelfDescription(IEquipmentControl equipment, string cellInstanceName, string cellInstanceConnectionName, FileConnectorConfiguration configuration, IList<ModelObjectParameterDefinition> modelObjectParameterDefinitions, EquipmentType? equipmentType, EventName? eventName);
bool Extract(string reportFullPath, string eventName);
string GetConfigurationErrorTargetFileLocation();
string GetConfigurationSourceFileLocation();
string GetConfigurationTarget2FileLocation();
string GetConfigurationTargetFileLocation();
string GetConfigurationTargetFileName();
Tuple<string, JsonElement?, List<FileInfo>> GetExtractResult(string reportFullPath, string eventName);
object GetFilePathGeneratorInfo(string reportFullPath, bool isErrorFile);
string GetReportFullPath(Dictionary<string, object> keyValuePairs);
string GetTarget2FileLocation();
void Move(string reportFullPath, Tuple<string, JsonElement?, List<FileInfo>> extractResults, Exception exception = null);
string ReExtract(string searchDirectory, string sourceFileFilter);
void ReflectionCreateSelfDescription(string equipmentElementName, int? input, string cellName, string debugConfig, string[] strings, bool[] booleans, long[] numbers, string[] enums);
ConfigDataBase ReflectionCreateSelfDescriptionV2(string json);
string ResolveErrorTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
string ResolveSourcePlaceHolders(string reportFullPath, bool createDirectory = true);
string ResolveTarget2PlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
string ResolveTargetPlaceHolders(string reportFullPath, bool createDirectory = true, string fileFoundPath = "");
void SetFileParameter(string key, string value);
void SetFileParameterLotID(string value, bool includeLogisticsSequence = false);
void SetFileParameterLotIDToLogisticsMID(bool includeLogisticsSequence = true);
void SetFileParameterSystemDateTimeToLogisticsSequence();
void SetPlaceHolder(string reportFullPath, string key, string value);
void SetTarget2FileLocation(string value);
}
}

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08AFMD3100
{ {
public class MET08AFMD3100 public enum Test
{ {
AFMRoughness = Metrology.Test.AFMRoughness
public enum Test
{
AFMRoughness = Metrology.Test.AFMRoughness
}
} }
} }

View File

@ -1,16 +1,13 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08BVHGPROBE
{ {
public class MET08BVHGPROBE public enum Test
{ {
BreakdownVoltageCenter = Metrology.Test.BreakdownVoltageCenter,
public enum Test BreakdownVoltageEdge = Metrology.Test.BreakdownVoltageEdge,
{ BreakdownVoltageMiddle8in = Metrology.Test.BreakdownVoltageMiddle8in
BreakdownVoltageCenter = Metrology.Test.BreakdownVoltageCenter,
BreakdownVoltageEdge = Metrology.Test.BreakdownVoltageEdge,
BreakdownVoltageMiddle8in = Metrology.Test.BreakdownVoltageMiddle8in
}
} }
} }

View File

@ -1,16 +1,13 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08CVHGPROBE802B150
{ {
public class MET08CVHGPROBE802B150 public enum Test
{ {
CV = Metrology.Test.CV,
public enum Test MonthlyCV = Metrology.Test.MonthlyCV,
{ WeeklyCV = Metrology.Test.WeeklyCV
CV = Metrology.Test.CV,
MonthlyCV = Metrology.Test.MonthlyCV,
WeeklyCV = Metrology.Test.WeeklyCV
}
} }
} }

View File

@ -1,18 +1,15 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08DDINCAN8620
{ {
public class MET08DDINCAN8620 public enum Test
{ {
CandelaKlarfDC = Metrology.Test.CandelaKlarfDC,
public enum Test CandelaLaser = Metrology.Test.CandelaLaser,
{ CandelaVerify = Metrology.Test.CandelaVerify,
CandelaKlarfDC = Metrology.Test.CandelaKlarfDC, CandelaPSL = Metrology.Test.CandelaPSL,
CandelaLaser = Metrology.Test.CandelaLaser, CandelaProdU = Metrology.Test.CandelaProdU
CandelaVerify = Metrology.Test.CandelaVerify,
CandelaPSL = Metrology.Test.CandelaPSL,
CandelaProdU = Metrology.Test.CandelaProdU
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08DDUPSFS6420
{ {
public class MET08DDUPSFS6420 public enum Test
{ {
Tencor = Metrology.Test.Tencor
public enum Test
{
Tencor = Metrology.Test.Tencor
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08DDUPSP1TBI
{ {
public class MET08DDUPSP1TBI public enum Test
{ {
SP1 = Metrology.Test.SP1
public enum Test
{
SP1 = Metrology.Test.SP1
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08EBEAMINTEGRITY26
{ {
public class MET08EBEAMINTEGRITY26 public enum Test
{ {
Denton = Metrology.Test.Denton
public enum Test
{
Denton = Metrology.Test.Denton
}
} }
} }

View File

@ -1,16 +1,13 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08HALLHL5580
{ {
public class MET08HALLHL5580 public enum Test
{ {
Hall = Metrology.Test.Hall,
public enum Test MonthlyHall = Metrology.Test.MonthlyHall,
{ WeeklyHall = Metrology.Test.WeeklyHall
Hall = Metrology.Test.Hall,
MonthlyHall = Metrology.Test.MonthlyHall,
WeeklyHall = Metrology.Test.WeeklyHall
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08MESMICROSCOPE
{ {
public class MET08MESMICROSCOPE public enum Test
{ {
Microscope = Metrology.Test.Microscope
public enum Test
{
Microscope = Metrology.Test.Microscope
}
} }
} }

View File

@ -1,15 +1,12 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08NDFRESIMAP151C
{ {
public class MET08NDFRESIMAP151C public enum Test
{ {
Lehighton = Metrology.Test.Lehighton,
public enum Test VerificationLehighton = Metrology.Test.VerificationLehighton
{
Lehighton = Metrology.Test.Lehighton,
VerificationLehighton = Metrology.Test.VerificationLehighton
}
} }
} }

View File

@ -1,20 +1,17 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08PLMAPRPM
{ {
public class MET08PLMAPRPM public enum Test
{ {
RPMXY = Metrology.Test.RPMXY,
public enum Test RPMAverage = Metrology.Test.RPMAverage,
{ RPMPLRatio = Metrology.Test.RPMPLRatio,
RPMXY = Metrology.Test.RPMXY, DailyRPMXY = Metrology.Test.DailyRPMXY,
RPMAverage = Metrology.Test.RPMAverage, DailyRPMAverage = Metrology.Test.DailyRPMAverage,
RPMPLRatio = Metrology.Test.RPMPLRatio, DailyRPMPLRatio = Metrology.Test.DailyRPMPLRatio,
DailyRPMXY = Metrology.Test.DailyRPMXY, VerificationRPM = Metrology.Test.VerificationRPM
DailyRPMAverage = Metrology.Test.DailyRPMAverage,
DailyRPMPLRatio = Metrology.Test.DailyRPMPLRatio,
VerificationRPM = Metrology.Test.VerificationRPM
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08PRFUSB4000
{ {
public class MET08PRFUSB4000 public enum Test
{ {
Photoreflectance = Metrology.Test.Photoreflectance
public enum Test
{
Photoreflectance = Metrology.Test.Photoreflectance
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08RESIHGCV
{ {
public class MET08RESIHGCV public enum Test
{ {
HgCV = Metrology.Test.HgCV
public enum Test
{
HgCV = Metrology.Test.HgCV
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08RESIMAPCDE
{ {
public class MET08RESIMAPCDE public enum Test
{ {
CDE = Metrology.Test.CDE
public enum Test
{
CDE = Metrology.Test.CDE
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08THFTIRQS408M
{ {
public class MET08THFTIRQS408M public enum Test
{ {
BioRadQS408M = Metrology.Test.BioRadQS408M
public enum Test
{
BioRadQS408M = Metrology.Test.BioRadQS408M
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08THFTIRSTRATUS
{ {
public class MET08THFTIRSTRATUS public enum Test
{ {
BioRadStratus = Metrology.Test.BioRadStratus
public enum Test
{
BioRadStratus = Metrology.Test.BioRadStratus
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08UVH44GS100M
{ {
public class MET08UVH44GS100M public enum Test
{ {
UV = Metrology.Test.UV
public enum Test
{
UV = Metrology.Test.UV
}
} }
} }

View File

@ -1,14 +1,11 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08VPDSUBCON
{ {
public class MET08VPDSUBCON public enum Test
{ {
VpdIcpmsAnalyte = Metrology.Test.VpdIcpmsAnalyte
public enum Test
{
VpdIcpmsAnalyte = Metrology.Test.VpdIcpmsAnalyte
}
} }
} }

View File

@ -1,15 +1,12 @@
namespace Shared.Metrology namespace Shared.Metrology;
public class MET08WGEOMX203641Q
{ {
public class MET08WGEOMX203641Q public enum Test
{ {
WarpAndBow = Metrology.Test.WarpAndBow,
public enum Test VerificationWarpAndBow = Metrology.Test.VerificationWarpAndBow
{
WarpAndBow = Metrology.Test.WarpAndBow,
VerificationWarpAndBow = Metrology.Test.VerificationWarpAndBow
}
} }
} }

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