Ejemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        public Ensemble(
            ICommandData commandData
            )
            : base(commandData)
        {
            //
            // NOTE: This is not a strictly vanilla "command", it is a wrapped
            //       ensemble.
            //
            this.Kind |= IdentifierKind.Ensemble;

            //
            // NOTE: Normally, this flags assignment is performed by
            //       _Commands.Core for all commands residing in the core
            //       library; however, this class does not inherit from
            //       _Commands.Core.
            //
            this.Flags |= AttributeOps.GetCommandFlags(GetType().BaseType) |
                          AttributeOps.GetCommandFlags(this);

            //
            // NOTE: Save the command data for later use by the Initialize
            //       method.  There is no ensemble data; therefore, set it
            //       to null.
            //
            this.commandData  = commandData;
            this.ensembleData = null;
        }
Ejemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////

        private void SetupSubCommands(
            ICommandData commandData,
            IEnsembleData ensembleData
            )
        {
            //
            // NOTE: Get the IExecute configured to handle the sub-commands
            //       for this ensemble.
            //
            IExecute execute = this.SubCommandExecute;

            if (execute == null)
            {
                if (ensembleData != null)
                {
                    execute = ensembleData.SubCommandExecute;
                }
                else
                {
                    ISubCommandData subCommandData = null;

                    if (commandData != null)
                    {
                        subCommandData = new SubCommandData(
                            commandData.Name, commandData.Group,
                            commandData.Description, commandData.ClientData,
                            commandData.TypeName, commandData.Flags,
                            SubCommandFlags.None, this, commandData.Token);
                    }

                    execute = new SubCommand(subCommandData, this.Plugin);
                }

                //
                // NOTE: Set the IExecute that we either obtained from the
                //       passed IEnsembleData -OR- the one that we created
                //       ourselves.
                //
                this.SubCommandExecute = execute;
            }

            EnsembleDictionary subCommands = this.SubCommands;

            if (subCommands == null)
            {
                subCommands = new EnsembleDictionary();

                subCommands["about"]    = execute as ISubCommand;
                subCommands["isolated"] = execute as ISubCommand;
                subCommands["options"]  = execute as ISubCommand;

                this.SubCommands = subCommands;
            }
        }
Ejemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////

        public Ensemble(
            ICommandData commandData,
            IEnsembleData ensembleData
            )
            : this(commandData)
        {
            //
            // NOTE: Save the command and ensemble data for later use by the
            //       Initialize method.
            //
            this.commandData  = commandData;
            this.ensembleData = ensembleData;
        }