コード例 #1
0
ファイル: Login.cs プロジェクト: Plugarov/Telerik-Repo
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var username = command.Parameters[0];
            var password = command.Parameters[1];

            return(this.ProcessLogin(username, password));
        }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="HomeController" /> class.
        /// </summary>
        /// <param name="homeHandler">The home handler.</param>
        /// <param name="parser">The context builder.</param>
        /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="homeHandler" /> is null.</exception>
        /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="parser" /> is null.</exception>
        public HomeController(IHomeHandler homeHandler, IRequestParser parser)
        {
            Ensure.Argument.IsNotNull(homeHandler, "homeHandler");
            Ensure.Argument.IsNotNull(parser, "parser");

            _homeHandler = homeHandler;
            _parser      = parser;
        }
コード例 #3
0
 public HomeAutomationCommunication(IRequestParser requestParser, IResponseBuilder responseBuilder, IConnectionHandler connectionHandler, IServiceLocator serviceLocator)
 {
     _requestParser       = requestParser;
     _responseBuilder     = responseBuilder;
     _requestHandlerTypes = GetRequestHandlerTypes();
     _connectionHandler   = connectionHandler;
     _serviceLocator      = serviceLocator;
 }
コード例 #4
0
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var vehicleIndex = int.Parse(command.Parameters[0]) - 1;
            var commentIndex = int.Parse(command.Parameters[1]) - 1;
            var username     = command.Parameters[2];

            return(this.ProcessRemoveComment(vehicleIndex, commentIndex, username));
        }
コード例 #5
0
ファイル: Dispatcher.cs プロジェクト: idukic/MissionControl
        public Dispatcher(IRequestParser parser, IConHostFactory conHostFactory, ILogger <Dispatcher> logger)
        {
            _conHostFactory = Guard.NotNull(conHostFactory, nameof(conHostFactory));
            _parser         = Guard.NotNull(parser, nameof(parser));
            _logger         = Guard.NotNull(logger, nameof(logger));

            _timer = new Timer(OnTimerTick, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10));
        }
コード例 #6
0
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var content      = command.Parameters[0];
            var author       = command.Parameters[1];
            var vehicleIndex = int.Parse(command.Parameters[2]) - 1;

            return(this.ProcessAddComment(content, vehicleIndex, author));
        }
 public ExecutingCommandEndpoint(
     IRequestParser <TDto> requestParser,
     ICommandFactory <TDto, TResponse> todoCommandFactory,
     IResponseInProgressFactory <TResponse> responseInProgressFactory)
 {
     _requestParser             = requestParser;
     _todoCommandFactory        = todoCommandFactory;
     _responseInProgressFactory = responseInProgressFactory;
 }
コード例 #8
0
        public void RequestParser()
        {
            IRequestParser instance = Factory.RequestParser;

            Assert.That(instance, Is.TypeOf <RequestParser>());

            RequestParser requestParser = (RequestParser)instance;

            Assert.That(requestParser.EntityRepository, Is.Not.Null);
        }
コード例 #9
0
ファイル: AddVehicle.cs プロジェクト: Plugarov/Telerik-Repo
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var type            = command.Parameters[0];
            var make            = command.Parameters[1];
            var model           = command.Parameters[2];
            var price           = decimal.Parse(command.Parameters[3]);
            var additionalParam = command.Parameters[4];

            var typeEnum = (VehicleType)Enum.Parse(typeof(VehicleType), type, true);

            return(this.ProcessAddVehicle(typeEnum, make, model, price, additionalParam));
        }
コード例 #10
0
 public HttpPostMiddleware(
     HttpRequestDelegate next,
     IRequestExecutorResolver executorResolver,
     IHttpResultSerializer resultSerializer,
     IRequestParser requestParser,
     NameString schemaName)
 {
     _next             = next;
     _executorResolver = executorResolver;
     _resultSerializer = resultSerializer;
     _requestParser    = requestParser;
     _schemaName       = schemaName;
     executorResolver.RequestExecutorEvicted += EvictRequestExecutor;
 }
