public SubCommand( ISubCommandData subCommandData, IPlugin plugin ) : base(subCommandData) { // // NOTE: Save the associated plugin (if any) for later use // by the Execute method. // this.plugin = plugin; // // 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.CommandFlags |= AttributeOps.GetCommandFlags(GetType().BaseType) | AttributeOps.GetCommandFlags(this); // // NOTE: Setup the list of sub-commands that we _directly_ // support in our Execute method. // this.SubCommands = CreateSubCommands(); }
/////////////////////////////////////////////////////////////////////// #region Public Constructors public Command( ISubCommandData subCommandData ) : base(subCommandData) { SetupForSubCommandExecute(this.ClientData); }
public Core( ISubCommandData subCommandData ) : base(subCommandData) { this.CommandFlags |= AttributeOps.GetCommandFlags(GetType().BaseType) | AttributeOps.GetCommandFlags(this); }
/////////////////////////////////////////////////////////////////////// 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; } }
/////////////////////////////////////////////////////////////////////// public _Delegate( ISubCommandData subCommandData, IDelegateData delegateData ) : this(subCommandData) { if (delegateData != null) { this.@delegate = delegateData.Delegate; this.raw = delegateData.Raw; } }
public Example3( ISubCommandData subCommandData ) : base(subCommandData) { // // 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.CommandFlags |= Utility.GetCommandFlags(GetType().BaseType) | Utility.GetCommandFlags(this); // // NOTE: Setup the list of sub-commands that we _directly_ // support in our Execute method. // this.SubCommands = CreateSubCommands(); }
public _Delegate( ISubCommandData subCommandData ) : base(subCommandData) { // // NOTE: This is not a strictly vanilla "sub-command", it is // a wrapped delegate. // this.Kind |= IdentifierKind.Delegate; // // NOTE: Normally, this flags assignment is performed by // _SubCommands.Core for all commands residing in the // core library; however, this class does not inherit // from _SubCommands.Core. // this.CommandFlags |= AttributeOps.GetCommandFlags(GetType().BaseType) | AttributeOps.GetCommandFlags(this); }
public Default( ISubCommandData subCommandData ) { kind = IdentifierKind.SubCommand; // // VIRTUAL: Id of the deepest derived class. // id = AttributeOps.GetObjectId(this); // // VIRTUAL: Group of the deepest derived class. // group = AttributeOps.GetObjectGroup(this); // // NOTE: Is the supplied command data valid? // if (subCommandData != null) { EntityOps.MaybeSetGroup( this, subCommandData.Group); name = subCommandData.Name; description = subCommandData.Description; commandFlags = subCommandData.CommandFlags; subCommandFlags = subCommandData.Flags; command = subCommandData.Command; clientData = subCommandData.ClientData; token = subCommandData.Token; } callback = null; subCommands = null; syntax = null; }