示例#1
0
        /// <summary>
        /// Sets the <see cref="ConfigUserAction"/> for the specified <see cref="IPluginLoaderInfo"/>
        /// </summary>
        /// <param name="pluginId">PluginId of the plugin</param>
        /// <param name="actionType">Action of the Use</param>
        /// <returns>The setted LiveUserAction of the plugin set as parameter</returns>
        public ILiveUserAction SetAction(Guid pluginId, ConfigUserAction actionType)
        {
            LiveUserAction action;

            if (!_actions.TryGetValue(pluginId, out action) && CanChange(ChangeStatus.Add, pluginId, actionType))
            {
                action = new LiveUserAction(pluginId, actionType);
                _actions.Add(pluginId, action);

                Change(ChangeStatus.Add, pluginId, actionType);
            }
            else if (CanChange(ChangeStatus.Update, pluginId, actionType))
            {
                action.Action = actionType;
                Change(ChangeStatus.Update, pluginId, actionType);
            }
            return(action);
        }
示例#2
0
        /// <summary>
        /// Gets the <see cref="ConfigUserAction"/> for the specified PluginId
        /// </summary>
        /// <param name="pluginId">ID of the plugin</param>
        /// <returns>The UserAction for the specified PluginId</returns>
        public ConfigUserAction GetAction(Guid pluginId)
        {
            LiveUserAction action = _actions.GetValueWithDefault <Guid, LiveUserAction>(pluginId, null);

            return(action != null ? action.Action : ConfigUserAction.None);
        }