decryptedPassword

This commit is contained in:
Mike Phares 2025-04-29 14:33:00 -07:00
parent 31b5a4925b
commit e50a90f0fc
4 changed files with 21 additions and 15 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.8.2" />
<PackageReference Include="DiscUtils.Iso9660" Version="0.16.13" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.14" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
@ -20,7 +20,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.1" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.7.0" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.14" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.15" />
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.14" />

View File

@ -17,7 +17,7 @@ internal static partial class HelperInfinityQS
}
}
private static void RunMI()
private static void RunMI(string decryptedPassword)
{
#pragma warning disable CA1416
string processName = "iispcmi.exe";
@ -27,7 +27,7 @@ internal static partial class HelperInfinityQS
Domain = "Infineon",
UseShellExecute = false,
UserName = "ecfisysadmin",
PasswordInClearText = "j(1(P%xB=g}3w9db",
PasswordInClearText = decryptedPassword,
WorkingDirectory = "C:/Program Files (x86)/InfinityQS International/ProFicient/Applications"
};
TimeSpan timeSpan = new(DateTime.Now.AddDays(7).Ticks - DateTime.Now.Ticks);
@ -36,10 +36,11 @@ internal static partial class HelperInfinityQS
#pragma warning restore CA1416
}
internal static bool Select(AppSettings appSettings, ILogger<Worker> logger)
internal static bool ProcessStart(AppSettings appSettings, ILogger<Worker> logger)
{
logger.LogInformation(appSettings.FileWatcherConfiguration.Company);
RunMI();
string decrypted = RijndaelEncryption.Decrypt(appSettings.InfinityQSConfiguration.EncryptedPassword, appSettings.FileWatcherConfiguration.Company);
RunMI(decrypted);
return true;
}
}

View File

@ -14,6 +14,7 @@ internal partial class TestCollectionSourceGenerationContext : JsonSerializerCon
public record InfinityQSConfiguration(string ConnectionString,
string DestinationDirectory,
string EncryptedPassword,
long SubGroupTime,
string TestsFile,
Test[] Tests)

View File

@ -1,4 +1,4 @@
using File_Watcher.Models;
using File_Watcher.Models;
using Microsoft.Extensions.Hosting.WindowsServices;
using System.Data;
@ -7,7 +7,7 @@ namespace File_Watcher;
public partial class Worker : BackgroundService
{
private bool? _First;
private int _First;
private readonly bool _IsWindowsService;
private readonly ILogger<Worker> _Logger;
private readonly AppSettings _AppSettings;
@ -22,7 +22,6 @@ public partial class Worker : BackgroundService
try
{ logger.LogInformation("<{folder}>", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); }
catch (Exception) { }
_First = null;
_IsWindowsService = collection.Contains(nameof(WindowsServiceLifetime));
}
@ -35,6 +34,7 @@ public partial class Worker : BackgroundService
protected override async Task ExecuteAsync(CancellationToken cancellationToken) =>
await Body(cancellationToken);
private async Task Body(CancellationToken cancellationToken)
{
if (!_IsWindowsService)
@ -51,18 +51,22 @@ public partial class Worker : BackgroundService
}
}
while (_IsWindowsService && !cancellationToken.IsCancellationRequested)
{
try
{
BodyInner(cancellationToken);
await Task.Delay(_AppSettings.FileWatcherConfiguration.MillisecondsDelay, cancellationToken);
}
catch (Exception ex) { _Logger.LogError(ex, "Unexpected Error!"); }
}
}
private void BodyInner(CancellationToken cancellationToken)
{
_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)
if (_First < 9)
{
_First = false;
_First += 1;
if (_AppSettings.FileWatcherConfiguration.Helper == nameof(Helpers.HelperCamstarOracle))
Helpers.HelperCamstarOracle.Heartbeat(_AppSettings, _HttpClientFactory, _Logger, Infineon.Monitoring.MonA.State.Up, cancellationToken);
}
@ -78,7 +82,7 @@ public partial class Worker : BackgroundService
nameof(Helpers.HelperCompass) => Helpers.HelperCompass.CopyFile(_AppSettings, _Logger),
nameof(Helpers.HelperStratus) => Helpers.HelperStratus.MoveFile(_AppSettings, _Logger),
nameof(Helpers.HelperEAFLog) => Helpers.HelperEAFLog.DeleteFiles(_AppSettings, _Logger),
nameof(Helpers.HelperInfinityQS) => Helpers.HelperInfinityQS.Select(_AppSettings, _Logger),
nameof(Helpers.HelperInfinityQS) => Helpers.HelperInfinityQS.ProcessStart(_AppSettings, _Logger),
nameof(Helpers.HelperEventLog) => Helpers.HelperEventLog.ClearEventLogs(_AppSettings, _Logger),
nameof(Helpers.HelperWaferCounter) => Helpers.HelperWaferCounter.MoveFile(_AppSettings, _Logger),
nameof(Helpers.HelperSerial) => Helpers.HelperSerial.ReadWrite(_AppSettings, _Logger, cancellationToken),