SelfHost conditional compile

This commit is contained in:
2023-06-27 11:13:29 -07:00
parent 97d1a1c6a7
commit cae44abfee
4 changed files with 16 additions and 8 deletions

View File

@ -312,15 +312,18 @@ public class Job
{
string text;
int? rds = null;
FileInfo fileInfo;
long sequence = 0;
string psn = string.Empty;
List<string> files = new();
string[] segments = input.MID.Split('.');
string layer = segments[1];
string zone = segments.Length <= 2 ? string.Empty : segments[2];
int? reactor = !int.TryParse(segments[0], out int reactorNumber) ? null : reactorNumber;
bool parsed = !string.IsNullOrEmpty(input.Sequence) && long.TryParse(input.Sequence, out sequence);
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
throw new Exception($"Unable to access file-share <{barcodeHostFileShare}>");
if (!string.IsNullOrEmpty(input.MID))
if (parsed && !string.IsNullOrEmpty(input.MID))
{
string[] checkDirectories = GetDirectories(barcodeHostFileShare);
foreach (string checkDirectory in checkDirectories)
@ -332,6 +335,9 @@ public class Job
}
foreach (string file in files.OrderByDescending(l => new FileInfo(l).LastWriteTime))
{
fileInfo = new FileInfo(file);
if (fileInfo.LastWriteTime.Ticks > sequence)
continue;
text = File.ReadAllText(file);
rds = !int.TryParse(segments[0], out int rdsNumber) ? null : rdsNumber;
break;