Пример #1
0
 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;
 }
Пример #2
0
 public CVariableArray(CVariable Var, uint Index)
 {
     // TODO: Complete member initialization
     this.Variable = Var;
     this.path = Var.path;
     this.Location = Var.Location;
     this.Index = Index;
 }
Пример #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;
        }
Пример #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");
        }
Пример #5
0
 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);
     }
 }
Пример #6
0
 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);
 }
Пример #7
0
 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);
 }
Пример #8
0
        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);
        }
Пример #9
0
 public CTsCbVariable(CTsInstrFactory.CbTarget cbTarget, CVariable variable)
     : base(variable)
 {
     Location = cbTarget.Identifier;
 }
Пример #10
0
 public CTsCbVariable(CVariable var)
     : base(var)
 {
 }
Пример #11
0
 public CTsTtVariable(CVariable var)
     : base(var)
 {
 }