public BlankCommand(ILogger <BlankCommand> logger, ICommandHelper commandHelper, string path, long?size)
 {
     this.logger        = logger;
     this.commandHelper = commandHelper;
     this.path          = path;
     this.size          = size;
 }
Пример #2
0
 public TempMvxCommandBase()
 {
     if (!Mvx.TryResolve<ICommandHelper>(out _commandHelper))
     {
         _commandHelper = new TempMvxWeakCommandHelper();
     }
 }
Пример #3
0
 public LinkFromCommand(ICommandArgsParser <LinkFromCommandArgs> commandArgsParser, ILinkRegistryFile linkRegistryFile, IUserInterface ui, ICommandHelper commandHelper)
 {
     _commandArgsParser = commandArgsParser;
     _linkRegistryFile  = linkRegistryFile;
     _ui            = ui;
     _commandHelper = commandHelper;
 }
Пример #4
0
 public InfoCommand(ILogger <InfoCommand> logger, ICommandHelper commandHelper, IEnumerable <IPhysicalDrive> physicalDrives, string path)
 {
     this.logger         = logger;
     this.commandHelper  = commandHelper;
     this.physicalDrives = physicalDrives;
     this.path           = path;
 }
Пример #5
0
        public StartupHandler(IScreens screensInfo, IVirtualDesktopCollection virtualDesktops, IContainerNodeCreater containerNodeCreator, IVirtualDesktopCreater virtualDesktopCreator, IScreenNodeCreater screenNodeCreator, ISignalHandler signal, IKeyHandler keyHandler, ICommandHelper commandHelper, IWindowTracker windowTracker, IPInvokeHandler pinvokeHandler)
        {
            this.screensInfo          = screensInfo;
            this.desktops             = virtualDesktops;
            this.containerNodeCreator = containerNodeCreator;
            this.signal          = signal;
            this.keyHandler      = keyHandler;
            this.commandHelper   = commandHelper;
            this.windowTracker   = windowTracker;
            this.pinvokeHandler  = pinvokeHandler;
            this.HandlesToIgnore = new List <IntPtr>();

            var result = screensInfo.AllScreens.GetOrderRect();

            _screens = result.rect.ToArray();

            for (var i = 0; i < desktops.Count; i++)
            {
                var screensToAdd = _screens.Select((rect, i) => screenNodeCreator.Create("Screen" + i, rect, dir: result.direction)).ToArray();
                desktops[i] = virtualDesktopCreator.Create(i, rect: _screens.TotalRect(), dir: result.direction, childs: screensToAdd);
                desktops[i].Hide();
            }

            desktops.Index = 0;
            desktops.ActiveDesktop.Show();
        }
Пример #6
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="manifest">The manifest for the associated mod.</param>
        /// <param name="modDirectory">The full path to the mod's folder.</param>
        /// <param name="jsonHelper">Encapsulate SMAPI's JSON parsing.</param>
        /// <param name="modRegistry">Metadata about loaded mods.</param>
        /// <param name="commandManager">Manages console commands.</param>
        /// <param name="contentManager">The content manager which loads content assets.</param>
        /// <param name="reflection">Simplifies access to private game code.</param>
        /// <exception cref="ArgumentNullException">An argument is null or empty.</exception>
        /// <exception cref="InvalidOperationException">The <paramref name="modDirectory"/> path does not exist on disk.</exception>
        public ModHelper(IManifest manifest, string modDirectory, JsonHelper jsonHelper, IModRegistry modRegistry, CommandManager commandManager, SContentManager contentManager, IReflectionHelper reflection)
        {
            // validate
            if (string.IsNullOrWhiteSpace(modDirectory))
            {
                throw new ArgumentNullException(nameof(modDirectory));
            }
            if (jsonHelper == null)
            {
                throw new ArgumentNullException(nameof(jsonHelper));
            }
            if (modRegistry == null)
            {
                throw new ArgumentNullException(nameof(modRegistry));
            }
            if (!Directory.Exists(modDirectory))
            {
                throw new InvalidOperationException("The specified mod directory does not exist.");
            }

            // initialise
            this.DirectoryPath   = modDirectory;
            this.JsonHelper      = jsonHelper;
            this.Content         = new ContentHelper(contentManager, modDirectory, manifest.Name);
            this.ModRegistry     = modRegistry;
            this.ConsoleCommands = new CommandHelper(manifest.Name, commandManager);
            this.Reflection      = reflection;
        }
