Example #1
0
 public DataHolder(ICommandInfoProvider provider)
 {
     Data = provider
            .ListAll()
            .Where(c => c.Hide != true)
            .ToDictionary(c => c.CommandlinefuId, c => c).ToImmutableDictionary();
 }
Example #2
0
        public TaggerController(
            ICommandInfoProvider commandInfoProvider,
            IDocumentsDataService service,
            IDocumentFactory documentFactory,
            IDocumentPostReadNormalizer documentReadNormalizer,
            IDocumentPreWriteNormalizer documentWriteNormalizer,
            Func <Type, ITaggerCommand> commandFactory,
            IFactory <ICommandSettings> commandSettingsFactory)
        {
            if (commandInfoProvider == null)
            {
                throw new ArgumentNullException(nameof(commandInfoProvider));
            }

            this.service                 = service ?? throw new ArgumentNullException(nameof(service));
            this.documentFactory         = documentFactory ?? throw new ArgumentNullException(nameof(documentFactory));
            this.documentReadNormalizer  = documentReadNormalizer ?? throw new ArgumentNullException(nameof(documentReadNormalizer));
            this.documentWriteNormalizer = documentWriteNormalizer ?? throw new ArgumentNullException(nameof(documentWriteNormalizer));
            this.commandFactory          = commandFactory ?? throw new ArgumentNullException(nameof(commandFactory));
            this.commandSettingsFactory  = commandSettingsFactory ?? throw new ArgumentNullException(nameof(commandSettingsFactory));

            commandInfoProvider.ProcessInformation();

            var commandsInformation = commandInfoProvider.CommandsInformation
                                      .Where(p => p.Key.GetInterfaces()
                                             .Contains(typeof(ISimpleTaggerCommand)));

            this.commandsInformation = new Dictionary <Type, ICommandInfo>();
            foreach (var commandInformation in commandsInformation)
            {
                this.commandsInformation.Add(commandInformation.Key, commandInformation.Value);
            }
        }
Example #3
0
 public ProviderAndCommand(ICommandInfoProvider provider, CommandInfo cmd)
 {
     if (provider == null)
     {
         throw new ArgumentNullException(nameof(provider));
     }
     Provider = provider;
     Command  = cmd;
 }
		public void Add(ICommandInfoProvider provider, object target) {
			foreach (var t in provider.GetCommandShortcuts(target)) {
				List<ProviderAndCommand> list;
				if (!dict.TryGetValue(t.KeyShortcut, out list))
					dict.Add(t.KeyShortcut, list = new List<ProviderAndCommand>());
				list.Add(new ProviderAndCommand(provider, t.CommandInfo));
				if (t.KeyShortcut.HasTwoKeyInputs)
					twoKeyCombos.Add(t.KeyShortcut.KeyInput1);
			}
		}
        public ProgramSettingsBuilder(ILogger logger, string[] args)
        {
            this.logger = logger;

            this.commandInfoProvider = new CommandInfoProvider();
            this.commandInfoProvider.ProcessInformation();

            this.Settings = new ProgramSettings();

            this.ParseFileNames(args);
            this.ParseSingleDashedOptions(args);
            this.ParseDoubleDashedOptions(args);
            this.ParseDirectCommandCalls(args);
        }
Example #6
0
 public void Add(ICommandInfoProvider provider, object target)
 {
     foreach (var t in provider.GetCommandShortcuts(target))
     {
         if (!dict.TryGetValue(t.KeyShortcut, out var list))
         {
             dict.Add(t.KeyShortcut, list = new List <ProviderAndCommand>());
         }
         list.Add(new ProviderAndCommand(provider, t.CommandInfo));
         if (t.KeyShortcut.HasTwoKeyInputs)
         {
             twoKeyCombos.Add(t.KeyShortcut.KeyInput1);
         }
     }
 }
Example #7
0
		public ProviderAndCommand(ICommandInfoProvider provider, CommandInfo cmd) {
			if (provider == null)
				throw new ArgumentNullException(nameof(provider));
			Provider = provider;
			Command = cmd;
		}
Example #8
0
 public ProviderAndCommand(ICommandInfoProvider provider, in CommandInfo cmd)