public static List <OnGoingPower> AddClassPower(string Power)
        {
            List <OnGoingPower> temp = new List <OnGoingPower>();

            ReflectionFoundation.ReflectionFoundation RF = new ReflectionFoundation.ReflectionFoundation();
            if (RF.LoadAssembly("ClassPowers"))
            {
                if (RF.GetType("ClassPowers.GetClassPowers"))
                {
                    if (RF.GetMethod(Power))
                    {
                        int cnt = 0;
                        if (RF.ParamInfoCount() > 0)
                        {
                            foreach (string param_name in RF)
                            {
                                switch (param_name)
                                {
                                    //case "target":
                                    //    args[cnt] = TargetStatBlock;
                                    //    break;
                                    //case "Condition":
                                    //    args[cnt] = Condition;
                                    //    break;
                                }
                                cnt++;
                            }
                        }
                        return((List <OnGoingPower>)RF.Invoke());
                    }
                }
            }
            return(temp);
        }
        public static CreatureTypeFoundation GetRaceDetailClass(string CreatureType)
        {
            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
            TextInfo    textInfo    = cultureInfo.TextInfo;


            ReflectionFoundation.ReflectionFoundation RF = new ReflectionFoundation.ReflectionFoundation();
            if (RF.LoadAssembly("CreatureTypeDetails"))
            {
                CreatureType = textInfo.ToTitleCase(CreatureType);
                CreatureType = CreatureType.Replace(PathfinderConstants.SPACE, string.Empty);
                if (RF.GetType("CreatureTypeDetails." + CreatureType))
                {
                    return((CreatureTypeFoundation)RF.Instance);
                }
            }
            RF.GetType("CreatureTypeDetails.UnknownCreatureType");
            return((CreatureTypeFoundation)RF.Instance);
        }
        public static RaceFoundation GetRaceDetailClass(string Race)
        {
            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
            TextInfo    textInfo    = cultureInfo.TextInfo;


            ReflectionFoundation.ReflectionFoundation RF = new ReflectionFoundation.ReflectionFoundation();
            if (RF.LoadAssembly("RaceDetails"))
            {
                Race = textInfo.ToTitleCase(Race);
                Race = Race.Replace("-", string.Empty);
                Race = Race.Replace(" ", string.Empty);
                Race = Race.Trim();
                if (RF.GetType("RaceDetails." + Race))
                {
                    return((RaceFoundation)RF.Instance);
                }
            }
            return(null);
        }
Exemplo n.º 4
0
        public static void GetClassDetailClass(string ClassName, params string[] Paramaters)
        {
            ReflectionFoundation.ReflectionFoundation RF = new ReflectionFoundation.ReflectionFoundation();
            if (RF.LoadAssembly("ClassDetails"))
            {
                if (RF.GetType("ClassDetails." + ClassName))
                {
                    if (RF.GetMethod(Paramaters[0]))
                    {
                        int cnt = 0;
                        if (RF.ParamInfoCount() > 0)
                        {
                            foreach (string param_name in RF)
                            {
                                switch (param_name)
                                {
                                case "Domains":
                                    RF.AddMethodArg(Paramaters[1], cnt);
                                    break;
                                }
                                cnt++;
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("Class Detail doesn't exist: " + ClassName);
                }
            }
            //Assembly a = null;
            //try
            //{
            //    a = Assembly.Load("ClassDetails");
            //}
            //catch (FileNotFoundException ex)
            //{

            //}

            //Type cond = a.GetType("ClassDetails." + ClassName); //null if not found
            //object obj = Activator.CreateInstance(cond);
            //MethodInfo mi = cond.GetMethod(Paramaters[0]);

            //ParameterInfo[] ParamInfos = mi.GetParameters();
            //object[] args = new object[ParamInfos.Count()];
            //int cnt = 0;
            //foreach (ParameterInfo pi in ParamInfos)
            //{
            //    switch (pi.Name)
            //    {
            //        case "Domains":
            //            args[cnt] = Paramaters[1];
            //            break;
            //    }
            //    cnt++;
            //}
            //if (ParamInfos.Count() > 0)
            //{
            //    mi.Invoke(obj, args);
            //}
            //else
            //{
            //    mi.Invoke(obj, null);
            //}
        }