Пример #7
0
 private IKataPracticeMenuItemProvider Create(IKataArchive kataArchive         = null,
                                              ICommandHelper commandHelper     = null,
                                              IEventAggregator eventAggregator = null)
 {
     return(new KataPracticeMenuItemProvider(kataArchive ?? Substitute.For <IKataArchive>(),
                                             commandHelper ?? Substitute.For <ICommandHelper>(),
                                             eventAggregator ?? Substitute.For <IEventAggregator>()));
 }
Пример #8
0
        public CommandValidator(ICommandHelper helper)
        {
            FieldInfo info = helper.GetType()
                             .GetField("CommandManager", BindingFlags.NonPublic | BindingFlags.Instance);

            this.commandHelper    = info?.GetValue(helper);
            this.commandHelperGet = this.commandHelper?.GetType()
                                    .GetMethod("Get", BindingFlags.Public | BindingFlags.Instance);
        }
Пример #9
0
        /*********
        ** Public methods
        *********/

        /// <summary>Construct an instance.</summary>
        /// <param name="monitor">The monitor used for command output.</param>
        /// <param name="commandHelper">The command helper used to register commands.</param>
        public CommandParser(IMonitor monitor, ICommandHelper commandHelper)
        {
            this.monitor       = monitor;
            this.commandHelper = commandHelper;

            foreach (Type commandType in Assembly.GetExecutingAssembly().GetTypes().Where(type => type.IsSubclassOf(typeof(BaseCommand))))
            {
                this.commands.Add(Activator.CreateInstance(commandType, this.monitor) as BaseCommand);
            }
        }
 public ConvertCommand(ILogger <ConvertCommand> logger, ICommandHelper commandHelper,
                       string sourcePath,
                       string destinationPath, long?size = null)
 {
     this.logger          = logger;
     this.commandHelper   = commandHelper;
     this.sourcePath      = sourcePath;
     this.destinationPath = destinationPath;
     this.size            = size;
 }
 public VerifyCommand(ILogger <VerifyCommand> logger, ICommandHelper commandHelper, IEnumerable <IPhysicalDrive> physicalDrives, string sourcePath,
                      string destinationPath, long?size = null)
 {
     this.logger          = logger;
     this.commandHelper   = commandHelper;
     this.physicalDrives  = physicalDrives;
     this.sourcePath      = sourcePath;
     this.destinationPath = destinationPath;
     this.size            = size;
 }
Пример #12
0
 public CommandExecutor(ICommandParser parser, ICommandExecutorOptions executorOptions, IAttributeDecorator attributeDecorator, IValueConverter valueConverter, ICommandHelper commandHelper, ITypeHelper typeHelper, ICommandExecutorImpl impl = null)
 {
     _parser             = parser;
     _options            = executorOptions;
     _attributeDecorator = attributeDecorator;
     _valueConverter     = valueConverter;
     _commandHelper      = commandHelper;
     _typeHelper         = typeHelper;
     _impl = impl ?? this;
 }
Пример #13
0
        internal void SetupCommands(ICommandHelper consoleCommands)
        {
            if (!this.npcAdventureMod.Config.EnableDebug)
            {
                return;
            }

            consoleCommands.Add("npcadventure_eligible", "Make player eligible to recruit a companion (server or singleplayer only)", this.Eligible);
            this.monitor.Log("Registered debug commands", LogLevel.Info);
        }
Пример #14
0
 private GenerateAndLaunchKataCommand Create(KataName kataName                = KataName.Unknown,
                                             IKataArchive kataArchive         = null,
                                             ICommandHelper commandHelper     = null,
                                             IEventAggregator eventAggregator = null)
 {
     return(new GenerateAndLaunchKataCommand(kataName,
                                             kataArchive ?? Substitute.For <IKataArchive>(),
                                             commandHelper ?? Substitute.For <ICommandHelper>(),
                                             eventAggregator ?? Substitute.For <IEventAggregator>()));
 }
Пример #15
0
        public NoteApp(
            INoteService noteService,
            ICommandHelper commandHelper,
            IConsoleProvider console)
        {
            _noteService   = noteService ?? throw new ArgumentNullException(nameof(noteService));
            _commandHelper = commandHelper ?? throw new ArgumentNullException(nameof(commandHelper));
            _console       = console ?? throw new ArgumentNullException(nameof(console));

            _console.SetTitle($"{Constants.ProjectName} {Constants.Version}");
        }
