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

@ -1,3 +1,4 @@
#if SelfHost
using System;
using System.Globalization;
using System.IO;
@ -60,4 +61,5 @@ public class BarcodeController : System.Web.Http.ApiController
}
}
}
}
#endif

View File

@ -7,8 +7,10 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
#if SelfHost
using System.Web.Http;
using System.Web.Http.SelfHost;
#endif
namespace Adaptation.FileHandlers.MoveAllFiles;
@ -18,7 +20,9 @@ public class FileRead : Shared.FileRead, IFileRead
#nullable enable
private long? _TickOffset;
#if SelfHost
private readonly HttpSelfHostServer? _HttpSelfHostServer;
#endif
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);
if (_IsDuplicator)
throw new Exception(cellInstanceConnectionName);
#if SelfHost
if (!_IsEAFHosted)
_HttpSelfHostServer = null;
else
@ -46,6 +51,7 @@ public class FileRead : Shared.FileRead, IFileRead
_HttpSelfHostServer = new(config);
_HttpSelfHostServer.OpenAsync().Wait();
}
#endif
}
#nullable disable