97 lines
3.1 KiB
C#
97 lines
3.1 KiB
C#
namespace IOB_UT_NEXT
|
|
{
|
|
public class IntConditionCheck
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Inizializza un oggetto da usare per testing INT condition
|
|
/// </summary>
|
|
/// <param name="keyName">Nome della chiave registrata</param>
|
|
/// <param name="rawConf">Configurazione nel formato BaseAddr|IntIndex=ValOk</param>
|
|
public IntConditionCheck(string keyName, string rawConf)
|
|
{
|
|
Logging.Instance.Info($"Init IntConditionCheck | {keyName} | {rawConf}");
|
|
KeyName = keyName;
|
|
RawVal = rawConf;
|
|
string sVal = "";
|
|
int valDecoded = 0;
|
|
// check preliminare
|
|
if (rawConf.Contains("|") && rawConf.Contains("="))
|
|
{
|
|
// splitto per "="...
|
|
var splitCond = rawConf.Split('=');
|
|
sVal = splitCond[1];
|
|
// i valori INT sono "," separated
|
|
var splitValOk = sVal.Split(',');
|
|
ValOk = new int[splitValOk.Length];
|
|
int i = 0;
|
|
foreach (var item in splitValOk)
|
|
{
|
|
int.TryParse(item, out valDecoded);
|
|
ValOk[i] = valDecoded;
|
|
i++;
|
|
}
|
|
// il restante splitto per "."
|
|
var splitMem = splitCond[0].Split('|');
|
|
// BaseAddr
|
|
sVal = splitMem[0];
|
|
int.TryParse(sVal, out valDecoded);
|
|
BaseAddr = valDecoded;
|
|
// BitNum
|
|
sVal = splitMem[1];
|
|
int.TryParse(sVal, out valDecoded);
|
|
IntIndex = valDecoded;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Inizializza un oggetto fake/empty
|
|
/// </summary>
|
|
public IntConditionCheck()
|
|
{
|
|
Logging.Instance.Info("Init empty IntConditionCheck");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Inizializza un oggetto solo per key
|
|
/// </summary>
|
|
/// <param name="keyName">Nome della chiave registrata</param>
|
|
public IntConditionCheck(string keyName)
|
|
{
|
|
Logging.Instance.Info($"Init IntConditionCheck | {keyName}");
|
|
KeyName = keyName;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Indirizzo base x memoria da testare come iny condition
|
|
/// </summary>
|
|
public int BaseAddr { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Indirizzo base x memoria da testare come int condition (0/1) dell'int[], 2=DWord
|
|
/// </summary>
|
|
public int IntIndex { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Valore chiave
|
|
/// </summary>
|
|
public string KeyName { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Valore raw decodificato
|
|
/// </summary>
|
|
public string RawVal { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Valore target che porta a condizione OK = true
|
|
/// </summary>
|
|
public int[] ValOk { get; set; } = new int[1];
|
|
|
|
#endregion Public Properties
|
|
}
|
|
} |