namespace IOB_UT_NEXT { public class IntConditionCheck { #region Public Constructors /// /// Inizializza un oggetto da usare per testing INT condition /// /// Nome della chiave registrata /// Configurazione nel formato BaseAddr|IntIndex=ValOk 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; } } /// /// Inizializza un oggetto fake/empty /// public IntConditionCheck() { Logging.Instance.Info("Init empty IntConditionCheck"); } /// /// Inizializza un oggetto solo per key /// /// Nome della chiave registrata public IntConditionCheck(string keyName) { Logging.Instance.Info($"Init IntConditionCheck | {keyName}"); KeyName = keyName; } #endregion Public Constructors #region Public Properties /// /// Indirizzo base x memoria da testare come iny condition /// public int BaseAddr { get; set; } = 0; /// /// Indirizzo base x memoria da testare come int condition (0/1) dell'int[], 2=DWord /// public int IntIndex { get; set; } = 0; /// /// Valore chiave /// public string KeyName { get; set; } = ""; /// /// Valore raw decodificato /// public string RawVal { get; set; } = ""; /// /// Valore target che porta a condizione OK = true /// public int[] ValOk { get; set; } = new int[1]; #endregion Public Properties } }