Beispiel #1
0
 /// <summary>
 /// Transforms a Psimulex type to its closest .NET equivalent.
 /// It is mainly utilized by the SystemCall mechanism.
 /// </summary>
 /// <param name="value"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static object TransformToDotnetType(BaseType value, Type type)
 {
     if (TypeEquals(type, typeof(BaseType)))
     {
         return value;
     }
     else if (type.IsSubclassOf(typeof(BaseType)))
     {
         return value.ConvertTo(GetTypeEnumOfType(type));
     }
     else if (TypeEquals(type, typeof(string)))
     {
         return value.ToString();
     }
     else if (TypeEquals(type, typeof(int)))
     {
         return (int) value.ToInt();
     }
     else if (TypeEquals(type, typeof(long)))
     {
         return value.ToInt();
     }
     else if (TypeEquals(type, typeof(decimal)))
     {
         return value.ToDecimal();
     }
     else if (TypeEquals(type, typeof(float)))
     {
         return value.ToFloat();
     }
     else if (TypeEquals(type, typeof(bool)))
     {
         return value.ToBoolean();
     }
     else if (TypeEquals(type, typeof(char)))
     {
         return value.ToChar();
     }
     else
         return null;
 }
Beispiel #2
0
 public override void Modulo(BaseType value)
 {
     this.value %= value.ToDecimal();
     OnChanged();
 }
Beispiel #3
0
 public override void Assign(BaseType value)
 {
     this.value = value.ToDecimal();
     OnChanged();
 }
Beispiel #4
0
 public override void Power(BaseType value)
 {
     this.value = (long) Math.Pow((double)this.value, (double) value.ToDecimal());
     OnChanged();
 }
Beispiel #5
0
 public override void Divide(BaseType value)
 {
     this.value /= value.ToDecimal();
     OnChanged();
 }
Beispiel #6
0
 public override void Multiply(BaseType value)
 {
     this.value *= value.ToDecimal();
     OnChanged();
 }
Beispiel #7
0
 public override void Subtract(BaseType value)
 {
     this.value -= value.ToDecimal();
     OnChanged();
 }
Beispiel #8
0
 public override bool IsLessThan(BaseType value)
 {
     return this.value < value.ToDecimal();
 }