Correzioni namespace

This commit is contained in:
Samuele Locatelli
2026-05-20 15:29:48 +02:00
parent 952868e69c
commit bcce68c93e
3 changed files with 59 additions and 1 deletions
+1
View File
@@ -134,6 +134,7 @@
<Compile Include="Iob\Generic.cs" />
<Compile Include="Iob\PingWatchDog.cs" />
<Compile Include="Iob\Services\DataSerializer.cs" />
<Compile Include="Iob\Services\RedisService.cs" />
<Compile Include="Iob\Services\XmlDataSerializer.cs" />
<Compile Include="Iob\Simula.cs" />
<Compile Include="MainForm.cs">
+9 -1
View File
@@ -1,6 +1,7 @@
using EgwProxy.Ftp;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using IOB_WIN_FORM.Iob.Services;
using MapoSDK;
using MathNet.Numerics.Statistics;
using Newtonsoft.Json;
@@ -25,7 +26,6 @@ using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using IOB_WIN_FORM.Iob.Services;
using YamlDotNet.Core.Tokens;
using static IOB_UT_NEXT.BaseAlarmConf;
using static IOB_UT_NEXT.CustomObj;
@@ -60,6 +60,9 @@ namespace IOB_WIN_FORM.Iob
// init oggetto redis...
redisMan = new RedisIobCache(IobConfNew.MapoMes.IpAddr, IobConfNew.General.FilenameIOB, $"{IobConfNew.General.IobType}", IobConfNew.General.MinDeltaSec);
// init RedisService per astrarre le chiamate alla cache
redisService = new RedisService(redisMan, IobConfNew.General.FilenameIOB, IobConfNew.General.IobType);
// init code
SetupQueue();
@@ -9061,6 +9064,11 @@ namespace IOB_WIN_FORM.Iob
return fatto;
}
/// <summary>
/// Oggetto gestione connessioni REDIS
/// </summary>
private RedisService redisService;
private async Task<bool> ExecuteIobCheckWithRetry(int maxRetries)
{
var rand = new Random();
+49
View File
@@ -0,0 +1,49 @@
using System;
using IOB_UT_NEXT;
namespace IOB_WIN_FORM.Iob.Services
{
/// <summary>
/// Servizio applicativo che funge da wrapper semantico per le operazioni Redis.
/// Incapsula la costruzione delle chiavi per proteggere la logica di business dalla struttura fisica delle chiavi.
/// </summary>
public class RedisService
{
private readonly RedisIobCache _redisMan;
private readonly string _filenameIob;
private readonly tipoAdapter _tipo;
public RedisService(RedisIobCache redisMan, string filenameIob, tipoAdapter tipo)
{
_redisMan = redisMan ?? throw new ArgumentNullException(nameof(redisMan));
_filenameIob = filenameIob ?? throw new ArgumentNullException(nameof(filenameIob));
_tipo = tipo;
}
/// <summary>
/// Recupera un valore specifico dal hash dello stato dell'IOB.
/// </summary>
/// <param name="field">Il campo del hash da recuperare.</param>
/// <returns>Il valore come stringa.</returns>
public string GetStatusField(string field)
{
string key = $"IOB:Status:{_filenameIob}";
// Nota: Utilizziamo redHash per generare la chiave base se necessario,
// ma qui puntiamo direttamente alla struttura concordata.
return _redisMan.redGetHashField(key, field);
}
/// <summary>
/// Imposta un valore nel hash dello stato dell'IOB.
/// </summary>
/// <param name="field">Il campo del hash da impostare.</param>
/// <param name="value">Il valore da impostare.</param>
public void SetStatusField(string field, string value)
{
string key = $"IOB:Status:{_filenameIob}";
_redisMan.redSetHashField(key, field, value);
}
// Altri metodi semantici verranno aggiunti man mano che il refactoring procede.
}
}