Ejemplo n.º 1
0
        private static int test2(string cm)
        {
            string[] cc = cm.Split('.');
            Type     t;

            t = MReflect.GetClsType(cc[0], cm);
            if (t == null)
            {
                Logging.logger.Error("Get Type failed ");
                return(-1);
            }
            object o = MReflect.GenInstance(t);

            if (o == null)
            {
                Logging.logger.Error("Get Type failed ");
                return(-1);
            }

            MethodInfo m = MReflect.GetMethod(t, "test");

            object[] para = new object[] {};
            int      rlt  = Convert.ToInt32(m.Invoke(o, para));

            return(rlt);
        }
Ejemplo n.º 2
0
        private static int Test1(string ns, string cls, string mn)
        {
            Type t = MReflect.GetClsType(ns, cls);

            object o = MReflect.GenInstance(t);

            MethodInfo m = MReflect.GetMethod(t, mn);

            object[] para = {};
            m.Invoke(o, para);
            return(0);
        }
Ejemplo n.º 3
0
        private int InitClass(ModInfo mod)
        {
            string[] cc = mod.cls.Split('.');
            Type     t;

            t = MReflect.GetClsType(cc[0], mod.cls);
            if (t == null)
            {
                Logging.logger.Error("Get Type failed " + mod.modname + " " + mod.cls);
                return(-1);
            }
            object o = MReflect.GenInstance(t);

            if (o == null)
            {
                Logging.logger.Error("Get Type failed " + mod.modname + " " + mod.cls);
                return(-1);
            }

            object[] para = new object[] { mod };
            //MReflect.RumMethordIgnoreRlt(t, "SetModBaseInfo", o, para);
            MethodInfo m = MReflect.GetMethod(t, "SetModBaseInfo");

            Convert.ToInt32(m.Invoke(o, para));
            //return rlt;

            if (RModuled.ContainsKey(mod.modid))
            {
                Logging.logger.Warn("The class is running " + mod.cls + " " + mod.modname + " " + mod.modid.ToString());
                return(0);
            }
            else
            {
                RunMod rm = new RunMod();
                rm.clsInst = o;
                rm.clsType = t;
                rm.modid   = mod.modid;
                rm.modname = mod.modname;
                RModuled.Add(mod.modid, rm);
            }
            return(0);
        }