Removed GetImageBytes

This commit is contained in:
Mike Phares 2023-05-09 08:09:20 -07:00
parent 5924860f6c
commit e6a775e67c
6 changed files with 60 additions and 293 deletions

View File

@ -86,7 +86,7 @@ public class WSRequest
}
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
string[] jsonFiles = Directory.GetFiles(matchDirectory, "*.data.json", SearchOption.TopDirectoryOnly);
string[] jsonFiles = Directory.GetFiles(matchDirectory, "*.json", SearchOption.TopDirectoryOnly);
if (jsonFiles.Length != 1)
throw new Exception($"Invalid source file count for <{wsResultsHeaderID}>!{Environment.NewLine}{json}");
List<WS.Attachment> headerAttachments = new() { new WS.Attachment(descriptions[0].HeaderUniqueId, "Data.json", jsonFiles.First()) };

View File

@ -4,10 +4,8 @@ using log4net;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
@ -46,11 +44,6 @@ public partial class ProcessData : IProcessData
MesEntity = logistics.MesEntity;
_Log = LogManager.GetLogger(typeof(ProcessData));
CSV csv = Parse(fileRead, logistics, fileInfoCollection);
_ = GetImageBytes(csv);
string directory = Path.GetDirectoryName(logistics.ReportFullPath);
string fileName = Path.Combine(directory, $"{Path.GetFileNameWithoutExtension(logistics.ReportFullPath)}.data.json");
string json = JsonSerializer.Serialize(csv, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(fileName, json);
if (!string.IsNullOrEmpty(csv.Info?.SampleName) && csv.ProfileHeader.ProfilePoints.Any())
SetValues(logistics, tickOffset, csv);
}
@ -306,253 +299,4 @@ public partial class ProcessData : IProcessData
return results;
}
private static void GetMinMax(List<ProfilePoint> profilePoints, out double maxDepth, out int concentrationMaxD, out int concentrationMinD, out int resistanceEditedMaxD, out int resistanceEditedMinD, out int resistivityMaxD, out int resistivityMinD)
{
maxDepth = 30;
concentrationMaxD = -99;
concentrationMinD = 99;
resistanceEditedMaxD = -99;
resistanceEditedMinD = 99;
resistivityMaxD = -99;
resistivityMinD = 99;
foreach (ProfilePoint profilePoint in profilePoints)
{
if (profilePoint.Depth > 0 && profilePoint.Edited is not null && profilePoint.Resistivity is not null && profilePoint.CD is not null)
{
maxDepth = profilePoint.Depth;
if (Math.Log10(profilePoint.Resistivity.Value) < resistivityMinD)
resistivityMinD = (int)Math.Log10(profilePoint.Resistivity.Value);
if (Math.Ceiling(Math.Log10(profilePoint.Resistivity.Value)) > resistivityMaxD)
resistivityMaxD = (int)Math.Ceiling(Math.Log10(profilePoint.Resistivity.Value));
if (Math.Log10(profilePoint.Edited.Value) < resistanceEditedMinD)
resistanceEditedMinD = (int)Math.Log10(profilePoint.Edited.Value);
if (Math.Ceiling(Math.Log10(profilePoint.Edited.Value)) > resistanceEditedMaxD)
resistanceEditedMaxD = (int)Math.Ceiling(Math.Log10(profilePoint.Edited.Value));
if (Math.Log10(profilePoint.CD.Value) < concentrationMinD)
concentrationMinD = (int)Math.Log10(profilePoint.CD.Value);
if (Math.Ceiling(Math.Log10(profilePoint.CD.Value)) > concentrationMaxD)
concentrationMaxD = (int)Math.Ceiling(Math.Log10(profilePoint.CD.Value));
}
}
}
private static PointF GetPointF(double x, double y) =>
new((float)x, (float)y);
private static RectangleF GetRectangleF(double left, double top, double width, double height) =>
new((float)left, (float)top, (float)width, (float)height);
private static void DrawLine(Graphics graphics, Pen pen, double x1, double y1, double x2, double y2) =>
graphics.DrawLine(pen, (float)x1, (float)y1, (float)x2, (float)y2);
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y) =>
graphics.DrawString(s, font, brush, (float)x, (float)y);
private static void FillEllipse(Graphics graphics, Brush brush, double x, double y, double width, double height) =>
graphics.FillEllipse(brush, (float)x, (float)y, (float)width, (float)height);
private static void DrawString(Graphics graphics, string s, Font font, Brush brush, double x, double y, StringFormat stringFormat) =>
graphics.DrawString(s, font, brush, (float)x, (float)y, stringFormat);
internal static byte[] GetImageBytes(CSV csv)
{
if (csv.Info is null)
throw new NullReferenceException(nameof(csv.Info));
if (csv.Setup is null)
throw new NullReferenceException(nameof(csv.Setup));
if (csv.ProfileHeader is null)
throw new NullReferenceException(nameof(csv.ProfileHeader));
if (csv.LayerHeader is null)
throw new NullReferenceException(nameof(csv.LayerHeader));
double maxDepth;
int concentrationMaxD, concentrationMinD, resistanceEditedMaxD, resistanceEditedMinD, resistivityMaxD, resistivityMinD;
GetMinMax(csv.ProfileHeader.ProfilePoints, out maxDepth, out concentrationMaxD, out concentrationMinD, out resistanceEditedMaxD, out resistanceEditedMinD, out resistivityMaxD, out resistivityMinD);
int decades;
byte[] bytes;
double point;
int width = 694;
int height = 714;
int position = -1;
Pen pen = Pens.Black;
int blocksOfDepth = 6;
RectangleF[] rectangles;
double topChartArea = 90;
double widthOfDepthBlock;
double leftChartArea = 60;
double widthOfBlacks = 120;
Brush brush = Brushes.Black;
double widthChartArea = 500;
double heightChartArea = 600;
StringBuilder layers = new();
Font consolas = new("Consolas", 9);
PointF[]? resistivityPoints = null;
StringFormat sfFormatRight = new();
Color backgroundColor = Color.White;
PointF[]? concentrationPoints = null;
Brush resistivityBrush = Brushes.Green;
Brush concentrationBrush = Brushes.Blue;
Brush resistanceRawBrush = Brushes.Black;
Pen resistivityPen = new(Color.Green, 2);
Brush resistanceEditedBrush = Brushes.Red;
double sizeOfBlock = heightChartArea / 18;
Pen concentrationPen = new(Color.Blue, 2);
Brush backgroundBrush = Brushes.WhiteSmoke;
Pen resistanceRawPen = new(Color.Black, 2);
Pen transitionWidthPen = new(Color.Orange);
Pen resistanceEditedPen = new(Color.Red, 2);
Font consolasBold = new("Consolas", 9); // , FontStyle.Bold)
concentrationPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
concentrationPen.DashPattern = new float[] { 5, 4 };
resistanceEditedPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
resistanceEditedPen.DashPattern = new float[] { 1, 3 };
resistanceRawPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
resistanceRawPen.DashPattern = new float[] { 1, 3 };
transitionWidthPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
transitionWidthPen.DashPattern = new float[] { 5, 4 };
sfFormatRight.Alignment = StringAlignment.Far;
Bitmap bitmap = new(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(backgroundColor);
widthOfDepthBlock = Math.Ceiling(maxDepth / 3) * 3 / 6;
// maxDepth = widthOfDepthBlock * blocksOfDepth;
decades = resistivityMaxD - resistivityMinD;
if (resistanceEditedMaxD - resistanceEditedMinD > decades)
decades = resistanceEditedMaxD - resistanceEditedMinD;
if (concentrationMaxD - concentrationMinD > decades)
decades = concentrationMaxD - concentrationMinD;
rectangles = new RectangleF[1];
rectangles[0] = GetRectangleF(leftChartArea, topChartArea, widthChartArea, heightChartArea);
graphics.FillRectangles(backgroundBrush, rectangles);
rectangles = new RectangleF[18];
rectangles[0] = GetRectangleF(leftChartArea, 10, widthChartArea, 65);
// rectangles[1] = GetRectangleF(leftChartArea + widthChartArea, topChartArea, widthOfBlacks, sizeOfBlock * 5);
rectangles[1] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 0, widthOfBlacks, sizeOfBlock);
rectangles[2] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 1, widthOfBlacks, sizeOfBlock);
rectangles[3] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 2, widthOfBlacks, sizeOfBlock);
rectangles[4] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 3, widthOfBlacks, sizeOfBlock);
rectangles[5] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 4, widthOfBlacks, sizeOfBlock);
rectangles[6] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 5, widthOfBlacks, sizeOfBlock);
rectangles[7] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 6, widthOfBlacks, sizeOfBlock);
rectangles[8] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 7, widthOfBlacks, sizeOfBlock);
rectangles[9] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 8, widthOfBlacks, sizeOfBlock);
rectangles[10] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 9, widthOfBlacks, sizeOfBlock);
rectangles[11] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 10, widthOfBlacks, sizeOfBlock);
rectangles[12] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 11, widthOfBlacks, sizeOfBlock);
rectangles[13] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 12, widthOfBlacks, sizeOfBlock);
rectangles[14] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 13, widthOfBlacks, sizeOfBlock);
rectangles[15] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 14, widthOfBlacks, sizeOfBlock);
rectangles[16] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 15, widthOfBlacks, sizeOfBlock);
rectangles[17] = GetRectangleF(leftChartArea + widthChartArea, topChartArea + sizeOfBlock * 16, widthOfBlacks, sizeOfBlock * 2);
graphics.FillRectangles(Brushes.White, rectangles);
graphics.DrawRectangles(pen, rectangles);
foreach (Layer layer in csv.LayerHeader.Layers)
_ = layers.AppendLine(string.Concat("First Pt. ", layer.FirstPoint, " Last Pt. ", layer.LastPoint, " Type ", layer.Type, " Smoothing ", layer.Smoothing, " Correction ", layer.Correction));
_ = layers.AppendLine(string.Join(" ", csv.Info.Comments));
graphics.DrawString(layers.ToString(), consolas, brush, rectangles[0]);
graphics.DrawString(string.Concat(csv.Info.SystemId, Environment.NewLine, csv.Info.SoftwareVersion), consolas, brush, rectangles[9]);
graphics.DrawString(string.Concat("SURFACE FINISH", Environment.NewLine, csv.Setup.Finish), consolas, brush, rectangles[10]);
graphics.DrawString(string.Concat("ORIENTATION", Environment.NewLine, csv.Setup.Orientation), consolas, brush, rectangles[11]);
graphics.DrawString(string.Concat("BEVEL ANGLE", Environment.NewLine, csv.Setup.SineBevelAngle), consolas, brush, rectangles[12]);
graphics.DrawString(string.Concat("X-STEP (um)", Environment.NewLine, csv.Setup.Steps.First().X), consolas, brush, rectangles[13]);
graphics.DrawString(string.Concat("PROBE LOAD (gm)", Environment.NewLine, csv.Setup.ProbeLoad), consolas, brush, rectangles[14]);
graphics.DrawString(string.Concat("SPACING (um)", Environment.NewLine, csv.Setup.ProbeSpacing), consolas, brush, rectangles[15]);
graphics.DrawString(string.Concat("OPERATOR", Environment.NewLine, csv.Info.Operator), consolas, brush, rectangles[16]);
graphics.DrawString(string.Concat("DATE", Environment.NewLine, csv.Info.DateTime.ToString("dd MMM yy"), Environment.NewLine, "TIME", Environment.NewLine, csv.Info.DateTime.ToString("HH:mm:ss tt")), consolas, brush, rectangles[17]);
DrawLine(graphics, concentrationPen, 13, 6, 13, 40);
graphics.DrawString("C", consolasBold, concentrationBrush, 8, 41);
graphics.DrawString("D", consolasBold, concentrationBrush, 8, 53);
DrawLine(graphics, resistivityPen, 28, 6, 28, 40);
graphics.DrawString("ρ", consolasBold, resistivityBrush, 21, 41);
graphics.DrawString("c", consolasBold, resistivityBrush, 21, 53);
graphics.DrawString("m", consolasBold, resistivityBrush, 21, 62);
DrawLine(graphics, resistanceRawPen, 39, 7, 39, 41);
graphics.DrawString("Ω", consolasBold, resistanceRawBrush, 34, 41);
DrawLine(graphics, resistanceEditedPen, 51, 7, 51, 41);
graphics.DrawString("Ω", consolasBold, resistanceEditedBrush, 46, 41);
graphics.DrawString("E", consolasBold, resistanceEditedBrush, 46, 53);
for (int iLoop = decades - 1; iLoop >= 0; iLoop += -1)
{
for (int iLoop_Sub = 1; iLoop_Sub <= 10; iLoop_Sub++)
DrawLine(graphics, Pens.LightGray, leftChartArea, topChartArea + heightChartArea - (iLoop * heightChartArea / decades) + heightChartArea / decades * Math.Log10(iLoop_Sub), leftChartArea + widthChartArea, topChartArea + heightChartArea - (iLoop * heightChartArea / decades) + heightChartArea / decades * Math.Log10(iLoop_Sub));
}
DrawString(graphics, "0", consolas, brush, leftChartArea - 5, topChartArea + heightChartArea + 5);
for (int iLoop = 0; iLoop <= blocksOfDepth - 1; iLoop++)
{
for (int iLoop_Sub = 1; iLoop_Sub <= 10; iLoop_Sub++)
DrawLine(graphics, Pens.LightGray, leftChartArea + (iLoop * widthChartArea / blocksOfDepth) + iLoop_Sub * widthChartArea / blocksOfDepth / 10, topChartArea, leftChartArea + (iLoop * widthChartArea / blocksOfDepth) + (iLoop_Sub * widthChartArea / blocksOfDepth / 10), topChartArea + heightChartArea);
DrawString(graphics, ((iLoop + 1) * widthOfDepthBlock).ToString("0.0"), consolas, brush, leftChartArea + 13 + (iLoop + 1) * widthChartArea / blocksOfDepth, topChartArea + heightChartArea + 5, sfFormatRight);
}
DrawString(graphics, "(um)", consolas, brush, leftChartArea + widthChartArea + 12, topChartArea + heightChartArea + 5);
for (int iLoop = 0; iLoop <= decades; iLoop++)
{
DrawLine(graphics, pen, leftChartArea, topChartArea + (iLoop * heightChartArea / decades), leftChartArea + widthChartArea, topChartArea + (iLoop * heightChartArea / decades));
DrawString(graphics, (decades - iLoop + concentrationMinD).ToString("0"), consolasBold, concentrationBrush, 20, topChartArea - 10 + (iLoop * heightChartArea / decades), sfFormatRight);
DrawString(graphics, (decades - iLoop + resistivityMinD).ToString("0"), consolasBold, resistivityBrush, 33, topChartArea - 10 + (iLoop * heightChartArea / decades), sfFormatRight);
DrawString(graphics, (decades - iLoop + resistanceEditedMinD).ToString("0"), consolasBold, resistanceRawBrush, 45, topChartArea - 10 + (iLoop * heightChartArea / decades), sfFormatRight);
DrawString(graphics, (decades - iLoop + resistanceEditedMinD).ToString("0"), consolasBold, resistanceEditedBrush, 58, topChartArea - 10 + (iLoop * heightChartArea / decades), sfFormatRight);
}
for (int iLoop = 0; iLoop <= blocksOfDepth; iLoop++)
DrawLine(graphics, pen, leftChartArea + (iLoop * widthChartArea / blocksOfDepth), topChartArea, leftChartArea + (iLoop * widthChartArea / blocksOfDepth), topChartArea + heightChartArea);
foreach (ProfilePoint profilePoint in csv.ProfileHeader.ProfilePoints)
{
if (profilePoint.Depth < 0 || profilePoint.Edited is null || profilePoint.Resistivity is null || profilePoint.CD is null)
continue;
// Rho (Resistivity || Resistivity_ohm_cm) = Green
if (profilePoint.Depth < 0 || profilePoint.Edited.Value == 0 || profilePoint.Resistivity.Value == 0 || profilePoint.CD.Value == 0)
continue;
point = topChartArea + heightChartArea - ((Math.Log10(profilePoint.Resistivity.Value) - resistivityMinD) / decades * heightChartArea);
if (point < (90 - 2))
continue;
if (point > (topChartArea + heightChartArea + 2))
continue;
position += 1;
PointF[]? resistivityOldPoints = resistivityPoints;
resistivityPoints = new PointF[position + 1];
if (resistivityOldPoints != null)
Array.Copy(resistivityOldPoints, resistivityPoints, Math.Min(position + 1, resistivityOldPoints.Length));
PointF[]? concentrationPointsOld = concentrationPoints;
concentrationPoints = new PointF[position + 1];
if (concentrationPointsOld != null)
Array.Copy(concentrationPointsOld, concentrationPoints, Math.Min(position + 1, concentrationPointsOld.Length));
resistivityPoints[position] = GetPointF(leftChartArea + profilePoint.Depth / maxDepth * widthChartArea, topChartArea + heightChartArea - ((Math.Log10(profilePoint.Resistivity.Value) - resistivityMinD) / decades * heightChartArea));
concentrationPoints[position] = GetPointF(leftChartArea + profilePoint.Depth / maxDepth * widthChartArea, topChartArea + heightChartArea - ((Math.Log10(profilePoint.CD.Value) - concentrationMinD) / decades * heightChartArea));
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
FillEllipse(graphics, resistanceRawBrush, leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - 2, topChartArea + heightChartArea - ((Math.Log10(profilePoint.Raw) - resistanceEditedMinD) / decades * heightChartArea) - 2, 3, 3);
FillEllipse(graphics, resistanceEditedBrush, leftChartArea + profilePoint.Depth / maxDepth * widthChartArea - 2, topChartArea + heightChartArea - ((Math.Log10(profilePoint.Edited.Value) - resistanceEditedMinD) / decades * heightChartArea) - 2, 3, 3);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
}
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
if (resistivityPoints is not null)
graphics.DrawLines(resistivityPen, resistivityPoints);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
if (concentrationPoints is not null)
graphics.DrawLines(concentrationPen, concentrationPoints);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
using MemoryStream msMemoryStream = new();
bitmap.Save(msMemoryStream, System.Drawing.Imaging.ImageFormat.Png);
bytes = new byte[Convert.ToInt32(msMemoryStream.Length) + 1];
_ = msMemoryStream.Read(bytes, 0, bytes.Length);
bytes = msMemoryStream.ToArray();
return bytes;
}
}