Пример #16
0
        private readonly string _developmentRoomId = string.Empty; // Only for use in debug mode

        public ChatbotService(ICommandHelper commandHelper,
                              ITwitchClientFactory twitchClientFactory,
                              TwitchPubSub pubsub,
                              ITwitchLiveStreamMonitorFactory twitchLiveStreamMonitorFactory,
                              IVipApiClient vipApiClient,
                              IConfigService configService,
                              IStreamStatusApiClient streamStatusApiClient,
                              ISecretService secretService,
                              ILogger <ChatbotService> logger)
        {
            _commandHelper = commandHelper;
            _pubsub        = pubsub;
            _twitchLiveStreamMonitorFactory = twitchLiveStreamMonitorFactory;
            _vipApiClient          = vipApiClient;
            _configService         = configService;
            _streamStatusApiClient = streamStatusApiClient;
            _secretService         = secretService;
            _logger = logger;

            _streamerChannel    = _configService.Get <string>("StreamerChannel");
            _isDevelopmentBuild = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development" ||
                                  Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Local";

            _client = twitchClientFactory.Get();

            _client.OnJoinedChannel         += OnJoinedChannel;
            _client.OnChatCommandReceived   += OnCommandReceived;
            _client.OnCommunitySubscription += OnSubBomb;
            _client.OnBeingHosted           += OnBeingHosted;
            _client.OnRaidNotification      += OnRaidNotification;
            _client.OnDisconnected          += OnDisconnected;
            _client.OnError           += OnError;
            _client.OnConnectionError += OnConnectionError;
            _client.Connect();

            _liveStreamMonitor = _twitchLiveStreamMonitorFactory.Get();

            _liveStreamMonitor.SetChannelsByName(new List <string> {
                _streamerChannel
            });
            _liveStreamMonitor.OnStreamOnline   += OnStreamOnline;
            _liveStreamMonitor.OnStreamOffline  += OnStreamOffline;
            _liveStreamMonitor.OnServiceStarted += OnStreamMonitorStarted;
            //this.liveStreamMonitor.OnStreamUpdate += OnStreamUpdate;

            _liveStreamMonitor.Start();

            _pubsub.OnPubSubServiceConnected += OnPubSubConnected;
            _pubsub.OnBitsReceived           += OnBitsReceived;
            _pubsub.OnListenResponse         += OnListenResponse;
            _pubsub.OnChannelSubscription    += OnSub;

            _pubsub.Connect();
        }
Пример #17
0
 public CommunicationService(IMessageService messageService,
                             IHubContext <ChatHub, IClient> hubContext,
                             ICommandHelper commandHelper,
                             IServiceBroker serviceBroker,
                             IStockService stockService)
 {
     _messageService = messageService;
     _chatHub        = hubContext;
     _commandHelper  = commandHelper;
     _serviceBroker  = serviceBroker;
     _stockService   = stockService;
 }
Пример #18
0
        internal void SetupCommands(ICommandHelper consoleCommands)
        {
            if (!this.npcAdventureMod.Config.EnableDebug)
            {
                return;
            }

            consoleCommands.Add("npcadventure_eligible", "Make player eligible to recruit a companion (server or singleplayer only)", this.Eligible);
            consoleCommands.Add("npcadventure_recruit", "Recruit an NPC as companion (server or singleplayer only)", this.Recruit);
            consoleCommands.Add("npcadventure_patches", "List harmony patches applied by NPC Adventures\n\nUsage: npcadventure_patches [recheck]\n\n- recheck - Recheck conflictiong patches", this.GetPatches);
            consoleCommands.Add("npcadventure_debug", "Set a debug flag\n\nUsage: npcadventure_debug set|unset|list <flagName>", this.SetDebugFlag);
            this.monitor.Log("Registered debug commands", LogLevel.Info);
        }
        protected async Task <byte[]> ReadMediaBytes(ICommandHelper commandHelper, string path, long size)
        {
            var mediaResult = commandHelper.GetReadableMedia(Enumerable.Empty <IPhysicalDrive>(), path, false);

            using var media        = mediaResult.Value;
            await using var stream = media.Stream;
            var bytes     = new byte[size];
            var bytesRead = await stream.ReadAsync(bytes, 0, bytes.Length);

            Assert.Equal(size, bytesRead);

            return(bytes);
        }
        /// <summary>
        /// Registers all commands found in the system.
        /// </summary>
        /// <param name="helper">The SMAPI Command helper.</param>
        /// <param name="testCommands">Whether or not you wish to only register testing commands.</param>
        public static void RegisterCommands(ICommandHelper helper, bool testCommands)
        {
            var concreteCommands = AppDomain.CurrentDomain.GetNonSystemAssemblies().SelectMany(x => x.GetTypesSafely())
                                   .Where(x => x.IsSubclassOf(typeof(SkillPrestigeCommand)) && !x.IsAbstract);

            foreach (var commandType in concreteCommands)
            {
                var command = (SkillPrestigeCommand)Activator.CreateInstance(commandType);
                if (!(testCommands ^ command.TestingCommand))
                {
                    command.RegisterCommand(helper);
                }
            }
        }
