Switch multilevel app settings

Removed gpcl6win64 and LincPDFC just from proj file

Removed package.json to clean out publish directory
This commit is contained in:
2025-03-05 16:50:02 -07:00
parent 84d1b07301
commit 4e6504af7e
19 changed files with 161 additions and 466 deletions

View File

@ -15,7 +15,7 @@ public partial class Worker : BackgroundService
public override Task StopAsync(CancellationToken cancellationToken)
{
if (_AppSettings.Helper == nameof(Helpers.HelperCamstarOracle))
if (_AppSettings.FileWatcherConfiguration.Helper == nameof(Helpers.HelperCamstarOracle))
Helpers.HelperCamstarOracle.Heartbeat(_AppSettings, _HttpClientFactory, _Logger, Infineon.Monitoring.MonA.State.Down, cancellationToken);
return base.StopAsync(cancellationToken);
}
@ -25,7 +25,7 @@ public partial class Worker : BackgroundService
_Logger = logger;
_AppSettings = appSettings;
_HttpClientFactory = httpClientFactory;
logger.LogInformation("{buildNumber}-{gitCommitSeven}", _AppSettings.BuildNumber, _AppSettings.GitCommitSeven);
logger.LogInformation(string.Join(Environment.NewLine, collection));
try
{ logger.LogInformation("<{folder}>", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); }
catch (Exception) { }
@ -35,18 +35,18 @@ public partial class Worker : BackgroundService
private void BodyInner(CancellationToken cancellationToken)
{
_Logger.LogInformation("A) Next execute will be at {date}", DateTime.Now.AddMilliseconds(_AppSettings.MillisecondsDelay).ToString("yyyy-MM-dd hh:mm:ss.fff tt"));
_Logger.LogInformation("A) Next execute will be at {date}", DateTime.Now.AddMilliseconds(_AppSettings.FileWatcherConfiguration.MillisecondsDelay).ToString("yyyy-MM-dd hh:mm:ss.fff tt"));
if (_First is null || _First.Value)
{
_First = false;
if (_AppSettings.Helper == nameof(Helpers.HelperCamstarOracle))
if (_AppSettings.FileWatcherConfiguration.Helper == nameof(Helpers.HelperCamstarOracle))
Helpers.HelperCamstarOracle.Heartbeat(_AppSettings, _HttpClientFactory, _Logger, Infineon.Monitoring.MonA.State.Up, cancellationToken);
}
if (!Directory.Exists(_AppSettings.WatchDirectory))
_ = Directory.CreateDirectory(_AppSettings.WatchDirectory);
if (!Directory.Exists(_AppSettings.FileWatcherConfiguration.WatchDirectory))
_ = Directory.CreateDirectory(_AppSettings.FileWatcherConfiguration.WatchDirectory);
else
{
_ = _AppSettings.Helper switch
_ = _AppSettings.FileWatcherConfiguration.Helper switch
{
nameof(Helpers.HelperNuget) => Helpers.HelperNuget.Sync(_AppSettings, _Logger),
nameof(Helpers.HelperTCP) => Helpers.HelperTCP.ReadWrite(_AppSettings, _Logger),
@ -64,28 +64,28 @@ public partial class Worker : BackgroundService
_ => throw new NotSupportedException()
};
}
_Logger.LogInformation("B) Next execute will be at {date}", DateTime.Now.AddMilliseconds(_AppSettings.MillisecondsDelay).ToString("yyyy-MM-dd hh:mm:ss.fff tt"));
_Logger.LogInformation("B) Next execute will be at {date}", DateTime.Now.AddMilliseconds(_AppSettings.FileWatcherConfiguration.MillisecondsDelay).ToString("yyyy-MM-dd hh:mm:ss.fff tt"));
}
private async Task Body(CancellationToken cancellationToken)
{
if (!_IsWindowsService)
{
_Logger.LogInformation("Set break point and skip to run {_AppSettings.Helper}!", _AppSettings.Helper);
throw new EvaluateException($"Set break point and skip to run {_AppSettings.Helper}!");
_Logger.LogInformation("Set break point and skip to run {_AppSettings.FileWatcherConfiguration.Helper}!", _AppSettings.FileWatcherConfiguration.Helper);
throw new EvaluateException($"Set break point and skip to run {_AppSettings.FileWatcherConfiguration.Helper}!");
}
if (!_IsWindowsService)
{
for (int i = 0; i < int.MaxValue; i++)
{
BodyInner(cancellationToken);
Thread.Sleep(_AppSettings.MillisecondsDelay);
Thread.Sleep(_AppSettings.FileWatcherConfiguration.MillisecondsDelay);
}
}
while (_IsWindowsService && !cancellationToken.IsCancellationRequested)
{
BodyInner(cancellationToken);
await Task.Delay(_AppSettings.MillisecondsDelay, cancellationToken);
await Task.Delay(_AppSettings.FileWatcherConfiguration.MillisecondsDelay, cancellationToken);
}
}