namespace IOB_UT_NEXT { public class BitConditionCheck { #region Public Constructors /// /// Inizializza un oggetto da usare per testing bit condition /// /// Nome della chiave registrata /// Configurazione nel formato BaseAddr.BitNum=ValOk public BitConditionCheck(string keyName, string rawConf) { Logging.Instance.Info($"Init BitConditionCheck | {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]; int.TryParse(sVal, out valDecoded); ValOk = valDecoded; // 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); BitNum = valDecoded; } } /// /// Inizializza un oggetto fake/empty /// public BitConditionCheck() { Logging.Instance.Info("Init empty BitConditionCheck"); } /// /// Inizializza un oggetto solo per key /// /// Nome della chiave registrata public BitConditionCheck(string keyName) { Logging.Instance.Info($"Init BitConditionCheck | {keyName}"); KeyName = keyName; } #endregion Public Constructors #region Public Properties /// /// Indirizzo base x memoria da testare come bit condition /// public int BaseAddr { get; set; } = 0; /// /// Numero bit da impiegare /// public int BitNum { 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; } = 0; #endregion Public Properties } }