コード例 #1
0
        /// <summary>
        /// Gets the actions.
        /// </summary>
        /// <returns></returns>
        public static List <IAction> GetActions()
        {
            List <IAction>   actions = GetDefaultActions();
            FederationConfig config  = FederationConfig.GetConfig();

            foreach (ActionConfigAbstract ac in config.Actions.ActionList)
            {
                if (ac is ActionConfigClear)
                {
                    actions.Clear();
                }
                else if (ac is ActionConfigRemove)
                {
                    actions.RemoveAll(delegate(IAction a) { return(a.Name == ac.Name); });
                }
                else if (ac is ActionConfigAdd)
                {
                    //ActionConfigAdd addAction = (ActionConfigAdd)ac;
                    //IAction add = (IAction)Activator.CreateInstance(Type.GetType(addAction.Type));
                    //actions.Add(add);
                    ActionConfigAdd addAction = (ActionConfigAdd)ac;
                    string          type1     = addAction.Type;
                    Type            type2     = Type.GetType(type1);
                    IAction         add       = (IAction)Activator.CreateInstance(type2);
                    actions.Add(add);
                }
            }

            return(actions);
        }
コード例 #2
0
        /// <summary>
        /// Gets the actions.
        /// </summary>
        /// <returns></returns>
        public static List <IAction> GetActions()
        {
            List <IAction>   actions = GetDefaultActions();
            FederationConfig config  = ConfigurationReader.GetConfig <FederationConfig>();

            foreach (ActionConfigAbstract ac in config.Actions.ActionList)
            {
                if (ac is ActionConfigClear)
                {
                    actions.Clear();
                }
                else if (ac is ActionConfigRemove)
                {
                    actions.RemoveAll(delegate(IAction a) { return(a.Name == ac.Name); });
                }
                else if (ac is ActionConfigAdd)
                {
                    ActionConfigAdd addAction = (ActionConfigAdd)ac;
                    IAction         add       = (IAction)Activator.CreateInstance(Type.GetType(addAction.Type));
                    actions.Add(add);
                }
            }

            return(actions);
        }