コード例 #11
0
        public string ProcessCommand(IRequestParser command)
        {
            if (this.CanHandle(command))
            {
                return(this.ProcessCommandInternal(command));
            }

            if (this.successor != null)
            {
                return(this.successor.ProcessCommand(command));
            }

            return(string.Format(InvalidCommand, command.Name));
        }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The middleware configuration options.</param>
        /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param>
        /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param>
        /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param>
        /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param>
        /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param>
        /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param>
        /// <param name="commandParser">The command parser</param>
        /// <param name="formatUtilities">Contains various format helper methods based on the current configuration.</param>
        public ImageSharpMiddleware(
            RequestDelegate next,
            IOptions <ImageSharpMiddlewareOptions> options,
            ILoggerFactory loggerFactory,
            IRequestParser requestParser,
            IEnumerable <IImageProvider> resolvers,
            IEnumerable <IImageWebProcessor> processors,
            IImageCache cache,
            ICacheHash cacheHash,
            CommandParser commandParser,
            FormatUtilities formatUtilities)
        {
            Guard.NotNull(next, nameof(next));
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(requestParser, nameof(requestParser));
            Guard.NotNull(resolvers, nameof(resolvers));
            Guard.NotNull(processors, nameof(processors));
            Guard.NotNull(cache, nameof(cache));
            Guard.NotNull(cacheHash, nameof(cacheHash));
            Guard.NotNull(commandParser, nameof(commandParser));
            Guard.NotNull(formatUtilities, nameof(formatUtilities));

            this.next          = next;
            this.options       = options.Value;
            this.requestParser = requestParser;
            this.providers     = resolvers as IImageProvider[] ?? resolvers.ToArray();
            this.processors    = processors as IImageWebProcessor[] ?? processors.ToArray();
            this.cache         = cache;
            this.cacheHash     = cacheHash;
            this.commandParser = commandParser;
            this.parserCulture = this.options.UseInvariantParsingCulture
                ? CultureInfo.InvariantCulture
                : CultureInfo.CurrentCulture;

            var commands = new HashSet <string>();

            foreach (IImageWebProcessor processor in this.processors)
            {
                foreach (string command in processor.Commands)
                {
                    commands.Add(command);
                }
            }

            this.knownCommands = commands;

            this.logger          = loggerFactory.CreateLogger <ImageSharpMiddleware>();
            this.formatUtilities = formatUtilities;
        }
コード例 #13
0
        private IList <IRequestParser> ReadCommands()
        {
            var commands = new List <IRequestParser>();

            var currentLine = inputOutputProvider.Read();

            while (!string.IsNullOrEmpty(currentLine))
            {
                IRequestParser currentCommand = this.dealershipFactory.CreateRequestParser(currentLine);
                commands.Add(currentCommand);
                currentLine = inputOutputProvider.Read();
            }

            return(commands);
        }
コード例 #14
0
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var username  = command.Parameters[0];
            var firstName = command.Parameters[1];
            var lastName  = command.Parameters[2];
            var password  = command.Parameters[3];

            var role = Role.Normal;

            if (command.Parameters.Count > 4)
            {
                role = (Role)Enum.Parse(typeof(Role), command.Parameters[4]);
            }

            return(this.ProcessRegisterUser(username, firstName, lastName, password, role));
        }