Пример #21
0
 public WimEngine(
     ICommandHelper commandHelper,
     IWimCommandReader commandReader,
     IWimCommandProcessor commandProcessor,
     IWimProcessSingleCommander processSingleCommander,
     IWimReportsPrinter reportsPrinter,
     IConsoleWriter consoleWriter)
 {
     this.commandHelper    = commandHelper;
     this.commandReader    = commandReader;
     this.commandProcessor = commandProcessor;
     this.reportsPrinter   = reportsPrinter;
     this.consoleWriter    = consoleWriter;
 }
Пример #22
0
 public RestoreCommand(
     ICommandArgsParser <RestoreCommandArgs> restoreCommandArgsParser,
     INetFxCsproj netFxCsproj,
     IUserInterface ui,
     IFilesystem filesystem,
     ICommandHelper commandHelper
     )
 {
     _restoreCommandArgsParser = restoreCommandArgsParser;
     _netFxCsproj   = netFxCsproj;
     _ui            = ui;
     _filesystem    = filesystem;
     _commandHelper = commandHelper;
 }
Пример #23
0
 public LinkToCommand(
     ICommandArgsParser <LinkToCommandArgs> commandArgsParser,
     ILinkRegistryFile linkRegistryFile,
     IFilesystem filesystem,
     INetFxCsproj netFxCsproj,
     IUserInterface ui,
     ICommandHelper commandHelper
     )
 {
     _commandArgsParser = commandArgsParser;
     _linkRegistryFile  = linkRegistryFile;
     _filesystem        = filesystem;
     _netFxCsproj       = netFxCsproj;
     _ui            = ui;
     _commandHelper = commandHelper;
 }
        public NoteConsoleService(
            INoteRepository noteRepository,
            IConsoleProvider console,
            ICommandHelper commandHelper)
        {
            _noteRepository = noteRepository ?? throw new ArgumentNullException(nameof(noteRepository));
            _console        = console ?? throw new ArgumentNullException(nameof(console));
            _commandHelper  = commandHelper ?? throw new ArgumentNullException(nameof(commandHelper));

            _commandsWithDescription = new Dictionary <Command, string>
            {
                { Command.Add, "create new note" },
                { Command.List, "show all created notes" },
                { Command.Edit, "edit note" },
                { Command.Delete, "delete note" },
                { Command.Help, "get help" },
                { Command.Exit, "exit from application" }
            };
        }
 public KataPracticeMenuItemProvider(IKataArchive kataArchive,
                                     ICommandHelper commandHelper,
                                     IEventAggregator eventAggregator)
 {
     if (kataArchive == null)
     {
         throw new ArgumentNullException(nameof(kataArchive));
     }
     if (commandHelper == null)
     {
         throw new ArgumentNullException(nameof(commandHelper));
     }
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     _kataArchive     = kataArchive;
     _commandHelper   = commandHelper;
     _eventAggregator = eventAggregator;
 }
Пример #26
0
 public GenerateAndLaunchKataCommand(KataName kata,
                                     IKataArchive kataArchive,
                                     ICommandHelper commandHelper,
                                     IEventAggregator eventAggregator)
 {
     if (kataArchive == null)
     {
         throw new ArgumentNullException(nameof(kataArchive));
     }
     if (commandHelper == null)
     {
         throw new ArgumentNullException(nameof(commandHelper));
     }
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     _kata            = kata;
     _kataArchive     = kataArchive;
     _commandHelper   = commandHelper;
     _eventAggregator = eventAggregator;
 }
Пример #27
0
 public HelpCommand(ICommandHelper commandHelper, IBotManager bot)
 {
     _commandHelper = commandHelper;
     _bot = bot;
 }
Пример #28
0
 public ListCommand(IBotManager bot, IDatabaseService db, ICommandHelper commandHelper)
 {
     _bot = bot;
     _db = db;
     _commandHelper = commandHelper;
 }
