Exemplo n.º 1
0
        public static EffectBase[] GetAllEffectInstance()
        {
            Assembly          ass    = Assembly.GetCallingAssembly();
            List <EffectBase> result = new List <EffectBase>();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(EffectBase)))
                {
                    EffectBase buffer = (EffectBase)ass.CreateInstance(i.FullName);
                    result.Add(buffer);
                }
            }
            return(result.ToArray());
        }
Exemplo n.º 2
0
        public static EffectBase GetEffectInstanceByName(SearchTerm searchTerm)
        {
            Assembly ass = Assembly.GetCallingAssembly();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(EffectBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (i.GetCustomAttribute <SearchTerm>() == searchTerm)
                    {
                        EffectBase buffer = (EffectBase)ass.CreateInstance(i.FullName);
                        return(buffer);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        public static EffectBase[] GetEffectArrayInstanceByName(SearchTerm[] searchTerm)
        {
            Assembly          ass    = Assembly.GetCallingAssembly();
            List <EffectBase> result = new List <EffectBase>();

            foreach (var i in ass.GetTypes())
            {
                if (i.IsSubclassOf(typeof(EffectBase)) && i.GetCustomAttribute <SearchTerm>() != null)
                {
                    if (searchTerm.Contains(i.GetCustomAttribute <SearchTerm>()))
                    {
                        EffectBase buffer = (EffectBase)ass.CreateInstance(i.FullName);
                        result.Add(buffer);
                    }
                }
            }
            return(result.ToArray());
        }