コード例 #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The middleware configuration options.</param>
        /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param>
        /// <param name="memoryAllocator">An <see cref="MemoryAllocator"/> instance used to allocate arrays transporting encoded image data.</param>
        /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param>
        /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param>
        /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param>
        /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param>
        /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param>
        /// <param name="formatUtilities">Contains various format helper methods based on the current configuration.</param>
        public ImageSharpMiddleware(
            RequestDelegate next,
            IOptions <ImageSharpMiddlewareOptions> options,
            ILoggerFactory loggerFactory,
            MemoryAllocator memoryAllocator,
            IRequestParser requestParser,
            IEnumerable <IImageProvider> resolvers,
            IEnumerable <IImageWebProcessor> processors,
            IImageCache cache,
            ICacheHash cacheHash,
            FormatUtilities formatUtilities)
        {
            Guard.NotNull(next, nameof(next));
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(memoryAllocator, nameof(memoryAllocator));
            Guard.NotNull(requestParser, nameof(requestParser));
            Guard.NotNull(resolvers, nameof(resolvers));
            Guard.NotNull(processors, nameof(processors));
            Guard.NotNull(cache, nameof(cache));
            Guard.NotNull(cacheHash, nameof(cacheHash));
            Guard.NotNull(AsyncLock, nameof(AsyncLock));

            this.next            = next;
            this.options         = options.Value;
            this.memoryAllocator = memoryAllocator;
            this.requestParser   = requestParser;
            this.providers       = resolvers as IImageProvider[] ?? resolvers.ToArray();
            this.processors      = processors as IImageWebProcessor[] ?? processors.ToArray();
            this.cache           = cache;
            this.cacheHash       = cacheHash;

            var commands = new HashSet <string>();

            foreach (IImageWebProcessor processor in this.processors)
            {
                foreach (string command in processor.Commands)
                {
                    commands.Add(command);
                }
            }

            this.knownCommands = commands;

            this.logger          = loggerFactory.CreateLogger <ImageSharpMiddleware>();
            this.formatUtilities = formatUtilities;
        }
コード例 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class.
        /// </summary>
        /// <param name="next">The next middleware in the pipeline.</param>
        /// <param name="options">The middleware configuration options.</param>
        /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param>
        /// <param name="memoryAllocator">An <see cref="MemoryAllocator"/> instance used to allocate arrays transporting encoded image data.</param>
        /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param>
        /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param>
        /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param>
        /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param>
        /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param>
        /// <param name="asyncKeyLock">An <see cref="IAsyncKeyLock"/> instance used for providing locking during processing.</param>
        public ImageSharpMiddleware(
            RequestDelegate next,
            IOptions <ImageSharpMiddlewareOptions> options,
            ILoggerFactory loggerFactory,
            MemoryAllocator memoryAllocator,
            IRequestParser requestParser,
            IEnumerable <IImageProvider> resolvers,
            IEnumerable <IImageWebProcessor> processors,
            IImageCache cache,
            ICacheHash cacheHash,
            IAsyncKeyLock asyncKeyLock)
        {
            Guard.NotNull(next, nameof(next));
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(loggerFactory, nameof(loggerFactory));
            Guard.NotNull(memoryAllocator, nameof(memoryAllocator));
            Guard.NotNull(requestParser, nameof(requestParser));
            Guard.NotNull(resolvers, nameof(resolvers));
            Guard.NotNull(processors, nameof(processors));
            Guard.NotNull(cache, nameof(cache));
            Guard.NotNull(cache, nameof(cacheHash));
            Guard.NotNull(asyncKeyLock, nameof(asyncKeyLock));

            this.next            = next;
            this.options         = options.Value;
            this.memoryAllocator = memoryAllocator;
            this.requestParser   = requestParser;
            this.resolvers       = resolvers;
            this.processors      = processors;
            this.cache           = cache;
            this.cacheHash       = cacheHash;
            this.asyncKeyLock    = asyncKeyLock;

            var commands = new List <string>();

            foreach (IImageWebProcessor processor in this.processors)
            {
                commands.AddRange(processor.Commands);
            }

            this.knownCommands = commands;

            this.logger = loggerFactory.CreateLogger <ImageSharpMiddleware>();
        }
