コード例 #1
0
 internal void Change( ChangeStatus changeAction, Guid pluginId, ConfigUserAction action )
 {
     if( Changed != null )
     {
         LiveUserConfigurationChangedEventArgs e = new LiveUserConfigurationChangedEventArgs( changeAction, pluginId, action );
         Changed( this, e );
     }
 }
コード例 #2
0
 internal void Change(ChangeStatus changeAction, Guid pluginId, ConfigUserAction action)
 {
     if (Changed != null)
     {
         LiveUserConfigurationChangedEventArgs e = new LiveUserConfigurationChangedEventArgs(changeAction, pluginId, action);
         Changed(this, e);
     }
 }
コード例 #3
0
 internal bool CanChange(ChangeStatus changeAction, Guid pluginId, ConfigUserAction action)
 {
     if (Changing != null)
     {
         LiveUserConfigurationChangingEventArgs eCancel = new LiveUserConfigurationChangingEventArgs(changeAction, pluginId, action);
         Changing(this, eCancel);
         return(!eCancel.Cancel);
     }
     return(true);
 }
コード例 #4
0
 internal bool CanChange( ChangeStatus changeAction, Guid pluginId, ConfigUserAction action )
 {
     if( Changing != null )
     {
         LiveUserConfigurationChangingEventArgs eCancel = new LiveUserConfigurationChangingEventArgs( changeAction, pluginId, action );
         Changing( this, eCancel );
         return !eCancel.Cancel;
     }
     return true;
 }
コード例 #5
0
        SolvedConfigStatus SolveStatus(Guid pluginId)
        {
            // Set default status/actions
            ConfigPluginStatus finalStatus = ConfigPluginStatus.Manual;
            ConfigUserAction   userAction  = ConfigUserAction.None;

            if (finalStatus != ConfigPluginStatus.Disabled)
            {
                // Gets the systemStatus, if any.
                ConfigPluginStatus systemStatus = _cfg.GetSystemConfiguration(false).PluginStatusCollection.GetStatus(pluginId, finalStatus);
                // Sets it if more restrictive
                if (systemStatus > finalStatus || systemStatus == ConfigPluginStatus.Disabled)
                {
                    finalStatus = systemStatus;
                }

                if (finalStatus != ConfigPluginStatus.Disabled)
                {
                    // Gets the user status, if any.
                    ConfigPluginStatus userStatus = _cfg.GetUserConfiguration(false).PluginStatusCollection.GetStatus(pluginId, finalStatus);
                    // Sets it if more restrictive.
                    if (userStatus > finalStatus || userStatus == ConfigPluginStatus.Disabled)
                    {
                        finalStatus = userStatus;
                    }

                    if (finalStatus != ConfigPluginStatus.Disabled)
                    {
                        // Gets the UserAction, if any.
                        userAction = _cfg.GetUserConfiguration(false).LiveUserConfiguration.GetAction(pluginId);
                    }
                }
            }
            // Solves UserAction and finalStatus
            SolvedConfigStatus solvedStatus = finalStatus == ConfigPluginStatus.Disabled ? SolvedConfigStatus.Disabled : SolvedConfigStatus.Optional;

            if (userAction == ConfigUserAction.Started || (finalStatus == ConfigPluginStatus.AutomaticStart && userAction != ConfigUserAction.Stopped))
            {
                solvedStatus = SolvedConfigStatus.MustExistAndRun;
            }
            else if (userAction == ConfigUserAction.Stopped)
            {
                solvedStatus = SolvedConfigStatus.Disabled;
            }
            return(solvedStatus);
        }
コード例 #6
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;
        }
コード例 #7
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);
        }
コード例 #8
0
 public LiveUserConfigurationChangedEventArgs(ChangeStatus changeAction, Guid pluginID, ConfigUserAction action)
 {
     ChangeAction = changeAction;
     PluginID     = pluginID;
     Action       = action;
 }
コード例 #9
0
 public LiveUserAction(Guid pluginID, ConfigUserAction action)
 {
     PluginId = pluginID;
     Action   = action;
 }
コード例 #10
0
 public LiveUserConfigurationChangingEventArgs( ChangeStatus changeAction, Guid pluginID, ConfigUserAction action )
 {
     ChangeAction = changeAction;
     PluginID = pluginID;
     Action = action;
 }