Esempio n. 1
0
 /// <summary>
 /// Set the internal Value from the DDMLValue that was set in the unpack()
 /// </summary>
 private void setPropertyValue()
 {
     tType = typeof(T);
     if (tType == typeof(Boolean))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asBool(), tType));
     }
     else if (tType == typeof(Int32))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asInt(), tType));
     }
     else if (tType == typeof(Single))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asSingle(), tType));
     }
     else if (tType == typeof(double))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asDouble(), tType));
     }
     else if (tType == typeof(String))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asStr(), tType));
     }
     else if (tType == typeof(Boolean[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asBooleanArray(), tType));
     }
     else if (tType == typeof(Int32[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asIntArray(), tType));
     }
     else if (tType == typeof(Single[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asSingleArray(), tType));
     }
     else if (tType == typeof(double[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asDoubleArray(), tType));
     }
     else if (tType == typeof(String[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asStringArray(), tType));
     }
     else if (tType == typeof(DateTime))
     {
         double   JulianDate = DDMLValue.asDouble();             //stored as a double
         DateTime jDate      = DateUtility.JulianDayNumberToDateTime((int)Math.Truncate(JulianDate));
         Value = (T)(Convert.ChangeType(jDate, typeof(T)));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Set the internal Value from the DDMLValue that was set in the unpack()
 /// </summary>
 private void setVariableValue()
 {
     if (tType == typeof(Boolean))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asBool(), typeof(T)));
     }
     else if (tType == typeof(Int32))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asInt(), typeof(T)));
     }
     else if (tType == typeof(Single))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asSingle(), typeof(T)));
     }
     else if (tType == typeof(double))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asDouble(), typeof(T)));
     }
     else if (tType == typeof(String))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asStr(), typeof(T)));
     }
     else if (tType == typeof(Boolean[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asBooleanArray(), typeof(T)));
     }
     else if (tType == typeof(Int32[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asIntArray(), typeof(T)));
     }
     else if (tType == typeof(Single[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asSingleArray(), typeof(T)));
     }
     else if (tType == typeof(double[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asDoubleArray(), typeof(T)));
     }
     else if (tType == typeof(String[]))
     {
         Value = (T)(Convert.ChangeType(DDMLValue.asStringArray(), typeof(T)));
     }
     else if (tType == typeof(DateTime))
     {
         double   JulianDate = DDMLValue.asDouble();             //stored as a double
         DateTime jDate      = TTimeValue.JDToDateTime(JulianDate);
         Value = (T)(Convert.ChangeType(jDate, typeof(T)));
     }
 }