Пример #1
0
        internal static void RegisterCommand(ISynapseCommand iSynapseCommand, bool awaitPluginInitialisation)
        {
            if (awaitPluginInitialisation)
            {
                AwaitingFinalization.Add(iSynapseCommand);
                return;
            }

            var command = GeneratedCommand.FromSynapseCommand(iSynapseCommand);

            foreach (var platform in command.Platforms)
            {
                switch (platform)
                {
                case Platform.ClientConsole:
                    SynapseController.CommandHandlers.ClientCommandHandler.RegisterCommand(command);
                    break;

                case Platform.RemoteAdmin:
                    SynapseController.CommandHandlers.RemoteAdminHandler.RegisterCommand(command);
                    break;

                case Platform.ServerConsole:
                    SynapseController.CommandHandlers.ServerConsoleHandler.RegisterCommand(command);
                    break;
                }
            }
        }
Пример #2
0
        internal static void RegisterCommand(ISynapseCommand iSynapseCommand, bool awaitPluginInitialisation)
        {
            if (awaitPluginInitialisation)
            {
                AwaitingFinalization.Add(iSynapseCommand);
                return;
            }

            RegisterGeneratedCommand(GeneratedCommand.FromSynapseCommand(iSynapseCommand));
        }
Пример #3
0
        public static GeneratedCommand FromSynapseCommand(ISynapseCommand command)
        {
            var type   = command.GetType();
            var cmdInf = type.GetCustomAttribute <CommandInformation>();

            return(new GeneratedCommand
            {
                OnCommand = command.Execute,
                Name = cmdInf.Name,
                Aliases = cmdInf.Aliases,
                Permission = cmdInf.Permission ?? "",
                Usage = cmdInf.Usage,
                Description = cmdInf.Description ?? "",
                Platforms = cmdInf.Platforms ?? new [] { Platform.RemoteAdmin, Platform.ServerConsole }
            });
        }