View File

@ -1,7 +1,7 @@
trigger:
branches:
include:
- development
- Development
paths:
include:
- "Adaptation/*"

View File

@ -47,13 +47,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting?.Dispose();
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
@ -65,7 +58,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -79,7 +71,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -93,7 +84,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -107,7 +97,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -121,7 +110,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -135,7 +123,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -149,7 +136,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -163,7 +149,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -177,7 +162,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
#if DEBUG
@ -191,7 +175,6 @@ public class MET08RESISRP2100 : EAFLoggingUnitTesting
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
_ = AdaptationTesting.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
NonThrowTryCatch();
}
}

View File

@ -1,6 +1,7 @@
using Adaptation.Shared;
using Adaptation.Shared.Methods;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Diagnostics;
using System.Reflection;
@ -22,6 +23,13 @@ public class MET08RESISRP2100
_MET08RESISRP2100 = CreateSelfDescription.Staging.v2_49_0.MET08RESISRP2100.EAFLoggingUnitTesting;
}
private static void NonThrowTryCatch()
{
try
{ throw new Exception(); }
catch (Exception) { }
}
#if DEBUG
[Ignore]
#endif
@ -34,12 +42,44 @@ public class MET08RESISRP2100
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewer() => _MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewer();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewer638191594841489860__First()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewer();
string[] variables = _MET08RESISRP2100.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESISRP2100.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__IQSSi() => _MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__IQSSi();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__IQSSi638191594841489860__First()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__IQSSi();
string[] variables = _MET08RESISRP2100.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESISRP2100.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
@ -50,7 +90,7 @@ public class MET08RESISRP2100
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsight638042558563679143__IqsSql()
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsight638191594841489860__First()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
@ -59,6 +99,7 @@ public class MET08RESISRP2100
IFileRead fileRead = _MET08RESISRP2100.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
@ -67,6 +108,22 @@ public class MET08RESISRP2100
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewerAttachments() => _MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewerAttachments();
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewerAttachments638191594841489860__First()
{
string check = "*.pdsf";
MethodBase methodBase = new StackFrame().GetMethod();
_MET08RESISRP2100.Staging__v2_49_0__MET08RESISRP2100__OpenInsightMetrologyViewerAttachments();
string[] variables = _MET08RESISRP2100.AdaptationTesting.GetVariables(methodBase, check, validatePDSF: false);
IFileRead fileRead = _MET08RESISRP2100.AdaptationTesting.Get(methodBase, sourceFileLocation: variables[2], sourceFileFilter: variables[3], useCyclicalForDescription: false);
Logistics logistics = new(fileRead);
_ = Shared.AdaptationTesting.ReExtractCompareUpdatePassDirectory(variables, fileRead, logistics);
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif

View File

@ -6,7 +6,6 @@ using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text;
using System.Text.Json;
namespace Adaptation._Tests.Static;
@ -221,20 +220,4 @@ public class JSON : LoggingUnitTesting, IDisposable
NonThrowTryCatch();
}
#if DEBUG
[Ignore]
#endif
[TestMethod]
public void Born()
{
string json = File.ReadAllText("D:/Tmp/Phares/.json");
FileHandlers.csv.CSV csv = JsonSerializer.Deserialize<FileHandlers.csv.CSV>(json);
if (csv is null)
throw new NullReferenceException(nameof(csv));
byte[] bytes = FileHandlers.json.ProcessData.GetImageBytes(new(csv));
// _ = Image.FromStream(new MemoryStream(bytes));
File.WriteAllBytes("D:/Tmp/Phares/.png", bytes);
NonThrowTryCatch();
}
}