SelfHost conditional compile
This commit is contained in:
parent
97d1a1c6a7
commit
cae44abfee
@ -1,3 +1,4 @@
|
|||||||
|
#if SelfHost
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -60,4 +61,5 @@ public class BarcodeController : System.Web.Http.ApiController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -7,8 +7,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
#if SelfHost
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
using System.Web.Http.SelfHost;
|
using System.Web.Http.SelfHost;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Adaptation.FileHandlers.MoveAllFiles;
|
namespace Adaptation.FileHandlers.MoveAllFiles;
|
||||||
|
|
||||||
@ -18,7 +20,9 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
private long? _TickOffset;
|
private long? _TickOffset;
|
||||||
|
#if SelfHost
|
||||||
private readonly HttpSelfHostServer? _HttpSelfHostServer;
|
private readonly HttpSelfHostServer? _HttpSelfHostServer;
|
||||||
|
#endif
|
||||||
|
|
||||||
public const string BarcodeHostFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\BarcodeHost\API"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "BarcodeHost.FileShare");
|
public const string BarcodeHostFileShare = @"\\messv02ecc1.ec.local\EC_Metrology_Si\BarcodeHost\API"; // GetPropertyValue(cellInstanceConnectionName, modelObjectParameters, "BarcodeHost.FileShare");
|
||||||
|
|
||||||
@ -34,6 +38,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
if (_IsDuplicator)
|
if (_IsDuplicator)
|
||||||
throw new Exception(cellInstanceConnectionName);
|
throw new Exception(cellInstanceConnectionName);
|
||||||
|
#if SelfHost
|
||||||
if (!_IsEAFHosted)
|
if (!_IsEAFHosted)
|
||||||
_HttpSelfHostServer = null;
|
_HttpSelfHostServer = null;
|
||||||
else
|
else
|
||||||
@ -46,6 +51,7 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
_HttpSelfHostServer = new(config);
|
_HttpSelfHostServer = new(config);
|
||||||
_HttpSelfHostServer.OpenAsync().Wait();
|
_HttpSelfHostServer.OpenAsync().Wait();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
@ -312,15 +312,18 @@ public class Job
|
|||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
int? rds = null;
|
int? rds = null;
|
||||||
|
FileInfo fileInfo;
|
||||||
|
long sequence = 0;
|
||||||
string psn = string.Empty;
|
string psn = string.Empty;
|
||||||
List<string> files = new();
|
List<string> files = new();
|
||||||
string[] segments = input.MID.Split('.');
|
string[] segments = input.MID.Split('.');
|
||||||
string layer = segments[1];
|
string layer = segments[1];
|
||||||
string zone = segments.Length <= 2 ? string.Empty : segments[2];
|
string zone = segments.Length <= 2 ? string.Empty : segments[2];
|
||||||
int? reactor = !int.TryParse(segments[0], out int reactorNumber) ? null : reactorNumber;
|
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))
|
if (string.IsNullOrEmpty(barcodeHostFileShare) || !Directory.Exists(barcodeHostFileShare))
|
||||||
throw new Exception($"Unable to access file-share <{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);
|
string[] checkDirectories = GetDirectories(barcodeHostFileShare);
|
||||||
foreach (string checkDirectory in checkDirectories)
|
foreach (string checkDirectory in checkDirectories)
|
||||||
@ -332,6 +335,9 @@ public class Job
|
|||||||
}
|
}
|
||||||
foreach (string file in files.OrderByDescending(l => new FileInfo(l).LastWriteTime))
|
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);
|
text = File.ReadAllText(file);
|
||||||
rds = !int.TryParse(segments[0], out int rdsNumber) ? null : rdsNumber;
|
rds = !int.TryParse(segments[0], out int rdsNumber) ? null : rdsNumber;
|
||||||
break;
|
break;
|
||||||
|
@ -179,12 +179,6 @@
|
|||||||
<PackageReference Include="Infineon.EAF.Runtime">
|
<PackageReference Include="Infineon.EAF.Runtime">
|
||||||
<Version>2.49.2</Version>
|
<Version>2.49.2</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.SelfHost">
|
|
||||||
<Version>5.2.7</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core">
|
|
||||||
<Version>5.2.7</Version>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="System.Text.Json">
|
<PackageReference Include="System.Text.Json">
|
||||||
<Version>6.0.3</Version>
|
<Version>6.0.3</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user