Removed Infineon.Mesa.gpcl6 and added Includes
Bug in yml dotnet tool PackageReference arrangement RDS Blank Change int dotnet test nuget ^ [spcepiworld].[dbo].[evnt_inf] Assembly Version WS Result bug fix and Nuget bump, PSN, Reactor and Extra RDS rule OpenInsightApi and testRunTitle editorconfig bugs Fix Type serializerValue RDS oversight PropertyNameCaseInsensitive Save check for file already present NoWaitDirectory MoveArchive allow empty directory and continueOnError for clean files CreatePointerFile and more on NoWaitDirectory
This commit is contained in:
@ -30,9 +30,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
if (!_IsDuplicator)
|
||||
throw new Exception(cellInstanceConnectionName);
|
||||
_OpenInsightMetrologyViewerAPI = GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "OpenInsight.MetrologyViewerAPI");
|
||||
string barcode = TestMe.GetBarcode("192.168.0.121");
|
||||
if (string.IsNullOrEmpty(barcode))
|
||||
{ }
|
||||
}
|
||||
|
||||
void IFileRead.Move(Tuple<string, Test[], JsonElement[], List<FileInfo>> extractResults, Exception exception)
|
||||
|
@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Adaptation.FileHandlers.OpenInsightMetrologyViewer;
|
||||
|
||||
public class TestMe
|
||||
{
|
||||
|
||||
private static List<string> GetURLCollection(string barcodeServerIP)
|
||||
{
|
||||
List<string> results = new();
|
||||
int weekOfYear;
|
||||
string checkURL;
|
||||
DateTime dateTime;
|
||||
string weekDirectory;
|
||||
string weekOfYearPadded;
|
||||
string lastURL = string.Empty;
|
||||
Calendar calendar = new CultureInfo("en-US").Calendar;
|
||||
for (int i = 1; i < 3; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
dateTime = DateTime.Now;
|
||||
else
|
||||
dateTime = DateTime.Now.AddHours(-4);
|
||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday) - 1;
|
||||
weekOfYearPadded = weekOfYear.ToString("00");
|
||||
weekDirectory = $"{dateTime:yyyy}_Week_{weekOfYearPadded}/{dateTime:yyyy-MM-dd}";
|
||||
checkURL = string.Concat("http://", barcodeServerIP, '/', weekDirectory);
|
||||
if (i == 1 || checkURL != lastURL)
|
||||
{
|
||||
results.Add(string.Concat(checkURL, "/A"));
|
||||
results.Add(string.Concat(checkURL, "/B"));
|
||||
}
|
||||
lastURL = checkURL;
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<string> GetURLPossible(HttpClient httpClient, List<string> urlCollection, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions)
|
||||
{
|
||||
List<string> results = new();
|
||||
string json;
|
||||
NginxFileSystem[] nginxFileSystemCollection;
|
||||
DateTime minimumDateTime = DateTime.Now.AddHours(-4);
|
||||
string nginxFormat = "ddd, dd MMM yyyy HH:mm:ss zzz";
|
||||
foreach (string url in urlCollection)
|
||||
{
|
||||
try
|
||||
{
|
||||
json = httpClient.GetStringAsync(url).Result;
|
||||
nginxFileSystemCollection = JsonSerializer.Deserialize<NginxFileSystem[]>(json, propertyNameCaseInsensitiveJsonSerializerOptions);
|
||||
foreach (NginxFileSystem nginxFileSystem in nginxFileSystemCollection)
|
||||
{
|
||||
if (!DateTime.TryParseExact(nginxFileSystem.MTime.Replace("GMT", "+00:00"), nginxFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime))
|
||||
continue;
|
||||
if (dateTime < minimumDateTime)
|
||||
continue;
|
||||
results.Add(string.Concat(url, '/', nginxFileSystem.Name));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<(string, BarcodeRecord)> GetBarcodePossible(HttpClient httpClient, JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions, List<string> possibleURLCollection)
|
||||
{
|
||||
List<(string, BarcodeRecord)> results = new();
|
||||
string json;
|
||||
BarcodeRecord barcodeRecord;
|
||||
foreach (string possibleURL in possibleURLCollection)
|
||||
{
|
||||
try
|
||||
{
|
||||
json = httpClient.GetStringAsync(possibleURL).Result;
|
||||
barcodeRecord = JsonSerializer.Deserialize<BarcodeRecord>(json, propertyNameCaseInsensitiveJsonSerializerOptions);
|
||||
results.Add(new(possibleURL, barcodeRecord));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static string GetBarcode(string barcodeServerIP)
|
||||
{
|
||||
string result = string.Empty;
|
||||
using HttpClient httpClient = new();
|
||||
List<string> urlCollection = GetURLCollection(barcodeServerIP);
|
||||
JsonSerializerOptions propertyNameCaseInsensitiveJsonSerializerOptions = new() { PropertyNameCaseInsensitive = true };
|
||||
List<string> possibleURLCollection = GetURLPossible(httpClient, urlCollection, propertyNameCaseInsensitiveJsonSerializerOptions);
|
||||
List<(string, BarcodeRecord)> possibleBarcodeCollection = GetBarcodePossible(httpClient, propertyNameCaseInsensitiveJsonSerializerOptions, possibleURLCollection);
|
||||
foreach ((string url, BarcodeRecord barcodeRecord) in possibleBarcodeCollection)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(barcodeRecord.Barcode))
|
||||
continue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -298,7 +298,7 @@ public class WSRequest
|
||||
if (!wsResults.Success)
|
||||
throw new Exception(wsResults.ToString());
|
||||
}
|
||||
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json);
|
||||
WS.Results metrologyWSRequest = JsonSerializer.Deserialize<WS.Results>(json, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
long wsResultsHeaderID = metrologyWSRequest.HeaderID;
|
||||
string[] pclFiles = Directory.GetFiles(matchDirectory, "*.pcl", SearchOption.TopDirectoryOnly);
|
||||
if (pclFiles.Length != 1)
|
||||
|
Reference in New Issue
Block a user