Exemplo n.º 1
0
    static object Execute_OP(ELEMENT e, xmlScriptObj scrObj, STACKVAL stack)
    {
        if (!e.isOP())
        {
            return(null);
        }
        object[] args  = null;
        Type[]   types = null;
        object   o     = null;

        var p0 = Execute(e.GetListElement(0), scrObj, stack);
        var p1 = Execute(e.GetListElement(1), scrObj, stack);

        if (e.GetOP_ARGC() == 2)
        {
            args  = new object[] { p0, p1 };
            types = new Type[] { xmlScriptGetMethod.ObjectGetType(p0), xmlScriptGetMethod.ObjectGetType(p1) };
        }
        else if (e.GetOP_ARGC() == 1)
        {
            args  = new object[] { p0 };
            types = new Type[] { xmlScriptGetMethod.ObjectGetType(p0) };
        }

        o = xmlScriptOP._Execute_OP_INTFLOATDOUBLE(e, e.GetOP_ARGC(), p0, p1, scrObj, stack);
        if (o != null)
        {
            return(o);
        }

        o = xmlScriptOP._Execute_OP_STRING(e, p0, p1, scrObj, stack);
        if (o != null)
        {
            return(o);
        }

        {
            var t = xmlScriptGetMethod.ObjectGetType(p0);                             if (t == null)
            {
                throw new System.Exception(e + " Unexcted Operation, nonetype");
            }
            object[] iparam = new object[] { p0, p1 };
            var      mi     = xmlScriptGetMethod.GetMethod2(t, e.group.ToString(), iparam);
            return(xmlScriptGetMethod.MethodInfoInvoke(mi, null, iparam));
        }

        throw new System.Exception(e + " Unexcted Operation");
    }