net6.0 Ready to test
This commit is contained in:
parent
836f70ed7f
commit
289547180a
7926
APC Viewer/.vscode/format-report.json
vendored
7926
APC Viewer/.vscode/format-report.json
vendored
File diff suppressed because it is too large
Load Diff
34
APC Viewer/.vscode/launch.json
vendored
Normal file
34
APC Viewer/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (web)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/bin/Debug/net6.0/win-x64/APC Viewer.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"stopAtEntry": false,
|
||||
"serverReadyAction": {
|
||||
"action": "openExternally",
|
||||
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
|
||||
"uriFormat": "%s/background"
|
||||
},
|
||||
"env": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"sourceFileMap": {
|
||||
"/Views": "${workspaceFolder}/Views"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach"
|
||||
}
|
||||
]
|
||||
}
|
41
APC Viewer/.vscode/tasks.json
vendored
Normal file
41
APC Viewer/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/APC Viewer.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/APC Viewer.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"--project",
|
||||
"${workspaceFolder}/APC Viewer.csproj"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
<RootNamespace>APCViewer</RootNamespace>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<j>Galaxy123&98765</j>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
@ -32,10 +33,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00021" />
|
||||
@ -43,14 +40,6 @@
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\images\" />
|
||||
<Folder Include="wwwroot\js\html5shiv\3.7.2\" />
|
||||
<Folder Include="wwwroot\js\respond\1.4.2\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
@ -1,16 +0,0 @@
|
||||
<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;
|
||||
}
|
||||
}
|
@ -1,300 +0,0 @@
|
||||
using APCViewer.Models;
|
||||
using APCViewer.Models.Methods;
|
||||
using APCViewer.Singleton;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
|
||||
namespace APCViewer.Controllers;
|
||||
|
||||
public class HomeController : Controller, IHomeController
|
||||
{
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Background _Background;
|
||||
private readonly IBackground _BackgroundMethods;
|
||||
|
||||
public HomeController(Background background)
|
||||
{
|
||||
_Background = background;
|
||||
_BackgroundMethods = background;
|
||||
_Log = Serilog.Log.ForContext<HomeController>();
|
||||
}
|
||||
|
||||
public ActionResult Index() => View();
|
||||
|
||||
public ActionResult Privacy() => View();
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public ActionResult Error() => View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
|
||||
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(" </td></tr>");
|
||||
else if (body)
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else if (footer)
|
||||
{
|
||||
if (pdsfLine.StartsWith("DELIMITER"))
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace(";", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine(" </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(" </td></tr>");
|
||||
else if (body)
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else if (footer)
|
||||
{
|
||||
if (ipdsfLine.StartsWith("DELIMITER"))
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace(";", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine(" </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();
|
||||
}
|
||||
|
||||
}
|
@ -11,27 +11,32 @@ namespace APCViewer.HostedService;
|
||||
public class TimedHostedService : IHostedService
|
||||
{
|
||||
|
||||
private readonly Timer _APCDataTimer;
|
||||
private readonly Timer _EDADataTimer;
|
||||
private readonly Timer _EAFLogDataTimer;
|
||||
private readonly int _ExecutionCount;
|
||||
private readonly List<Timer> _Timers;
|
||||
private readonly Timer _APCDataTimer;
|
||||
private readonly Timer _EDADataTimer;
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Background _Background;
|
||||
private readonly Timer _EAFLogDataTimer;
|
||||
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);
|
||||
_EAFLogDataTimer = new Timer(EAFLogDataCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
_Timers = new()
|
||||
{
|
||||
_APCDataTimer,
|
||||
_EDADataTimer,
|
||||
_EAFLogDataTimer
|
||||
};
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken stoppingToken)
|
||||
@ -49,25 +54,19 @@ public class TimedHostedService : IHostedService
|
||||
else if (_IsEnvironment.Staging)
|
||||
{
|
||||
_ = _APCDataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_APCDataTimer);
|
||||
milliSeconds += 2000;
|
||||
_ = _EAFLogDataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_EAFLogDataTimer);
|
||||
milliSeconds += 2000;
|
||||
_ = _EDADataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_EDADataTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else if (_IsEnvironment.Production)
|
||||
{
|
||||
_ = _APCDataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_APCDataTimer);
|
||||
milliSeconds += 2000;
|
||||
_ = _EAFLogDataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_EAFLogDataTimer);
|
||||
milliSeconds += 2000;
|
||||
_ = _EDADataTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
_Timers.Add(_EDADataTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else
|
||||
@ -82,6 +81,8 @@ public class TimedHostedService : IHostedService
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Log.Info(string.Concat("Timed Hosted Service: ", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping."));
|
||||
foreach (Timer timer in _Timers)
|
||||
_ = timer.Change(Timeout.Infinite, 0);
|
||||
_BackgroundMethods.Stop(immediate: true);
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class BackboneComponent
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class BackboneStatusCache
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface ILoggingSetupManager
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class StatusItem
|
||||
{
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class Backbone
|
||||
protected Backbone() { }
|
||||
|
||||
[NotNull]
|
||||
public static Backbone Instance { get; }
|
||||
public static Backbone? Instance { get; }
|
||||
[NotNull]
|
||||
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
|
||||
public BackboneStatusCache Status { get; }
|
||||
@ -44,4 +44,4 @@ public class Backbone
|
||||
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
|
||||
protected virtual void StopAllComponents() { }
|
||||
protected void StopComponents(List<BackboneComponent> components) { }
|
||||
}
|
||||
}
|
@ -18,4 +18,4 @@ public class EmailMessage
|
||||
public EmailMessage SetPriority(MailPriority priority) => throw new NotImplementedException();
|
||||
public EmailMessage SetSubject(string subject) => throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
@ -3,4 +3,4 @@
|
||||
public interface ISmtp
|
||||
{
|
||||
void Send(EmailMessage message);
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@ public enum MailPriority
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class ChangeDataCollectionHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class DataCollectionRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class EquipmentEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class EquipmentException
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class EquipmentSelfDescription
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class GetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IConnectionControl
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IDataTracingHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IEquipmentCommandService
|
||||
{
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ public interface IEquipmentControl : IPackageSource
|
||||
IEquipmentCommandService Commands { get; }
|
||||
[NotNull]
|
||||
IConnectionControl Connection { get; }
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IEquipmentSelfDescriptionBuilder
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IPackage
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface ISelfDescriptionLookup
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IVirtualParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class SetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public class TraceRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -35,4 +35,4 @@ public interface IEquipmentDataCollection
|
||||
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);
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IPackageSource
|
||||
{
|
||||
}
|
||||
}
|
@ -16,4 +16,4 @@ public class ParameterValue
|
||||
|
||||
public virtual ParameterValue Clone(EquipmentParameter newDefinition) => throw new NotImplementedException();
|
||||
public override string ToString() => base.ToString();
|
||||
}
|
||||
}
|
@ -19,4 +19,4 @@ public class EquipmentParameter
|
||||
|
||||
public override string ToString() => base.ToString();
|
||||
public string ToStringWithDetails() => base.ToString();
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class Field
|
||||
public string Description { get; }
|
||||
public ParameterTypeDefinition TypeDefinition { get; }
|
||||
public bool CanBeNull { get; }
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public abstract class ParameterTypeDefinition
|
||||
public string Description { get; }
|
||||
|
||||
public override string ToString() => base.ToString();
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class StructuredType : ParameterTypeDefinition
|
||||
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
||||
|
||||
public IList<Field> Fields { get; }
|
||||
}
|
||||
}
|
@ -2,4 +2,4 @@
|
||||
|
||||
public interface IConfigurationObject
|
||||
{
|
||||
}
|
||||
}
|
@ -22,4 +22,4 @@ public class ModelObjectParameterDefinition : IConfigurationObject
|
||||
|
||||
public virtual ModelObjectParameterDefinition? Clone() => null;
|
||||
public virtual bool IsValidValue(string value) => false;
|
||||
}
|
||||
}
|
@ -13,4 +13,4 @@ public enum ModelObjectParameterType
|
||||
Double = 8,
|
||||
Float = 9,
|
||||
Enum = 10
|
||||
}
|
||||
}
|
@ -40,4 +40,4 @@ public class SecsConnectionConfiguration
|
||||
public virtual TimeSpan T7ConnectionIdle { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
|
||||
}
|
||||
}
|
@ -9,4 +9,4 @@ public class ConnectionSetting
|
||||
public string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
@ -15,4 +15,4 @@ public class File
|
||||
|
||||
public File UpdateContentParameters(Dictionary<string, string> contentParameters) => throw new NotImplementedException();
|
||||
public File UpdateParsingStatus(bool isErrorFile) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -31,4 +31,4 @@ public class FilePathGenerator
|
||||
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) => throw new NotImplementedException();
|
||||
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) => throw new NotImplementedException();
|
||||
protected string ReplacePlaceholder(string inputPath) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
@ -19,7 +19,7 @@ public class FileConnectorConfiguration
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string AlternateTargetFolder { get; set; }
|
||||
public string? AlternateTargetFolder { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? FileHandleTimeout { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
@ -27,26 +27,26 @@ public class FileConnectorConfiguration
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? IdleEventWaitTimeInSeconds { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string FileAgeThreshold { get; set; }
|
||||
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; }
|
||||
public string? ZipTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ZipErrorTargetFileName { get; set; }
|
||||
public string? ZipErrorTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? ZipFileSubFolderLevel { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string DefaultPlaceHolderValue { get; set; }
|
||||
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; }
|
||||
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]
|
||||
@ -54,20 +54,20 @@ public class FileConnectorConfiguration
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileLocation { get; set; }
|
||||
public string? SourceFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileFilter { get; set; }
|
||||
public List<string> SourceFileFilters { get; set; }
|
||||
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; }
|
||||
public string? TargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileLocation { get; set; }
|
||||
public string? ErrorTargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string TargetFileName { get; set; }
|
||||
public string? TargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? FileHandleWaitTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
@ -83,7 +83,7 @@ public class FileConnectorConfiguration
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileAmount { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileName { get; set; }
|
||||
public string? ErrorTargetFileName { get; set; }
|
||||
|
||||
public void Initialize() => throw new NotImplementedException();
|
||||
|
||||
@ -131,4 +131,4 @@ public class FileConnectorConfiguration
|
||||
IgnoreNewer = 0,
|
||||
IgnoreOlder = 1
|
||||
}
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ public class FileConnectorParameterTypeDefinitionProvider
|
||||
|
||||
public IEnumerable<ParameterTypeDefinition>? GetAllParameterTypeDefinition() => null;
|
||||
public ParameterTypeDefinition? GetParameterTypeDefinition(string name) => null;
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@ namespace Library.PeerGroup.GCL.Annotations;
|
||||
public sealed class NotNullAttribute : Attribute
|
||||
{
|
||||
public NotNullAttribute() { }
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@ public enum HsmsConnectionMode
|
||||
{
|
||||
Active = 0,
|
||||
Passive = 1
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@ public enum HsmsSessionMode
|
||||
{
|
||||
MultiSession = 0,
|
||||
SingleSession = 1
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@ public enum SecsTransportType
|
||||
{
|
||||
HSMS = 0,
|
||||
Serial = 1
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ public enum SerialBaudRate
|
||||
Baud38400 = 7,
|
||||
Baud57600 = 8,
|
||||
Baud115200 = 9
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
using Shared;
|
||||
|
||||
namespace APCViewer.Models.Methods;
|
||||
|
||||
public interface IBackground
|
||||
@ -14,6 +16,6 @@ public interface IBackground
|
||||
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);
|
||||
Tuple<int, Dictionary<string, Dictionary<string, List<Logistics>>>, List<Tuple<string[], Logistics>>, string?> SetViewBag(string? directory, string? filter, bool isGaN = false, bool isSi = false, bool forPDSF = false, bool forIPDSF = false);
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace APCViewer.Models.Properties;
|
||||
|
||||
public interface IBackgroundController
|
||||
public interface IBackgroundPage
|
||||
{
|
||||
|
||||
public List<Exception> Exceptions { get; }
|
||||
|
11
APC Viewer/Models/Properties/IIPDSFPage.cs
Normal file
11
APC Viewer/Models/Properties/IIPDSFPage.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace APCViewer.Models.Properties;
|
||||
|
||||
public interface IIPDSFPage
|
||||
{
|
||||
|
||||
string? Directory { get; }
|
||||
int Files { get; }
|
||||
Dictionary<string, Dictionary<string, List<Shared.Logistics>>> Grouped { get; }
|
||||
List<Tuple<string[], Shared.Logistics>> Sorted { get; }
|
||||
|
||||
}
|
11
APC Viewer/Models/Properties/IPDSFPage.cs
Normal file
11
APC Viewer/Models/Properties/IPDSFPage.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace APCViewer.Models.Properties;
|
||||
|
||||
public interface IPDSFPage
|
||||
{
|
||||
|
||||
string? Directory { get; }
|
||||
int Files { get; }
|
||||
Dictionary<string, Dictionary<string, List<Shared.Logistics>>> Grouped { get; }
|
||||
List<Tuple<string[], Shared.Logistics>> Sorted { get; }
|
||||
|
||||
}
|
9
APC Viewer/Models/Properties/ITimePivotPage.cs
Normal file
9
APC Viewer/Models/Properties/ITimePivotPage.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace APCViewer.Models.Properties;
|
||||
|
||||
public interface ITimePivotPage
|
||||
{
|
||||
|
||||
List<string[]> ForIPDSF { get; }
|
||||
List<string[]> ForPDSF { get; }
|
||||
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
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..];
|
||||
|
||||
}
|
10
APC Viewer/Models/Stateless/Methods/IBackgroundPage.cs
Normal file
10
APC Viewer/Models/Stateless/Methods/IBackgroundPage.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace APCViewer.Models.Stateless.Methods;
|
||||
|
||||
public interface IBackgroundPage
|
||||
{
|
||||
|
||||
void OnGet(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null);
|
||||
|
||||
static string GetRouteName() => nameof(IBackgroundPage).Replace("Page", string.Empty)[1..];
|
||||
|
||||
}
|
14
APC Viewer/Models/Stateless/Methods/IIPDSFPage.cs
Normal file
14
APC Viewer/Models/Stateless/Methods/IIPDSFPage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace APCViewer.Models.Stateless.Methods;
|
||||
|
||||
public interface IIPDSFPage
|
||||
{
|
||||
|
||||
void OnGet(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false);
|
||||
// ContentResult OnGetView(string? id = null);
|
||||
// FileResult OnGetDownloadFile(string? id = null);
|
||||
// ContentResult OnGetViewCustom(string? ipdsf_file = null);
|
||||
// FileResult OnGetDownloadFileCustom(string? ipdsf_file = null);
|
||||
|
||||
static string GetRouteName() => nameof(IIPDSFPage).Replace("Page", string.Empty)[1..];
|
||||
|
||||
}
|
14
APC Viewer/Models/Stateless/Methods/IPDSFPage.cs
Normal file
14
APC Viewer/Models/Stateless/Methods/IPDSFPage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace APCViewer.Models.Stateless.Methods;
|
||||
|
||||
public interface IPDSFPage
|
||||
{
|
||||
|
||||
void OnGet(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false);
|
||||
// ContentResult OnGetView(string? id = null);
|
||||
// FileResult OnGetDownloadFile(string? id = null);
|
||||
// ContentResult OnGetViewCustom(string? pdsf_file = null);
|
||||
// FileResult OnGetDownloadFileCustom(string? pdsf_file = null);
|
||||
|
||||
static string GetRouteName() => nameof(IPDSFPage).Replace("Page", string.Empty)[1..];
|
||||
|
||||
}
|
10
APC Viewer/Models/Stateless/Methods/ITimePivotPage.cs
Normal file
10
APC Viewer/Models/Stateless/Methods/ITimePivotPage.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace APCViewer.Models.Stateless.Methods;
|
||||
|
||||
public interface ITimePivotPage
|
||||
{
|
||||
|
||||
void OnGet(bool is_gaN = false, bool is_Si = false);
|
||||
|
||||
static string GetRouteName() => nameof(ITimePivotPage).Replace("Page", string.Empty)[1..];
|
||||
|
||||
}
|
67
APC Viewer/Pages/Background.cshtml
Normal file
67
APC Viewer/Pages/Background.cshtml
Normal file
@ -0,0 +1,67 @@
|
||||
@page
|
||||
@model APCViewer.Pages.BackgroundPage
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>Background</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
<div class="jumbotron">
|
||||
<h1>@(nameof(APCViewer)) -
|
||||
@(Model.IsPrimaryInstance) -
|
||||
@(Model.IsEnvironmentProfile) -
|
||||
@(Model.AppSettingsURLs) -
|
||||
020</h1>
|
||||
<p class="lead">@(Model.WorkingDirectory)</p>
|
||||
<p class="lead">@(Model.Message)</p>
|
||||
<h1>@(string.Concat("Exception(s) - ", Model.Exceptions.Count))</h1>
|
||||
</div>
|
||||
<div>
|
||||
<ul>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/Background">Background Message</a></li>
|
||||
<li><a href="/Background/?message_clear=true">Background Message Clear</a></li>
|
||||
<li><a href="/Background/?exceptions_clear=true">Background Exceptions Clear</a></li>
|
||||
<li><a href="/Background/?set_is_primary_instance=true">Background Set Is Primary Instance</a></li>
|
||||
<li><a href="/Background/?set_is_primary_instance=false">Background Clear Primary Instance</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p> </p>
|
||||
<hr />
|
||||
<div>
|
||||
<form action="">
|
||||
@if (Model.Exceptions.Any())
|
||||
{
|
||||
int i = 0;
|
||||
@foreach (Exception exception in Model.Exceptions)
|
||||
{
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"message_", i, "\" rows='1' cols='400'>",
|
||||
exception.Message, "</textarea>"));
|
||||
</p>
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"stackTrace_", i, "\" rows='4' cols='400'>",
|
||||
exception.StackTrace, "</textarea>"));
|
||||
</p>
|
||||
<hr />
|
||||
@(i += 1)
|
||||
;
|
||||
}
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,12 +1,12 @@
|
||||
using APCViewer.Models.Stateless.Methods;
|
||||
using APCViewer.Models.Stateless.Methods;
|
||||
using IFX.Shared;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Serilog.Context;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace APCViewer.Controllers;
|
||||
namespace APCViewer.Pages;
|
||||
|
||||
public class BackgroundController : Controller, Models.Properties.IBackgroundController, IBackgroundController
|
||||
public class BackgroundPage : PageModel, Models.Properties.IBackgroundPage, IBackgroundPage
|
||||
{
|
||||
|
||||
protected readonly List<Exception> _Exceptions;
|
||||
@ -25,15 +25,15 @@ public class BackgroundController : Controller, Models.Properties.IBackgroundCon
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Models.Methods.IBackground _BackgroundMethods;
|
||||
|
||||
public BackgroundController(IsEnvironment isEnvironment, Models.AppSettings appSettings, Singleton.Background background)
|
||||
public BackgroundPage(IsEnvironment isEnvironment, Models.AppSettings appSettings, Singleton.Background background)
|
||||
{
|
||||
_Message = background.Message;
|
||||
_BackgroundMethods = background;
|
||||
_Message = background.Message;
|
||||
_AppSettingsURLs = appSettings.URLs;
|
||||
_Exceptions = background.Exceptions;
|
||||
_Log = Serilog.Log.ForContext<BackgroundPage>();
|
||||
_IsEnvironmentProfile = isEnvironment.Profile;
|
||||
_WorkingDirectory = background.WorkingDirectory;
|
||||
_Log = Serilog.Log.ForContext<BackgroundController>();
|
||||
Models.Methods.IBackground backgroundMethods = background;
|
||||
_IsPrimaryInstance = backgroundMethods.IsPrimaryInstance().ToString();
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class BackgroundController : Controller, Models.Properties.IBackgroundCon
|
||||
return result;
|
||||
}
|
||||
|
||||
public ActionResult Index(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null)
|
||||
public void OnGet(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
@ -61,22 +61,6 @@ public class BackgroundController : Controller, Models.Properties.IBackgroundCon
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
42
APC Viewer/Pages/Error.cshtml
Normal file
42
APC Viewer/Pages/Error.cshtml
Normal file
@ -0,0 +1,42 @@
|
||||
@page
|
||||
@model APCViewer.Pages.ErrorModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>Error</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/app.css" rel="stylesheet" asp-append-version="true" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<div class="content px-4">
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
20
APC Viewer/Pages/Error.cshtml.cs
Normal file
20
APC Viewer/Pages/Error.cshtml.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace APCViewer.Pages;
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
private readonly ILogger<ErrorModel> _Logger;
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger) => _Logger = logger;
|
||||
|
||||
public void OnGet() => RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
114
APC Viewer/Pages/IPDSF.cshtml
Normal file
114
APC Viewer/Pages/IPDSF.cshtml
Normal file
@ -0,0 +1,114 @@
|
||||
@page
|
||||
@using APCViewer.Pages
|
||||
@model IPDSFPage
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@{
|
||||
string viewLink;
|
||||
string downloadLink;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>IPDSF</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<h3>@(Model.Files) File(s)</h3>
|
||||
<p>
|
||||
<table id="records" border="1">
|
||||
<tr>
|
||||
<th><a href="#b" id="a">Technology - Environment</a></th>
|
||||
<th>Equipment Type</th>
|
||||
<th>Sequence</th>
|
||||
<th>Reactor</th>
|
||||
<th>RDS</th>
|
||||
<th>Part Number</th>
|
||||
<th>File Name</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.Sorted)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Model.Directory) && item.Item2.ReportFullPath.Contains(Model.Directory))
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetViewCustom), "/?iipdsf_file=",
|
||||
Html.Encode(item.Item2.ReportFullPath));
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFileCustom), "/?ipdsf_file=",
|
||||
Html.Encode(item.Item2.ReportFullPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetView), "/sequence_",
|
||||
item.Item2.Sequence);
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFile), "/sequence_",
|
||||
item.Item2.Sequence);
|
||||
}
|
||||
<tr>
|
||||
<td>@item.Item1[0]</td>
|
||||
<td>@item.Item1[1]</td>
|
||||
<td><a href="@Url.Content(viewLink)">@item.Item2.Sequence</a></td>
|
||||
<td>@item.Item2.ProcessJobID</td>
|
||||
<td>@item.Item2.MID</td>
|
||||
<td>@item.Item2.Logistics2[0].PartNumber</td>
|
||||
<td>@System.IO.Path.GetFileNameWithoutExtension(item.Item2.ReportFullPath)</td>
|
||||
<td><a href="@Url.Content(downloadLink)">@item.Item2.DateTimeFromSequence</a></td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
@if (string.IsNullOrEmpty(Model.Directory))
|
||||
{
|
||||
<hr />
|
||||
<table id="records" border="1">
|
||||
<tr>
|
||||
<th><a href="#a" id="b">Technology - Environment</a></th>
|
||||
<th>Equipment Type</th>
|
||||
<th>Sequence</th>
|
||||
<th>Reactor</th>
|
||||
<th>RDS</th>
|
||||
<th>Part Number</th>
|
||||
<th>File Name</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
@foreach (var element in Model.Grouped)
|
||||
{
|
||||
foreach (var innerElement in element.Value)
|
||||
{
|
||||
foreach (var item in innerElement.Value)
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetView), "/sequence_", item.Sequence);
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFile), "/sequence_",
|
||||
item.Sequence);
|
||||
<tr>
|
||||
<td>@element.Key</td>
|
||||
<td>@innerElement.Key</td>
|
||||
<td><a href="@Url.Content(viewLink)">@item.Sequence</a></td>
|
||||
<td>@item.ProcessJobID</td>
|
||||
<td>@item.MID</td>
|
||||
<td>@item.Logistics2[0].PartNumber</td>
|
||||
<td>@System.IO.Path.GetFileNameWithoutExtension(item.ReportFullPath)</td>
|
||||
<td><a href="@Url.Content(downloadLink)">@item.DateTimeFromSequence</a></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</table>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@section scripts {
|
||||
<script>
|
||||
$(function () {
|
||||
console.log("ready!");
|
||||
});
|
||||
</script>
|
||||
}
|
164
APC Viewer/Pages/IPDSF.cshtml.cs
Normal file
164
APC Viewer/Pages/IPDSF.cshtml.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using APCViewer.Models.Stateless.Methods;
|
||||
using IFX.Shared;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Serilog.Context;
|
||||
using Shared;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace APCViewer.Pages;
|
||||
|
||||
public class IPDSFPage : PageModel, Models.Properties.IIPDSFPage, IIPDSFPage
|
||||
{
|
||||
|
||||
protected string? _Directory;
|
||||
protected int _Files;
|
||||
protected Dictionary<string, Dictionary<string, List<Shared.Logistics>>> _Grouped;
|
||||
protected List<Tuple<string[], Shared.Logistics>> _Sorted;
|
||||
public string? Directory => _Directory;
|
||||
public int Files => _Files;
|
||||
public Dictionary<string, Dictionary<string, List<Shared.Logistics>>> Grouped => _Grouped;
|
||||
public List<Tuple<string[], Shared.Logistics>> Sorted => _Sorted;
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Singleton.Background _Background;
|
||||
private readonly Models.Methods.IBackground _BackgroundMethods;
|
||||
|
||||
#nullable disable
|
||||
public IPDSFPage(Singleton.Background background)
|
||||
{
|
||||
_Background = background;
|
||||
_BackgroundMethods = background;
|
||||
_Log = Serilog.Log.ForContext<IPDSFPage>();
|
||||
}
|
||||
#nullable enable
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OnGet(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Log.Debug("() => ...");
|
||||
Tuple<int, Dictionary<string, Dictionary<string, List<Logistics>>>, List<Tuple<string[], Logistics>>, string?> tuple = _BackgroundMethods.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forIPDSF: true);
|
||||
_Files = tuple.Item1;
|
||||
_Grouped = tuple.Item2;
|
||||
_Sorted = tuple.Item3;
|
||||
_Directory = tuple.Item4;
|
||||
}
|
||||
}
|
||||
|
||||
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(" </td></tr>");
|
||||
else if (body)
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else if (footer)
|
||||
{
|
||||
if (ipdsfLine.StartsWith("DELIMITER"))
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace(";", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else
|
||||
_ = result.Append("<tr><td>").Append(ipdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine(" </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 OnGetView(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 FileResult OnGetDownloadFile(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 OnGetViewCustom(string? ipdsf_file = null)
|
||||
{
|
||||
StringBuilder result = GetIPDSFHtml(ipdsf_file);
|
||||
return Content(result.ToString(), "text/html");
|
||||
}
|
||||
|
||||
public FileResult OnGetDownloadFileCustom(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));
|
||||
}
|
||||
|
||||
}
|
114
APC Viewer/Pages/PDSF.cshtml
Normal file
114
APC Viewer/Pages/PDSF.cshtml
Normal file
@ -0,0 +1,114 @@
|
||||
@page
|
||||
@using APCViewer.Pages
|
||||
@model PDSFPage
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
@{
|
||||
string viewLink;
|
||||
string downloadLink;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>PDSF</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<h3>@(Model.Files) File(s)</h3>
|
||||
<p>
|
||||
<table id="records" border="1">
|
||||
<tr>
|
||||
<th><a href="#b" id="a">Technology - Environment</a></th>
|
||||
<th>Equipment Type</th>
|
||||
<th>Sequence</th>
|
||||
<th>Reactor</th>
|
||||
<th>RDS</th>
|
||||
<th>Part Number</th>
|
||||
<th>File Name</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.Sorted)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Model.Directory) && item.Item2.ReportFullPath.Contains(Model.Directory))
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetViewCustom), "/?pdsf_file=",
|
||||
Html.Encode(item.Item2.ReportFullPath));
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFileCustom), "/?pdsf_file=",
|
||||
Html.Encode(item.Item2.ReportFullPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetView), "/sequence_",
|
||||
item.Item2.Sequence);
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFile), "/sequence_",
|
||||
item.Item2.Sequence);
|
||||
}
|
||||
<tr>
|
||||
<td>@item.Item1[0]</td>
|
||||
<td>@item.Item1[1]</td>
|
||||
<td><a href="@Url.Content(viewLink)">@item.Item2.Sequence</a></td>
|
||||
<td>@item.Item2.ProcessJobID</td>
|
||||
<td>@item.Item2.MID</td>
|
||||
<td>@item.Item2.Logistics2[0].PartNumber</td>
|
||||
<td>@System.IO.Path.GetFileNameWithoutExtension(item.Item2.ReportFullPath)</td>
|
||||
<td><a href="@Url.Content(downloadLink)">@item.Item2.DateTimeFromSequence</a></td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
@if (string.IsNullOrEmpty(Model.Directory))
|
||||
{
|
||||
<hr />
|
||||
<table id="records" border="1">
|
||||
<tr>
|
||||
<th><a href="#a" id="b">Technology - Environment</a></th>
|
||||
<th>Equipment Type</th>
|
||||
<th>Sequence</th>
|
||||
<th>Reactor</th>
|
||||
<th>RDS</th>
|
||||
<th>Part Number</th>
|
||||
<th>File Name</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
@foreach (var element in Model.Grouped)
|
||||
{
|
||||
foreach (var innerElement in element.Value)
|
||||
{
|
||||
foreach (var item in innerElement.Value)
|
||||
{
|
||||
viewLink = string.Concat("/", nameof(PDSFPage.OnGetView), "/sequence_", item.Sequence);
|
||||
downloadLink = string.Concat("/", nameof(PDSFPage.OnGetDownloadFile), "/sequence_",
|
||||
item.Sequence);
|
||||
<tr>
|
||||
<td>@element.Key</td>
|
||||
<td>@innerElement.Key</td>
|
||||
<td><a href="@Url.Content(viewLink)">@item.Sequence</a></td>
|
||||
<td>@item.ProcessJobID</td>
|
||||
<td>@item.MID</td>
|
||||
<td>@item.Logistics2[0].PartNumber</td>
|
||||
<td>@System.IO.Path.GetFileNameWithoutExtension(item.ReportFullPath)</td>
|
||||
<td><a href="@Url.Content(downloadLink)">@item.DateTimeFromSequence</a></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</table>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@section scripts {
|
||||
<script>
|
||||
$(function () {
|
||||
console.log("ready!");
|
||||
});
|
||||
</script>
|
||||
}
|
164
APC Viewer/Pages/PDSF.cshtml.cs
Normal file
164
APC Viewer/Pages/PDSF.cshtml.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using APCViewer.Models.Stateless.Methods;
|
||||
using IFX.Shared;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Serilog.Context;
|
||||
using Shared;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace APCViewer.Pages;
|
||||
|
||||
public class PDSFPage : PageModel, Models.Properties.IPDSFPage, Models.Stateless.Methods.IPDSFPage
|
||||
{
|
||||
|
||||
protected string? _Directory;
|
||||
protected int _Files;
|
||||
protected Dictionary<string, Dictionary<string, List<Shared.Logistics>>> _Grouped;
|
||||
protected List<Tuple<string[], Shared.Logistics>> _Sorted;
|
||||
public string? Directory => _Directory;
|
||||
public int Files => _Files;
|
||||
public Dictionary<string, Dictionary<string, List<Shared.Logistics>>> Grouped => _Grouped;
|
||||
public List<Tuple<string[], Shared.Logistics>> Sorted => _Sorted;
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Singleton.Background _Background;
|
||||
private readonly Models.Methods.IBackground _BackgroundMethods;
|
||||
|
||||
#nullable disable
|
||||
public PDSFPage(Singleton.Background background)
|
||||
{
|
||||
_Background = background;
|
||||
_BackgroundMethods = background;
|
||||
_Log = Serilog.Log.ForContext<PDSFPage>();
|
||||
}
|
||||
#nullable enable
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OnGet(string? directory = null, string? filter = null, bool is_gaN = false, bool is_Si = false)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Log.Debug("() => ...");
|
||||
Tuple<int, Dictionary<string, Dictionary<string, List<Logistics>>>, List<Tuple<string[], Logistics>>, string?> tuple = _BackgroundMethods.SetViewBag(directory, filter, isGaN: is_gaN, isSi: is_Si, forPDSF: true);
|
||||
_Files = tuple.Item1;
|
||||
_Grouped = tuple.Item2;
|
||||
_Sorted = tuple.Item3;
|
||||
_Directory = tuple.Item4;
|
||||
}
|
||||
}
|
||||
|
||||
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(" </td></tr>");
|
||||
else if (body)
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else if (footer)
|
||||
{
|
||||
if (pdsfLine.StartsWith("DELIMITER"))
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace(";", "</td><td>")).AppendLine(" </td></tr>");
|
||||
else
|
||||
_ = result.Append("<tr><td>").Append(pdsfLine.Replace("\t", "</td><td>").Replace("=", "</td><td>").Replace(";", "</td><td>")).AppendLine(" </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 OnGetView(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 FileResult OnGetDownloadFile(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 OnGetViewCustom(string? pdsf_file = null)
|
||||
{
|
||||
StringBuilder result = GetPDSFHtml(pdsf_file);
|
||||
return Content(result.ToString(), "text/html");
|
||||
}
|
||||
|
||||
public FileResult OnGetDownloadFileCustom(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));
|
||||
}
|
||||
|
||||
}
|
53
APC Viewer/Pages/TimePivot.cshtml
Normal file
53
APC Viewer/Pages/TimePivot.cshtml
Normal file
@ -0,0 +1,53 @@
|
||||
@page
|
||||
@model APCViewer.Pages.TimePivotPage
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<title>TimePivot</title>
|
||||
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/app.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main">
|
||||
<h3>*.ipdsf</h3>
|
||||
<table id="forIPDSF" border="1">
|
||||
@foreach (var segments in Model.ForIPDSF)
|
||||
{
|
||||
<tr>
|
||||
@for (int i = 0; i < segments.Length; i++)
|
||||
{
|
||||
<td>@(segments[i])</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
<hr />
|
||||
<h3>*.pdsf</h3>
|
||||
<table id="forPDSF" border="1">
|
||||
@foreach (var segments in Model.ForPDSF)
|
||||
{
|
||||
<tr>
|
||||
@for (int i = 0; i < segments.Length; i++)
|
||||
{
|
||||
<td>@(segments[i])</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@section scripts {
|
||||
<script>
|
||||
$(function () {
|
||||
console.log("ready!");
|
||||
});
|
||||
</script>
|
||||
}
|
49
APC Viewer/Pages/TimePivot.cshtml.cs
Normal file
49
APC Viewer/Pages/TimePivot.cshtml.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using APCViewer.Models.Stateless.Methods;
|
||||
using IFX.Shared;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Serilog.Context;
|
||||
using Shared;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace APCViewer.Pages;
|
||||
|
||||
public class TimePivotPage : PageModel, Models.Properties.ITimePivotPage, ITimePivotPage
|
||||
{
|
||||
|
||||
protected List<string[]> _ForIPDSF;
|
||||
protected List<string[]> _ForPDSF;
|
||||
public List<string[]> ForIPDSF => _ForIPDSF;
|
||||
public List<string[]> ForPDSF => _ForPDSF;
|
||||
|
||||
private readonly Serilog.ILogger _Log;
|
||||
private readonly Singleton.Background _Background;
|
||||
private readonly Models.Methods.IBackground _BackgroundMethods;
|
||||
|
||||
#nullable disable
|
||||
public TimePivotPage(Singleton.Background background)
|
||||
{
|
||||
_Background = background;
|
||||
_BackgroundMethods = background;
|
||||
_Log = Serilog.Log.ForContext<TimePivotPage>();
|
||||
}
|
||||
#nullable enable
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
return result;
|
||||
}
|
||||
|
||||
public void OnGet(bool is_gaN = false, bool is_Si = false)
|
||||
{
|
||||
string? methodName = IMethodName.GetActualAsyncMethodName();
|
||||
using (LogContext.PushProperty("MethodName", methodName))
|
||||
{
|
||||
_Log.Debug("() => ...");
|
||||
Tuple<List<string[]>, List<string[]>> tuple = _BackgroundMethods.GetTimePivot(isGaN: is_gaN, isSi: is_Si);
|
||||
_ForIPDSF = tuple.Item1;
|
||||
_ForPDSF = tuple.Item2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -13,7 +13,6 @@ public class Program
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
// ConsoleLoggerConfigurationExtensions.Console(loggerConfiguration.WriteTo);
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string? assemblyName = assembly.GetName()?.Name;
|
||||
if (string.IsNullOrEmpty(assemblyName))
|
||||
@ -24,6 +23,7 @@ public class Program
|
||||
throw new Exception("Working directory name must have a value!");
|
||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||
_ = ConsoleLoggerConfigurationExtensions.Console(loggerConfiguration.WriteTo);
|
||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, webApplicationBuilder.Configuration);
|
||||
_ = SerilogHostBuilderExtensions.UseSerilog(webApplicationBuilder.Host);
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
@ -32,27 +32,21 @@ public class Program
|
||||
{
|
||||
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"))
|
||||
if (isEnvironment.Development && string.IsNullOrEmpty(appSettings.URLs))
|
||||
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"))
|
||||
if (appSettings.URLs == "Exit")
|
||||
{
|
||||
Environment.ExitCode = -1;
|
||||
webApplication.Lifetime.StopApplication();
|
||||
}
|
||||
_ = webApplication.UseSwagger();
|
||||
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "APC Viewer API V1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -65,12 +59,9 @@ public class Program
|
||||
_ = 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();
|
||||
|
||||
|
@ -174,4 +174,4 @@ public class Description
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -47,4 +47,4 @@ public enum EquipmentType
|
||||
MET08XRDXPERTPROMRDXL_Monthly,
|
||||
MET08XRDXPERTPROMRDXL_Weekly,
|
||||
METBRXRAYJV7300L
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ public interface IProcessData
|
||||
|
||||
Tuple<string, JsonElement?, List<FileInfo>> GetResults(ILogic logic, ConfigDataBase configData, List<FileInfo> fileInfoCollection);
|
||||
|
||||
}
|
||||
}
|
@ -20,4 +20,4 @@ public interface IProcessDataDescription
|
||||
List<string> GetParameterNames(ILogic logic, ConfigDataBase configDataBase);
|
||||
string GetEventDescription();
|
||||
|
||||
}
|
||||
}
|
@ -15,4 +15,4 @@ public interface IScopeInfo
|
||||
string FileNameWithoutExtension { get; }
|
||||
EquipmentType EquipmentType { get; }
|
||||
|
||||
}
|
||||
}
|
@ -165,4 +165,4 @@ public class IsEnvironment
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -227,4 +227,4 @@ public class Logistics
|
||||
Logistics1 = new string[] { string.Concat("LOGISTICS_1", '\t', "A_JOBID=", JobID, ";A_MES_ENTITY=", MesEntity, ";") }.ToList();
|
||||
Logistics2 = new List<Logistics2>();
|
||||
}
|
||||
}
|
||||
}
|
@ -75,4 +75,4 @@ public class Logistics2
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -272,7 +272,7 @@ public static class ColumnGet
|
||||
|
||||
public static Description.Param GetParam(this Column column)
|
||||
{
|
||||
var results = column switch
|
||||
Description.Param results = column switch
|
||||
{
|
||||
//case Column._8in_Total_Warp_Verification: results = Description.Param.String; break;
|
||||
//case Column.AFM_Monthly_Y: results = Description.Param.String; break;
|
||||
@ -795,4 +795,4 @@ public enum Column
|
||||
W,
|
||||
Y,
|
||||
Zn
|
||||
}
|
||||
}
|
@ -383,4 +383,4 @@ public class ConfigDataBase
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -7,4 +7,4 @@ public enum EventName
|
||||
FileReadMonthly,
|
||||
FileReadVerification,
|
||||
FileReadWeekly
|
||||
}
|
||||
}
|
@ -42,4 +42,4 @@ public interface ILogic
|
||||
void SetPlaceHolder(string reportFullPath, string key, string value);
|
||||
void SetTarget2FileLocation(string value);
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08AFMD3100
|
||||
AFMRoughness = Metrology.Test.AFMRoughness
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ public class MET08BVHGPROBE
|
||||
BreakdownVoltageMiddle8in = Metrology.Test.BreakdownVoltageMiddle8in
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ public class MET08CVHGPROBE802B150
|
||||
WeeklyCV = Metrology.Test.WeeklyCV
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ public class MET08DDINCAN8620
|
||||
CandelaProdU = Metrology.Test.CandelaProdU
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08DDUPSFS6420
|
||||
Tencor = Metrology.Test.Tencor
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08DDUPSP1TBI
|
||||
SP1 = Metrology.Test.SP1
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08EBEAMINTEGRITY26
|
||||
Denton = Metrology.Test.Denton
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,4 +10,4 @@ public class MET08HALLHL5580
|
||||
WeeklyHall = Metrology.Test.WeeklyHall
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08MESMICROSCOPE
|
||||
Microscope = Metrology.Test.Microscope
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -9,4 +9,4 @@ public class MET08NDFRESIMAP151C
|
||||
VerificationLehighton = Metrology.Test.VerificationLehighton
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@ public class MET08PLMAPRPM
|
||||
VerificationRPM = Metrology.Test.VerificationRPM
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08PRFUSB4000
|
||||
Photoreflectance = Metrology.Test.Photoreflectance
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08RESIHGCV
|
||||
HgCV = Metrology.Test.HgCV
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08RESIMAPCDE
|
||||
CDE = Metrology.Test.CDE
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ public class MET08THFTIRQS408M
|
||||
BioRadQS408M = Metrology.Test.BioRadQS408M
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user