コード例 #17
0
        public ResponseProvider(IRequestParser requestParser,
                                IHttpResponseFactory responseFactory,
                                IHandler headHandler)
        {
            if (requestParser == null)
            {
                throw new ArgumentNullException(nameof(requestParser));
            }

            if (responseFactory == null)
            {
                throw new ArgumentNullException(nameof(responseFactory));
            }

            if (headHandler == null)
            {
                throw new ArgumentNullException(nameof(headHandler));
            }

            this._requestParser   = requestParser;
            this._responseFactory = responseFactory;
            this._headHandler     = headHandler;
        }
 /// <summary>Constructor</summary>
 /// <param name="secretStore">Vault Secret Store</param>
 /// <param name="contextParser">Owin Context Parser</param>
 public VaultBasicAuthenticationSecretParser(IVaultSecretStore secretStore, IRequestParser contextParser)
 {
     this.secretStore   = secretStore.ThrowIfNull(nameof(secretStore));
     this.contextParser = contextParser.ThrowIfNull(nameof(contextParser));
 }
コード例 #19
0
 public override string ProcessCommandInternal(IRequestParser command)
 {
     this.userProvider.LoggedUser = null;
     this.userProvider.Users      = new List <IUser>();
     return("Reset compleate.");
 }
コード例 #20
0
 public override bool CanHandle(IRequestParser command)
 {
     return(command.Name.Equals("Reset"));
 }
コード例 #21
0
 public override string ProcessCommandInternal(IRequestParser command)
 {
     return(this.ProcessLogout());
 }
コード例 #22
0
 // Dependency Inversion and Liskov Substitution Principles
 public ResponseProvider(
     IRequestParser requestParser, IRequestProccessor requestProccessor)
 {
     this.requestParser = requestParser;
     this.requestProccessor = requestProccessor;
 }
コード例 #23
0
 public override string ProcessCommandInternal(IRequestParser command)
 {
     return(this.ProcessShowAllUsers());
 }
コード例 #24
0
ファイル: AddVehicle.cs プロジェクト: Plugarov/Telerik-Repo
 public override bool CanHandle(IRequestParser command)
 {
     return(command.Name.Equals("AddVehicle"));
 }
コード例 #25
0
ファイル: ShowVehicles.cs プロジェクト: Plugarov/Telerik-Repo
        public override string ProcessCommandInternal(IRequestParser command)
        {
            var username = command.Parameters[0];

            return(this.ShowUserVehicles(username));
        }
コード例 #26
0
 public ResponseProvider(IHandler handler, IHttpResponseFactory responseFactory, IRequestParser requestParser)
 {
     this.httpResponseFactory = responseFactory;
     this.handler             = handler;
     this.requestParser       = requestParser;
 }
コード例 #27
0
 public DefaultStyxEngine(IHandshakeNegotiator handshakeNegotiator, ILogger logger, IRequestParser requestParser)
 {
     _handshakeNegotiator = handshakeNegotiator;
     _logger = logger;
     _requestParser = requestParser;
 }
コード例 #28
0
 public ClientRequestProcessor(ICommandLocator commandLocator, IRequestParser requestParser)
 {
     _commandLocator = commandLocator;
     _requestParser = requestParser;
 }
コード例 #29
0
 public MailGunWebhooksController(IRequestParser requestParser)
 {
     _requestParser = requestParser;
 }
コード例 #30
0
 public abstract string ProcessCommandInternal(IRequestParser command);
コード例 #31
0
 public abstract bool CanHandle(IRequestParser command);
コード例 #32
0
 // Dependency Inversion and Liskov Substitution Principles
 public ResponseProvider(
     IRequestParser requestParser, IRequestProccessor requestProccessor)
 {
     this.requestParser     = requestParser;
     this.requestProccessor = requestProccessor;
 }
コード例 #33
0
 public ClientRequestProcessor(ICommandLocator commandLocator, IRequestParser requestParser)
 {
     _commandLocator = commandLocator;
     _requestParser  = requestParser;
 }