Пример #29
0
 public AliasCommand(IDatabaseService databaseService, IBotManager botManager, ICommandHelper commandHelper)
 {
     _db = databaseService;
     _bot = botManager;
     _commandHelper = commandHelper;
 }
Пример #30
0
 /// <summary>Adds this command to SMAPI.</summary>
 public override void Register(ICommandHelper helper)
 {
     helper.Add("listen", "Toggles displaying console output in the in game chat box.", this.Handle);
 }
Пример #31
0
 public ListCommand(ILogger <ListCommand> logger, ICommandHelper commandHelper, IEnumerable <IPhysicalDrive> physicalDrives)
 {
     this.logger         = logger;
     this.commandHelper  = commandHelper;
     this.physicalDrives = physicalDrives;
 }
 /// <summary>
 ///     Adds this command to SMAPI.
 /// </summary>
 public override void Register(ICommandHelper helper)
 {
     helper.Add("w", "Send a message to only one player. Only works from the chat box.\n"
                + "Usage: /w <name> <message>",
                (name, args) => this.Monitor.Log("This command only works from the chat box.", LogLevel.Error));
 }
Пример #33
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="modID">The mod's unique ID.</param>
        /// <param name="modDirectory">The full path to the mod's folder.</param>
        /// <param name="jsonHelper">Encapsulate SMAPI's JSON parsing.</param>
        /// <param name="inputState">Manages the game's input state.</param>
        /// <param name="events">Manages access to events raised by SMAPI.</param>
        /// <param name="contentHelper">An API for loading content assets.</param>
        /// <param name="contentPackHelper">An API for managing content packs.</param>
        /// <param name="commandHelper">An API for managing console commands.</param>
        /// <param name="dataHelper">An API for reading and writing persistent mod data.</param>
        /// <param name="modRegistry">an API for fetching metadata about loaded mods.</param>
        /// <param name="reflectionHelper">An API for accessing private game code.</param>
        /// <param name="multiplayer">Provides multiplayer utilities.</param>
        /// <param name="translationHelper">An API for reading translations stored in the mod's <c>i18n</c> folder.</param>
        /// <exception cref="ArgumentNullException">An argument is null or empty.</exception>
        /// <exception cref="InvalidOperationException">The <paramref name="modDirectory"/> path does not exist on disk.</exception>
        public ModHelper(string modID, string modDirectory, JsonHelper jsonHelper, SInputState inputState, IModEvents events, IContentHelper contentHelper, IContentPackHelper contentPackHelper, ICommandHelper commandHelper, IDataHelper dataHelper, IModRegistry modRegistry, IReflectionHelper reflectionHelper, IMultiplayerHelper multiplayer, ITranslationHelper translationHelper)
            : base(modID)
        {
            // validate directory
            if (string.IsNullOrWhiteSpace(modDirectory))
            {
                throw new ArgumentNullException(nameof(modDirectory));
            }
            if (!Directory.Exists(modDirectory))
            {
                throw new InvalidOperationException("The specified mod directory does not exist.");
            }

            // initialise
            this.DirectoryPath   = modDirectory;
            this.Content         = contentHelper ?? throw new ArgumentNullException(nameof(contentHelper));
            this.ContentPacks    = contentPackHelper ?? throw new ArgumentNullException(nameof(contentPackHelper));
            this.Data            = dataHelper ?? throw new ArgumentNullException(nameof(dataHelper));
            this.Input           = new InputHelper(modID, inputState);
            this.ModRegistry     = modRegistry ?? throw new ArgumentNullException(nameof(modRegistry));
            this.ConsoleCommands = commandHelper ?? throw new ArgumentNullException(nameof(commandHelper));
            this.Reflection      = reflectionHelper ?? throw new ArgumentNullException(nameof(reflectionHelper));
            this.Multiplayer     = multiplayer ?? throw new ArgumentNullException(nameof(multiplayer));
            this.Translation     = translationHelper ?? throw new ArgumentNullException(nameof(translationHelper));
            this.Events          = events;
#if !SMAPI_3_0_STRICT
            this.JsonHelper = jsonHelper ?? throw new ArgumentNullException(nameof(jsonHelper));
#endif
        }
Пример #34
0
 protected override void CreateHook(IApplication application, ICommandHelper commandHelper)
 {
     _defaultHook = new HookAgileMap((application as ApplicationAgileMap).MapControl,
                                     application, null, commandHelper);
 }