public CTsTtVariable(CTsInstrFactory.TtTarget ttTarget, CVariable variable)
     : base(variable)
 {
     if (String.Equals(variable.GetType().FullName, typeof(CVariableBool).FullName))
         Value = Convert.ToInt32(Convert.ToBoolean(variable.value)).ToString();
     Location = ttTarget.Identifier;
     Path = ttTarget.prefix + Path;
 }
 public CVariableArray(CVariable Var, uint Index)
 {
     // TODO: Complete member initialization
     this.Variable = Var;
     this.path = Var.path;
     this.Location = Var.Location;
     this.Index = Index;
 }
Exemple #3
0
        private void parseVariable(CVariable var)
        {
            if (String.Equals(var.GetType().FullName, typeof(CVariableDouble).FullName))
                Value = var.value.ToString().Replace(',', '.');
            else
                Value = var.value.ToString();

            Name = var.name;
            Path = var.path.TrimEnd('/');

            Location = var.Location;
        }
Exemple #4
0
        public CTsVariable(CVariable var)
        {
            if (String.Equals(var.GetType().FullName, typeof(CVariableArray).FullName))
            {
                CVariableArray v = (CVariableArray)var;
                parseVariable((CVariable)v.value);
                Index = v.Index;
            }
            else
            {
                parseVariable(var);
            }

            logger.Debug("OK");
        }
 private static CTsVariable translateLocation(CVariable variable)
 {
     if (dictionnary.Contains(variable.Location))
     {
         Target t = (Target)dictionnary[variable.Location];
         if (String.Equals(t.GetType().FullName, typeof(CbTarget).FullName))
         {
             return new CTsCbVariable((CbTarget)t, variable);
         }
         else if (String.Equals(t.GetType().FullName, typeof(TtTarget).FullName))
         {
             return new CTsTtVariable((TtTarget)t, variable);
         }
         else
         {
             throw new FormatException("This type of target is not managed");
         }
     }
     else
     {
         string message = String.Format("Requested Location \"{0}\" is not defined inside configuration file", variable.Location);
         logger.Error(message);
         throw new FormatException(message);
     }
 }
 private void testIfVariableAsReal(CVariable var, double expectedValue)
 {
     Assert.IsNotNull(var);
     Assert.IsInstanceOf<CVariableDouble>(var);
     Assert.IsTrue(var.value is double);
     Assert.AreEqual(var.value, expectedValue);
 }
 private void testIfVariableAsInteger(CVariable var, int expectedValue)
 {
     Assert.IsNotNull(var);
     Assert.IsInstanceOf<CVariableInt>(var);
     Assert.IsTrue(var.value is Int32);
     Assert.AreEqual(var.value, expectedValue);
 }
        private void testIfVariableAsBoolean(CVariable var, bool expectedValue)
        {
            Assert.IsNotNull(var);

            Assert.IsInstanceOf<CVariableBool>(var);
            Assert.IsTrue(var.value is bool);
            Assert.AreEqual(var.value, expectedValue);
        }
 public CTsCbVariable(CTsInstrFactory.CbTarget cbTarget, CVariable variable)
     : base(variable)
 {
     Location = cbTarget.Identifier;
 }
 public CTsCbVariable(CVariable var)
     : base(var)
 {
 }
 public CTsTtVariable(CVariable var)
     : base(var)
 {
 }