Files
Mapo-IOB-WIN/IOB-UT-NEXT/Iob/BaseObj.cs
T
2026-05-25 08:09:30 +02:00

868 lines
29 KiB
C#

using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Config.Mem;
using IOB_UT_NEXT.Objects;
using IOB_UT_NEXT.Services.Cache;
using IOB_UT_NEXT.Services.Core;
using IOB_UT_NEXT.Services.Data;
using IOB_UT_NEXT.Services.Files;
using MapoSDK;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text.Json;
using System.Text.Json.Serialization;
using static IOB_UT_NEXT.Config.BaseAlarmConf;
namespace IOB_UT_NEXT.Iob
{
/// <summary>
/// Classe di base per IOB
/// </summary>
public class BaseObj
{
#region Public Fields
/// <summary>
/// valore booleano di check se sia stato AVVIATO l'adapter (Running)
/// </summary>
public bool adpRunning = false;
/// <summary>
/// valore booleano di check se l'adapter STIA SALVANDO
/// </summary>
public bool adpSaving = false;
/// <summary>
/// valore booleano (richiesta di riavvio automatico)
/// </summary>
public bool adpTryRestart;
/// <summary>
/// Livello minimo allarmi da considerare x invio
/// </summary>
public AlarmLevel alarmLevelMin = AlarmLevel.Alarm;
/// <summary>
/// Struttura allarmi mappati
/// </summary>
public List<BaseAlarmConf> alarmMaps = new List<BaseAlarmConf>();
/// <summary>
/// Tipo di allarmi gestiti
/// rif: BaseAlarmConf.AlarmBlockType.[Bitmap/ActiveList]
/// </summary>
public AlarmBlockType alarmType = AlarmBlockType.Bitmap;
/// <summary>
/// Conteggio ATTUALE ore macchina IN LAVORO
/// </summary>
public double contOreMaccLav;
/// <summary>
/// Conteggio ATTUALE ore macchina ON
/// </summary>
public double contOreMaccOn;
/// <summary>
/// contatore x simulazione valori input
/// </summary>
public int countSim = 0;
/// <summary>
/// ODL attualmente sulla macchina
/// </summary>
public Int32 currIdxODL = 0;
/// <summary>
/// Modo corrente (da classe ENUM)
/// </summary>
public CNC_MODE currMode;
/// <summary>
/// ODL corrente caricato sulla macchina (stringa, da chiamata MP/IO)
/// </summary>
public string currODL = "";
/// <summary>
/// Indica se sia richiesto campionamento memoria PERIODICO
/// </summary>
public bool doSampleMemory;
/// <summary>
/// Indica se si debba leggere e fare DUMP delle aree di memoria (1 volta solo all'avvio x debug...)
/// </summary>
public bool doStartMemDump;
/// <summary>
/// Collettore di tutte le variabili scadenza DateTime
/// </summary>
public DateTimeHelper DtHelp = new DateTimeHelper();
/// <summary>
/// Collettore di tutte le Queue gestite
/// </summary>
public QueueHelper QHelp = new QueueHelper();
/// <summary>
/// Abilitazione lettura PrgName
/// </summary>
public bool enablePrgName = true;
/// <summary>
/// Abilitazione invio pezzi "in blocco" per recupero contapezzi
/// </summary>
public bool enableSendPzCountBlock = false;
/// <summary>
/// Determina se sia encessario convertire valori little/big endian (SIEMENS=true, OSAI=FALSE)
/// </summary>
public bool hasBigEndian = false;
/// <summary>
/// Configurazione gerarchica completa (v 4.x.x.x)
/// </summary>
public IobConfTree IOBConfFull;
/// <summary>
/// ULtimo valore inviato (in caso di disconnessione lo reinvia x garantire watchdog...)
/// </summary>
public string lastSignInVal = "";
/// <summary>
/// Massimo numero di px da inviare in blocco
/// </summary>
public int maxSendPzCountBlock = 10;
/// <summary>
/// Struttura memoria PLC x lettura/scrittura da JSON file
/// </summary>
public plcMemMapExt memMap;
/// <summary>
/// Minimo numero di px da inviare in blocco
/// </summary>
public int minSendPzCountBlock = 1;
/// <summary>
/// Variabile booleana che indica se sia necessario fare refresh del contapezzi
/// </summary>
public bool needRefreshPzCount = true;
/// <summary>
/// Determina se utilizzare blocchi di memoria IOT contigui (e quindi processing
/// "monoblocco" semplificato"=
/// </summary>
public bool procIotMem = false;
/// <summary>
/// alias booleano false = R
/// </summary>
public bool R = false;
/// <summary>
/// 32 byte input base (es strobe, 8 word da 32 bit di flags...)
/// </summary>
public byte[] RawInput = new byte[32];
/// <summary>
/// 32 byte output base (es ack, 8 word da 32 bit di flags...)
/// </summary>
public byte[] RawOutput = new byte[32];
/// <summary>
/// Oggetto connessione REDIS
/// </summary>
public RedisIobCache redisMan;
/// <summary>
/// Oggetto cronometro x campionamento durate chiamate
/// </summary>
public Stopwatch sw = new Stopwatch();
/// <summary>
/// Veto (in sec) a nuovi ping (x IOB PING, FTP...)
/// </summary>
public int vetoPingSec = 1;
/// <summary>
/// alias booleano true = W
/// </summary>
public bool W = true;
#endregion Public Fields
#region Public Properties
/// <summary>
/// Verifica se sia in modalità DEMO avanzata (campionamento da set di valori ammessi...)
/// </summary>
public static bool DemoInSample => baseUtils.CRB("DemoInSample");
/// <summary>
/// Verifica se sia in modalità DEMO x dati OUTPUT
/// </summary>
public static bool DemoOut => utils.CRB("DemoOut");
/// <summary>
/// Verifica se sia abilitato test lettura blocchi memoria all'avvio
/// </summary>
public static bool EnableTest => baseUtils.CRB("enableTest");
/// <summary>
/// stato Online/Offline del server MP IO (su REDIS)
/// </summary>
public static bool MPOnline
{
get => utils.MPIO_Online;
set => utils.MPIO_Online = value;
}
#endregion Public Properties
#region Public Methods
/// <summary>
/// processa dataLayer e se necessario salva/mostra
/// </summary>
public static void checkSavePersDataLayer()
{
}
public static string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
{
if (string.IsNullOrEmpty(sMacAddress))// only return MAC Address from first card
{
IPInterfaceProperties properties = adapter.GetIPProperties();
//sMacAddress = adapter.GetPhysicalAddress().ToString();
sMacAddress = string.Join(":", (from z in adapter.GetPhysicalAddress().GetAddressBytes() select z.ToString("X2")).ToArray());
}
}
return sMacAddress;
}
#endregion Public Methods
#region Protected Fields
/// <summary>
/// Variabile numero errori vari (in lettura) --&gt; se supera soglia maxErroriCheck --&gt; disconnette
/// </summary>
protected static int numErroriCheck = 0;
/// <summary>
/// Valore di attesa (random) dopo ogni invio x evitare congestione send...
/// </summary>
protected static int urlRandWait = 0;
/// <summary>
/// Stato connessione con macchina gestita
/// </summary>
protected bool _connOk = false;
/// <summary>
/// valore booleano di check se sia in fase di COMUNICAZIONE ATTIVA con il PLC/NC
/// </summary>
protected bool adpCommAct;
/// <summary>
/// porta x adapter (x restart)
/// </summary>
protected int adpPortNum;
/// <summary>
/// Vettore 32 BIT valori in ingresso al filtro
/// </summary>
protected int B_input;
/// <summary>
/// Vettore 32 BIT valori in uscita dal filtro
/// </summary>
protected int B_output;
/// <summary>
/// Vettore 32 BIT valori precedenti
/// </summary>
protected int B_previous = -1;
/// <summary>
/// Cod grupo IOB x creazione PODL al volo
/// </summary>
protected string CodGruppoIob = "ND-00";
/// <summary>
/// Num errori check alive
/// </summary>
protected int currAliveErrors = 0;
/// <summary>
/// Dizionario valori impostati x produzione
/// </summary>
protected Dictionary<string, string> currProdData = new Dictionary<string, string>();
/// <summary>
/// num corrente errori read PLC
/// </summary>
protected int currReadErrors = 0;
/// <summary>
/// num errori send
/// </summary>
protected int currSendErrors = 0;
/// <summary>
/// Tempo di attesa in minuti x lettura contapezzi standard (da .ini / OptPar)
/// </summary>
protected double delayMinReadPzCount = 0;
/// <summary>
/// Fattore di demoltiplicazione dei DynData x ridurre campionamento
/// </summary>
protected int demFactDynData = 1;
/// <summary>
/// Disabilitazione gestione ODL (lettura e gestione)
/// </summary>
protected bool disableOdl = false;
/// <summary>
/// Boolean x indicare contapezzi disabilitato forzatamente da IOB
/// </summary>
protected bool disablePzCountByIob = false;
/// <summary>
/// Determina se sia prevista gestione PODL (creazione/avvio/chiusura) come Soitaab
/// </summary>
protected bool EnabelPodlManFull = false;
/// <summary>
/// Abilita riscrittura memoria se trova differenze lettura/richiesti
/// </summary>
protected bool ENABLE_MEM_REWRITE = true;
/// <summary>
/// Abilitazione restart (da opt par...)
/// </summary>
protected bool enableCliRestart = false;
/// <summary>
/// Boolean x indicare contapezzi abilitato a livello di conf applicazione
/// </summary>
protected bool enablePzCountByApp = true;
/// <summary>
/// Abilitazione invio dataitem
/// </summary>
protected bool enableSendDataItem = true;
/// <summary>
/// Abilitazione gestione slow data
/// </summary>
protected bool enableSlowData = false;
//protected static Logger lg = LogManager.GetCurrentClassLogger();
/// <summary>
/// Abilitazione invio conf macchine
/// </summary>
protected bool enabSendMachineConf = true;
/// <summary>
/// dizionario (opzionale) xz decodifica file da importare
/// </summary>
protected Dictionary<string, int> FileDecod = new Dictionary<string, int>();
/// <summary>
/// DeadBand x riduzione dati FluxLog (se 0 non gestita)
/// </summary>
protected double fluxLogRedDeadBand = 0;
/// <summary>
/// Determina se sia gestita riduzione dati FluxLog
/// </summary>
protected bool fluxLogReduce = false;
/// <summary>
/// Dizionario dei valori FluxLog ultimi verificati x veto
/// </summary>
protected Dictionary<string, double> fluxLogReduceLast = new Dictionary<string, double>();
/// <summary>
/// Dizionario dei valori FluxLog ultimi tipo STRING verificati x veto
/// </summary>
protected Dictionary<string, string> fluxLogReduceLastString = new Dictionary<string, string>();
/// <summary>
/// Dizionario dei veto send x ogni variabile quando non variata
/// </summary>
protected Dictionary<string, DateTime> fluxLogReduceVeto = new Dictionary<string, DateTime>();
/// <summary>
/// Finestra in minuti x invio dati FluxLog quando invariati
/// </summary>
protected int fluxLogResendPeriod = 60;
/// <summary>
/// indica che è richiesto forzatamente reset contapezzi
/// </summary>
protected bool forcePzReset = false;
/// <summary>
/// DEADBAND globale se impostata (es x gestire variazioni minime valori FluxLog da inviare...)
/// </summary>
protected float GLOBAL_DBAND = 0;
/// <summary>
/// Determina se siano gestite le ricette
/// </summary>
protected bool hasRecipe = false;
/// <summary>
/// Array dei contatori x segnali blinking
/// </summary>
protected int[] i_counters;
/// <summary>
/// Indica impianto IN SETUP (fino a quando SMETTE di esserlo...)
/// </summary>
protected bool inSetup = false;
/// <summary>
/// Dizionario ULTIMI valori impostati x produzione
/// </summary>
protected Dictionary<string, string> lastProdData = new Dictionary<string, string>();
/// <summary>
/// Dizionario ultimi valori (string) delle TSS
/// </summary>
protected Dictionary<string, string> LastTSS = new Dictionary<string, string>();
/// <summary>
/// Dizionario ultimi valori (string) delle TSS
/// </summary>
protected Dictionary<string, DateTime> LastTSSSend = new Dictionary<string, DateTime>();
/// <summary>
/// Dizionario ultimi valori (double) delle TSVC
/// </summary>
protected Dictionary<string, double> LastTSVC = new Dictionary<string, double>();
/// <summary>
/// Separatore linea (tipicamente x commenti)
/// </summary>
protected string lineSep = "--------------------------";
/// <summary>
/// Elenco parametri calcolati da inviare alla macchina (es ricetta con traduzione, RAMA/TFT)
/// </summary>
protected List<objItem> list2Write = new List<objItem>();
/// <summary>
/// Elenco delle eventuali condizioni di veto conditions attive
/// </summary>
protected List<string> ListVetoCond = new List<string>();
/// <summary>
/// Num massimo di errori in funzionalità check alive
/// </summary>
protected int maxAliveErrors = utils.CRI("maxAliveErrors");
/// <summary>
/// Soglia massima errori prima della disconnessione automatica in check
/// </summary>
protected int maxErroriCheck = utils.CRI("maxErroriCheck");
/// <summary>
/// Quantità massima per singola ricetta (per determinare num ricette da inviare)
/// </summary>
protected int maxQtyPerFile = 0;
/// <summary>
/// Dimensione coda di ping x valutazione
/// </summary>
protected int maxQueuePing = 11;
/// <summary>
/// Num massimo di errori di rete read (dal PLC)
/// </summary>
protected int maxReadErrors = utils.CRI("maxReadErrors");
/// <summary>
/// Periodo massimo (in sec) per letture dati in mancanza di eventi di aggiornamento
/// </summary>
protected int MaxSecReload = 120;
/// <summary>
/// Num massimodi errori di rete send al server
/// </summary>
protected int maxSendErrors = utils.CRI("maxSendErrors");
/// <summary>
/// Numero massimo di tentativi x test ping preliminare
/// </summary>
protected int maxTryPing = 1;
protected string mem2trace = "";
/// <summary>
/// Tempo minimo ammissibile di risposta (es x errori ModBus che risponde troppo in fretta) in millisec
/// </summary>
protected int minRespTimeMs = 5;
protected int minVetoSendDataItem = 60;
/// <summary>
/// indica se serva refresh parametri e quindi PLC...
/// </summary>
protected bool needRefresh = true;
/// <summary>
/// Indica se usare la parte numerica di un articolo come codice INT
/// </summary>
protected bool numArtCharTrim = false;
/// <summary>
/// Timeout x ping al server
/// </summary>
protected int pingServerMsTimeout = utils.CRI("PingMsTimeout");
/// <summary>
/// Ritardo minimo x invio contapezzi
/// </summary>
protected int pzCountDelay = 2500;
/// <summary>
/// Indica se resettare allarmi all'avvio e inviare il reset appena parte adapter
/// </summary>
protected bool resetAlarmOnStart = false;
/// <summary>
/// Periodo di campionamento x refresh info
/// </summary>
protected int samplePeriod = 1000;
/// <summary>
/// MsSample Period base x campionamenti tpo OCP-UA
/// </summary>
protected int samplePeriodBase = 600;
/// <summary>
/// Dizionario di VC da trattare come TimeSeries (con conf decodificata + processing successivo...)
/// </summary>
protected Dictionary<string, VCData> TSVC_Data = new Dictionary<string, VCData>();
/// <summary>
/// Indica se usare archivio locale ricette vs scarico http/REST
/// </summary>
protected bool useLocalRecipe = true;
/// <summary>
/// Dizionario di VARIABILI da trattare come eventi (da inviare quando cambiano oppure a
/// scadenza periodo...)
/// </summary>
protected Dictionary<string, EVData> VarArray = new Dictionary<string, EVData>();
/// <summary>
/// Dizionario dei divieti di invio x ogni counter gestito
/// </summary>
protected Dictionary<string, DateTime> VetoCounterSend = new Dictionary<string, DateTime>();
/// <summary>
/// Veto per registrazione completa log di startup (minuti)
/// </summary>
protected int vetoLogStartupDuration = 60;
/// <summary>
/// Durata in secondi del divieto accodamento segnali IN alla fase di startup
/// </summary>
protected int vetoQueueIn = 10;
/// <summary>
/// Periodo di veto prima di invio nuova conferma dei valori write correnti, default ogni 5 min
/// </summary>
protected double vetoSendWriteUpsert = 1;
/// <summary>
/// Periodo wathdog di default (2 sec se non specificato)
/// </summary>
protected int watchDogPeriod = 2;
#endregion Protected Fields
#region Protected Properties
/// <summary>
/// Dizionario condizioni di veto log x ogni tipo di messaggio (periodo differente secondo livello)
/// </summary>
protected Dictionary<string, DateTime> VetoLog { get; set; } = new Dictionary<string, DateTime>();
/// <summary>
/// Dizionario conteggio numero volte che si fa veto log x ogni tipo di messaggio
/// </summary>
protected Dictionary<string, int> VetoLogCount { get; set; } = new Dictionary<string, int>();
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Decodifica file MAP (caso <paramref name="ByteNum" />.bit)
/// </summary>
/// <param name="linea"></param>
/// <param name="separator"></param>
/// <param name="ByteNum">indirizzo Byte: indirizzo di partenza memoria</param>
/// <param name="memSize">dimensione singolo slot in byte</param>
/// <param name="BitNum">indirizzo bit: numero riga x calcolo indice bit</param>
/// <returns></returns>
protected static otherData decodeBitData(string linea, char separator, int ByteNum, int memSize, int BitNum)
{
if (linea != null)
{
string[] valori = linea.Split(separator);
int shift = 0;
try
{
shift = Convert.ToInt32(valori[0]) - 1;
}
catch
{ }
int resto = 0;
Math.DivRem(BitNum, 8, out resto);
string memAddr = string.Format("{0}.{1}", ByteNum + shift * memSize, resto);
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
}
else
{
return null;
}
}
/// <summary>
/// Decodifica file MAP generico
/// </summary>
/// <param name="linea"></param>
/// <param name="separator"></param>
/// <param name="memPre"></param>
/// <param name="baseAddr"></param>
/// <param name="memSize"></param>
/// <returns></returns>
protected static otherData decodeOtherData(string linea, char separator, string memPre, int baseAddr, int memSize)
{
if (linea != null)
{
string[] valori = linea.Split(separator);
int shift = 0;
try
{
shift = Convert.ToInt32(valori[0]) - 1;
}
catch
{ }
string memAddr = string.Format("{0}{1}", memPre, baseAddr + shift * memSize);
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
}
else
{
return null;
}
}
protected static long GetObjectSize(object genObj, bool isSerializable)
{
long result = 0;
if (isSerializable)
{
using (var stream = new MemoryStream())
{
var formatter = new BinaryFormatter();
formatter.Serialize(stream, genObj);
result = stream.Length;
}
}
else
{
string rawVal = System.Text.Json.JsonSerializer.Serialize(genObj, options);
result = rawVal.Length;
}
return result;
}
/// <summary>
/// Verifica se ci sia veto log attivo e gestisce casistiche
/// </summary>
/// <param name="vetoSec"></param>
/// <param name="message"></param>
/// <returns></returns>
protected bool checkLogVeto(int vetoSec, ref string message)
{
// verifico SE si debba fare log, altrimenti metto in coda...
bool doVeto = true;
try
{
DateTime adesso = DateTime.Now;
if (VetoLog.ContainsKey(message))
{
// conteggio num veto a +1...
if (VetoLogCount.ContainsKey(message))
{
VetoLogCount[message]++;
}
else
{
VetoLogCount.Add(message, 1);
}
// controllo scadenza, quando superata soglia aggiorno messaggio con {n} x {messaggio}
if (adesso.Subtract(VetoLog[message]).TotalSeconds > vetoSec)
{
doVeto = false;
string newMessage = $"{VetoLogCount[message]} x {message}";
VetoLog.Remove(message);
VetoLogCount.Remove(message);
message = newMessage;
}
}
else
{
// primo --> loggo
doVeto = false;
VetoLog.Add(message, adesso.AddSeconds(vetoSec));
if (VetoLogCount.ContainsKey(message))
{
VetoLogCount[message]++;
}
else
{
VetoLogCount.Add(message, 0);
}
}
}
catch (Exception exc)
{
lg.Error($"Eccezione in checkLogVeto: reset contatori VetoLog/VetoLogCount | message: {message}");
lg.Error($"Raised Exc:{Environment.NewLine}{exc}");
doVeto = false;
// svuoto tutti i log veto...
VetoLog = new Dictionary<string, DateTime>();
VetoLogCount = new Dictionary<string, int>();
lg.Error($"Effettuato reset contatori VetoLog/VetoLogCount");
}
// restituisco esito!
return doVeto;
}
/// <summary>
/// Recupera la chiave per le statistiche delle chiamate.
/// </summary>
protected string GetCallStatsKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:CallStats");
/// <summary>
/// Recupera la chiave per i dati di produzione correnti.
/// </summary>
protected string GetCurrProdDataKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:CurrProdData");
/// <summary>
/// Recupera la chiave per il flusso di memoria.
/// </summary>
protected string GetFluxMemKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:FluxMem");
/// <summary>
/// Recupera la chiave per l'invio dei PODL.
/// </summary>
protected string GetPOdlSentKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:POdlSent");
/// <summary>
/// Recupera un valore specifico dal hash dello stato dell'IOB.
/// </summary>
protected string GetStatusField(string field)
{
string baseKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}");
return redisMan.redGetHashField(baseKey, field);
}
/// <summary>
/// Recupera la chiave per le statistiche settimanali.
/// </summary>
protected string GetWeekStatsKey() => redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}:WeekStats");
/// <summary>
/// Deserializza una stringa JSON in un oggetto.
/// </summary>
protected T JsonDeserialize<T>(string json) => DataSerializer.Deserialize<T>(json);
/// <summary>
/// Serializza un oggetto in formato JSON.
/// </summary>
protected string JsonSerialize<T>(T obj) => DataSerializer.Serialize(obj);
/// <summary>
/// Serializza un oggetto in formato JSON con opzioni serializzazione.
/// </summary>
protected string JsonSerialize<T>(T obj, Formatting reqFormat) => DataSerializer.Serialize(obj, reqFormat);
/// <summary>
/// Imposta un valore nel hash dello stato dell'IOB.
/// </summary>
protected void SetStatusField(string field, string value)
{
string baseKey = redisMan.redHash($"IOB:Status:{IOBConfFull.General.FilenameIOB}");
redisMan.redSetHashField(baseKey, field, value);
}
/// <summary>
/// Setup di tutti gli oggetti Queue, ma solo alcuni hanno coda REDIS (quelli senza sono "sacrificabili"
/// </summary>
protected void SetupQueue()
{
string codIob = IOBConfFull.General.FilenameIOB;
bool useRedis = IOBConfFull.General.EnabRedisQue;
// valutare se portare di nuovo in redis...
QHelp.QueueIN = new DataQueue(codIob, "QueueIN", useRedis, redisMan);
QHelp.QueueSrvResp = new DataQueue(codIob, "QueueServResp", useRedis, redisMan);
// fix a NON redis
QHelp.QueueAlarm = new DataQueue(codIob, "QueueAlarm", false, redisMan);
QHelp.QueueFLog = new DataQueue(codIob, "QueueFLog", false, redisMan);
QHelp.QueueMessages = new DataQueue(codIob, "QueueMessages", false, redisMan);
QHelp.QueuePing = new DataQueue(codIob, "QueuePing", false, redisMan);
QHelp.QueueRawTransf = new DataQueue(codIob, "QueueRawTransf", false, redisMan);
QHelp.QueueSrvReq = new DataQueue(codIob, "QueueServReq", false, redisMan);
QHelp.QueueULog = new DataQueue(codIob, "QueueULog", false, redisMan);
}
/// <summary>
/// Deserializza una stringa XML in un oggetto.
/// </summary>
protected T XmlDeserialize<T>(string xml) => XmlDataSerializer.Deserialize<T>(xml);
/// <summary>
/// Serializza un oggetto in formato XML.
/// </summary>
protected string XmlSerialize<T>(T obj) => XmlDataSerializer.Serialize(obj);
#endregion Protected Methods
#region Private Fields
/// <summary>
/// wrapper di log
/// </summary>
private static readonly Logger lg = LogManager.GetCurrentClassLogger();
private static readonly JsonSerializerOptions options = new JsonSerializerOptions
{
ReferenceHandler = ReferenceHandler.IgnoreCycles,
WriteIndented = false // Optional: set to true for pretty-printing
};
#endregion Private Fields
}
}