public static StackItem ToStackItem(this object value, Type type)
        {
            switch (Type.GetTypeCode(type))
            {
            case TypeCode.Boolean:
            case TypeCode.Byte:
            case TypeCode.Char:
            case TypeCode.Int16:
            case TypeCode.Int32:
            case TypeCode.SByte:
            case TypeCode.UInt16:
            case TypeCode.UInt32:
                return(StackItem.FromInt32((int)value));

            case TypeCode.DateTime:
                break;

            case TypeCode.Decimal:
            case TypeCode.Double:
            case TypeCode.Single:
                return(StackItem.FromDouble((double)value));

            case TypeCode.Int64:
            case TypeCode.UInt64:
                return(StackItem.FromInt64((long)value));

            case TypeCode.Empty:
            case TypeCode.Object:
            case TypeCode.String:
                return(StackItem.FromObjectRef(value));

            default:
                throw new NotImplementedException();
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
 private void ImportLoadFloat(double value)
 {
     _interpreter.EvaluationStack.Push(StackItem.FromDouble(value));
 }