public void Build(IComponentProvider builder)
 {
     builder.BindMocksForMainPresenter();
     builder.BindMocksForRgbPresenter();
     builder.BindMocksForConvolutionPresenter();
     builder.BindMocksForDistributionPresenter();
 }
        public void Register(IComponentProvider provider, ExportScope scope, ProcessExitBehaviour onExit)
        {
            if (scope == ExportScope.Process)
            {
                /** register locally **/
                Register(provider);
            }
            else if (scope == ExportScope.Parent)
            {
                parent.Register(provider);
            }
            else if (scope == ExportScope.Machine)
            {
                if (machineDirectory != null)
                {
                    machineDirectory.Register(provider);
                }
                else
                {
                    throw new NotSupportedException("Component directory does not support machine scope registration");
                }
            }

            throw new NotSupportedException("Component directory does not support cluster scope registration");
        }
 public void Register(IComponentProvider provider)
 {
     // Console.ForegroundColor = ConsoleColor.Green;
     // Console.Out.WriteLine("--- ICD.Register: {0}", provider.MatchedName);
     // Console.Out.WriteLine("    ByName? {0}, ByType? {1}", provider.MatchAgainstNameAllowed, provider.MatchAgainstTypeAllowed);
     // Console.Out.WriteLine("    Types:\n      {0}\n", String.Join("\n      ", provider.MatchedTypes));
     // Console.ResetColor();
     if (provider.MatchAgainstNameAllowed)
     {
         if (!name2Component.ContainsKey(provider.MatchedName))
         {
             name2Component[provider.MatchedName] = new List <IComponentProvider>();
         }
         name2Component[provider.MatchedName].Add(provider);
     }
     if (provider.MatchAgainstTypeAllowed)
     {
         foreach (string type in provider.MatchedTypes)
         {
             if (!type2Component.ContainsKey(type))
             {
                 type2Component[type] = new List <IComponentProvider>();
             }
             type2Component[type].Add(provider);
         }
     }
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="LogWriter"/>
 public HttpServer(ILogWriter logWriter)
 {
     Check.Require(logWriter, "logWriter");
     _components = new ComponentProvider();
     _components.AddInstance <ILogWriter>(logWriter);
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }
示例#5
0
        private static IDictionary <string, Route> RegisterApi <T>(IComponentProvider container, ControllerInfo <T> description) where T : IController
        {
            var    handler                     = new UrsaHandler <T>(container.Resolve <IRequestHandler <RequestInfo, ResponseInfo> >());
            string globalRoutePrefix           = (description.EntryPoint != null ? description.EntryPoint.Url.ToString().Substring(1) + "/" : String.Empty);
            IDictionary <string, Route> routes = new Dictionary <string, Route>();

            routes[typeof(T).FullName + "DocumentationStylesheet"] = new Route(globalRoutePrefix + EntityConverter.DocumentationStylesheet, handler);
            routes[typeof(T).FullName + "PropertyIcon"]            = new Route(globalRoutePrefix + EntityConverter.PropertyIcon, handler);
            routes[typeof(T).FullName + "MethodIcon"] = new Route(globalRoutePrefix + EntityConverter.MethodIcon, handler);
            routes[typeof(T).FullName] = new Route(description.Url.ToString().Substring(1), handler);
            if (!String.IsNullOrEmpty(globalRoutePrefix))
            {
                routes[globalRoutePrefix] = new Route(globalRoutePrefix, handler);
            }

            foreach (var operation in description.Operations)
            {
                string routeTemplate = (operation.UrlTemplate ?? operation.Url.ToString()).Substring(1).Replace("{?", "{");
                int    indexOf       = routeTemplate.IndexOf('?');
                if (indexOf != -1)
                {
                    routeTemplate = routeTemplate.Substring(0, indexOf);
                }

                if (routes.All(route => String.Compare(route.Value.Url, routeTemplate, true) != 0))
                {
                    routes[typeof(T).FullName + "." + operation.UnderlyingMethod.Name] = new Route(routeTemplate, handler);
                }
            }

            return(routes);
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
 /// <seealso cref="IFormDecoder"/>
 /// <seealso cref="FormDecoderProviders"/>
 public HttpServer(FormDecoderProvider decoderProvider)
 {
     Check.Require(decoderProvider, "decoderProvider");
     _components = new ComponentProvider();
     _components.AddInstance <FormDecoderProvider>(decoderProvider);
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }
示例#7
0
 private static void RegisterEntryPointControllerDescriptionBuilder(this IComponentProvider container, Url entryPoint)
 {
     container.Register <IHttpControllerDescriptionBuilder, EntryPointControllerDescriptionBuilder>(
         entryPoint.ToString().Substring(1),
         () => new EntryPointControllerDescriptionBuilder(entryPoint, container.Resolve <IDefaultValueRelationSelector>()),
         Lifestyles.Singleton);
 }
示例#8
0
 public ContentTypeCreator(IPropertyDefinitionCreator propertyDefinitionCreator, ICoreInterfaceProvider coreInterfaceProvider, IPropertyMappingProvider propertyMappingRepository, IComponentProvider componentProvider)
 {
     PropertyDefinitionCreator = propertyDefinitionCreator;
     CoreInterfaceProvider     = coreInterfaceProvider;
     PropertyMappingRepository = propertyMappingRepository;
     ComponentProvider         = componentProvider;
 }
            public TypeParserInfo CreateParser(IComponentProvider provider, string uniqueName)
            {
                var parser = _solution.CreateParser(Layout, provider, uniqueName);

                _host._parsers.Add(parser);
                return(parser);
            }
示例#10
0
        public void Build(IComponentProvider builder)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            new Startup().Build(builder);

            builder
            .RegisterSingletonView <IMainView, MainForm>()
            .RegisterSingletonView <ISettingsView, SettingsForm>()
            .RegisterSingletonView <IQualityMeasureView, QualityMeasureForm>()
            .RegisterTransientView <IHistogramView, HistogramForm>()
            .RegisterTransientView <IConvolutionView, ConvolutionForm>()
            .RegisterTransientView <IRgbView, RgbForm>()
            .RegisterTransientView <IDistributionView, DistributionForm>()
            .RegisterTransientView <IColorMatrixView, ColorMatrixForm>()
            .RegisterTransientView <ITransformationView, TransformationForm>()
            .RegisterTransient <IRgbFormEventBinder, RgbFormEventBinder>()
            .RegisterTransient <IColorMatrixEventBinder, ColorMatrixEventBinder>()
            .RegisterTransient <IConvolutionFormEventBinder, ConvolutionFormEventBinder>()
            .RegisterTransient <IDistributionFormEventBinder, DistributionFormEventBinder>()
            .RegisterTransient <ISettingsFormEventBinder, SettingsFormEventBinder>()
            .RegisterTransient <ITransformationFormEventBinder, TransformationFormEventBinder>()
            .RegisterTransient <IMainFormEventBinder, MainFormEventBinder>()
            .RegisterTransient <IMainFormContainerFactory, MainFormContainerFactory>()
            .RegisterTransient <IMainFormUndoRedoFactory, MainFormUndoRedoFactory>()
            .RegisterTransient <IMainFormZoomFactory, MainFormZoomFactory>()
            .RegisterTransient <IMainFormRotationFactory, MainFormRotationFactory>();
        }
示例#11
0
        private SmartResolver CreateResolver(IComponentProvider provider)
        {
            var config = new ResolverConfig()
                         .UseAutoBinding()
                         .UseArrayBinding()
                         .UseAssignableBinding()
                         .UsePropertyInjector()
                         .UsePageContextScope();

            config.UseXamarinFormsComponents(adapter =>
            {
                adapter.AddDialogs();
                adapter.AddPopupNavigator();
                adapter.AddJsonSerializer();
                adapter.AddSettings();

                // Custom
                adapter.UsePopupPageFactory <PopupPageFactory>();
            });

            config.BindSingleton <INavigator>(_ => navigator);

            config.BindSingleton <ApplicationState>();

            config.BindSingleton <Configuration>();
            config.BindSingleton <Session>();

            config.BindSingleton <IAttachableBarcodeReader, AttachableEntryBarcodeReader>();

            provider.RegisterComponents(config);

            return(config.ToResolver());
        }
示例#12
0
        public App(IComponentProvider provider)
        {
            InitializeComponent();

            // Config Resolver
            resolver = CreateResolver(provider);
            ResolveProvider.Default.UseSmartResolver(resolver);

            // Config Navigator
            navigator = new NavigatorConfig()
                        .UseFormsNavigationProvider()
                        .AddPlugin <NavigationFocusPlugin>()
                        .UseResolver(resolver)
                        .UseIdViewMapper(m => m.AutoRegister(Assembly.GetExecutingAssembly().ExportedTypes))
                        .ToNavigator();
            navigator.Navigated += (_, args) =>
            {
                // for debug
                System.Diagnostics.Debug.WriteLine(
                    $"Navigated: [{args.Context.FromId}]->[{args.Context.ToId}] : stacked=[{navigator.StackedCount}]");
            };

            // Popup Navigator
            var popupNavigator = resolver.Get <IPopupNavigator>();

            popupNavigator.AutoRegister(Assembly.GetExecutingAssembly().ExportedTypes);

            // Show MainWindow
            MainPage = resolver.Get <MainPage>();
        }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
 /// <seealso cref="IHttpSessionStore"/>
 public HttpServer(IHttpSessionStore sessionStore)
 {
     Check.Require(sessionStore, "sessionStore");
     _components = new ComponentProvider();
     _components.AddInstance <IHttpSessionStore>(sessionStore);
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }
示例#14
0
        /// <summary>Registers automatically discovered <see cref="IController" /> implementations.</summary>
        /// <param name="container">The container.</param>
        /// <param name="controllerDetailsAction">The controller details action.</param>
        /// <returns>The <paramref name="container" /> itself.</returns>
        public static IComponentProvider WithAutodiscoveredControllers(this IComponentProvider container, Action <Type, ControllerInfo> controllerDetailsAction = null)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            var assemblies = UrsaConfigurationSection.GetInstallerAssemblies();

            container.RegisterAll <IController>(assemblies);
            var controllers = container.ResolveAllTypes <IController>();

            container.RegisterControllerRelatedTypes(controllers);
            var registeredEntryPoints = new List <string>();

            foreach (var controller in controllers.Where(controller => !controller.IsDescriptionController()))
            {
                var descriptionBuilder = (IHttpControllerDescriptionBuilder)container.Resolve(typeof(IHttpControllerDescriptionBuilder <>).MakeGenericType(controller));
                var description        = descriptionBuilder.BuildDescriptor();
                if ((description.EntryPoint != null) && (!registeredEntryPoints.Contains(description.EntryPoint.ToString())))
                {
                    container.RegisterEntryPointControllerDescriptionBuilder(description.EntryPoint.Url);
                    registeredEntryPoints.Add(description.EntryPoint.ToString());
                }

                if (controllerDetailsAction != null)
                {
                    controllerDetailsAction(controller, description);
                }
            }

            return(container);
        }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="IFormDecoder"/>
 /// <seealso cref="FormDecoderProviders"/>
 /// <seealso cref="LogWriter"/>
 public HttpServer(FormDecoderProvider decoderProvider, ILogWriter logWriter)
 {
     Check.Require(decoderProvider, "decoderProvider");
     Check.Require(logWriter, "logWriter");
     _components = new ComponentFactory();
     _components.AddInstance <FormDecoderProvider>(decoderProvider);
 }
        public void Bind(IComponentProvider provider)
        {
            Debug.Log($"Provider of type {provider.GetType().Name} binded");

            var keyType = provider.GetType();

            _bindings[keyType] = provider;
        }
示例#17
0
 public void Build(IComponentProvider builder)
 {
     builder
     .RegisterSingleton <IMainView, MainWindow>()
     .RegisterTransient <ITransientFormView, TransientWindow>()
     .RegisterSingleton <ISingletonFormView, SingletonWindow>()
     .RegisterTransient <IMainWindowEventBinder, MainWindowEventBinder>();
 }
 /// <summary>
 /// Construct a <see cref="PayloadsController"/>
 /// </summary>
 /// <param name="gitHubConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="gitHubConfiguration"/></param>
 /// <param name="logger">The value of <see cref="logger"/></param>
 /// <param name="componentProvider">The value of <see cref="componentProvider"/></param>
 /// <param name="autoMergeHandler">The value of <see cref="autoMergeHandler"/></param>
 /// <param name="backgroundJobClient">The value of <see cref="backgroundJobClient"/></param>
 public PayloadsController(IOptions <GitHubConfiguration> gitHubConfigurationOptions, ILogger <PayloadsController> logger, IComponentProvider componentProvider, IAutoMergeHandler autoMergeHandler, IBackgroundJobClient backgroundJobClient)
 {
     gitHubConfiguration      = gitHubConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(gitHubConfigurationOptions));
     this.logger              = logger ?? throw new ArgumentNullException(nameof(logger));
     this.componentProvider   = componentProvider ?? throw new ArgumentNullException(nameof(componentProvider));
     this.autoMergeHandler    = autoMergeHandler ?? throw new ArgumentNullException(nameof(autoMergeHandler));
     this.backgroundJobClient = backgroundJobClient ?? throw new ArgumentNullException(nameof(backgroundJobClient));
 }
示例#19
0
        public void Add(IComponentProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }

            m_providers.Add(provider);
        }
        public DefaultControllerActivator(IComponentProvider container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            _container = container;
        }
示例#21
0
 /// <summary>
 /// Construct a <see cref="PullRequestController"/>
 /// </summary>
 /// <param name="gitHubManager">The value of <see cref="gitHubManager"/></param>
 /// <param name="stringLocalizer">The value of <see cref="stringLocalizer"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="generalConfiguration"/></param>
 /// <param name="githubConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="generalConfiguration"/></param>
 /// <param name="moduleManager">The value of <see cref="moduleManager"/></param>
 /// <param name="componentProvider">The value of <see cref="componentProvider"/></param>
 public PullRequestController(IGitHubManager gitHubManager, IStringLocalizer <PullRequestController> stringLocalizer, IOptions <GeneralConfiguration> generalConfigurationOptions, IOptions <GitHubConfiguration> githubConfigurationOptions, IModuleManager moduleManager, IComponentProvider componentProvider)
 {
     this.gitHubManager     = gitHubManager ?? throw new ArgumentNullException(nameof(gitHubManager));
     this.stringLocalizer   = stringLocalizer ?? throw new ArgumentNullException(nameof(stringLocalizer));
     this.moduleManager     = moduleManager ?? throw new ArgumentNullException(nameof(moduleManager));
     this.componentProvider = componentProvider ?? throw new ArgumentNullException(nameof(componentProvider));
     generalConfiguration   = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     gitHubConfiguration    = githubConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(githubConfigurationOptions));
 }
示例#22
0
        public DefaultControllerActivator(IComponentProvider container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            _container = container;
        }
示例#23
0
 /// <summary>
 /// Construct an <see cref="AutoMergeHandler"/>
 /// </summary>
 /// <param name="_componentProvider">The value of <see cref="componentProvider"/></param>
 /// <param name="_gitHubManager">The valuse of <see cref="gitHubManager"/></param>
 /// <param name="_logger">The value of <see cref="logger"/></param>
 /// <param name="_repository">The value of <see cref="repository"/></param>
 /// <param name="_stringLocalizer">The value of <see cref="stringLocalizer"/></param>
 /// <param name="_backgroundJobClient">The value of <see cref="backgroundJobClient"/></param>
 public AutoMergeHandler(IComponentProvider _componentProvider, IGitHubManager _gitHubManager, ILogger <AutoMergeHandler> _logger, IRepository _repository, IStringLocalizer <AutoMergeHandler> _stringLocalizer, IBackgroundJobClient _backgroundJobClient)
 {
     componentProvider   = _componentProvider ?? throw new ArgumentNullException(nameof(_componentProvider));
     gitHubManager       = _gitHubManager ?? throw new ArgumentNullException(nameof(_gitHubManager));
     logger              = _logger ?? throw new ArgumentNullException(nameof(_logger));
     repository          = _repository ?? throw new ArgumentNullException(nameof(_repository));
     stringLocalizer     = _stringLocalizer ?? throw new ArgumentNullException(nameof(_stringLocalizer));
     backgroundJobClient = _backgroundJobClient ?? throw new ArgumentNullException(nameof(_backgroundJobClient));
 }
示例#24
0
        /// <summary>
        /// Sets up the bridge in the new appdomain
        /// </summary>
        /// <param name="parentDirectory">Parent component directory</param>
        /// <param name="app">Application descriptor</param>
        /// <param name="guid">Application instance GUID</param>
        /// <param name="appInstance">Self application instance to link into the directory</param>
        internal void Setup(IComponentDirectory parentDirectory, ApplicationDesc app, Guid guid, IApplicationInstance appInstance, IAssemblyLoader xassemblyLoader)
        {
            assemblyLoader = xassemblyLoader;

            string iname = app.Name + " " + guid;

            // Console.Out.WriteLine("Creating process: {0}", iname);
            AppDomain.CurrentDomain.TypeResolve     += new ResolveEventHandler(CurrentDomain_TypeResolve);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

            this.directory = new ComponentDirectory(parentDirectory, iname);
            this.directory.Register(
                new Instance(
                    this.directory.GetInstance <DatabaseManager>().Find("/")));

            IComponentProvider appProvider = null;

            /** register self as process **/
            this.directory.Register(
                new Instance(appInstance, "Self"));

            /*******************************************************************************************
            * TODO: SECURITY: this is where we would re-register views of already registered (kernel)
            * providers to shadow the originals
            *******************************************************************************************/

            foreach (IComponentProvider provider in app.Components)
            {
                this.directory.Register(provider);

                if (provider.MatchedName == app.ApplicationComponent)
                {
                    appProvider = provider;
                }
            }

            if (appProvider == null)
            {
                throw new Exception(
                          String.Format(
                              "The application {0} cannot be set up because the application component was not found",
                              app.Name));
            }

            this.appInstance = this.directory.GetInstance(appProvider.MatchedName) as IApplicationBase;

            if (app == null)
            {
                throw new Exception(
                          String.Format(
                              "The application {0} cannot be set up because the application component cannot be instantiated",
                              app.Name));
            }

            /* a-ok */
        }
示例#25
0
        protected ServiceContextBase(IComponentProvider componentProvider, IServiceHost[] serviceHost)
        {
            this.componentProvider = componentProvider ?? ComponentProvider.Default;
            this.ServiceHosts      = new ServiceHostCollection(serviceHost);
            this.isServer          = IsServer(this);
            this.instanceBuilder   = ServiceInstanceBuilder.Create();
            this.instanceContext   = new InstanceContext(this);

            this.ValidateExceptionDescriptors();
        }
示例#26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="LogWriter"/>
 public HttpServer(ILogWriter logWriter)
 {
     _components = new ComponentProvider();
     if (_logWriter != null)
     {
         _components.AddInstance <ILogWriter>(logWriter);
         _logWriter = logWriter;
     }
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }
示例#27
0
        /// <summary>
        /// Initializes a NameOverride provider
        /// </summary>
        /// <param name="provider">A provider to override the name for</param>
        /// <param name="nameOverride">New name to override the provider name to</param>
        public NameOverride(IComponentProvider provider, string nameOverride)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this.provider     = provider;
            this.nameOverride = nameOverride;
        }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
 /// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="IFormDecoder"/>
 /// <seealso cref="FormDecoderProviders"/>
 /// <seealso cref="LogWriter"/>
 /// <seealso cref="IHttpSessionStore"/>
 public HttpServer(FormDecoderProvider decoderProvider, IHttpSessionStore sessionStore, ILogWriter logWriter)
 {
     Check.Require(decoderProvider, "decoderProvider");
     Check.Require(sessionStore, "sessionStore");
     _components = new ComponentFactory();
     _components.AddInstance <FormDecoderProvider>(sessionStore);
     _components.AddInstance <IHttpSessionStore>(sessionStore);
     if (logWriter != null)
     {
         _components.AddInstance <ILogWriter>(logWriter);
     }
 }
示例#29
0
        public void Build(IComponentProvider builder)
        {
            builder.RegisterSingleton <IEventAggregatorWrapper, EventAggregatorWrapper>();


            var controller = builder.Resolve <IAppController>();
            var aggregator = builder.Resolve <IEventAggregatorWrapper>();

            controller.GetType()
            .GetProperty(nameof(controller.Aggregator))
            .SetValue(controller, aggregator);
        }
示例#30
0
        private IReadOnlyList <MethodSignature> GetMethodSignatures(IComponentProvider provider)
        {
            var boolSymbol = _symbols.GetSymbol <bool>();
            var intSymbol  = _symbols.GetSymbol <int>();
            var memberType = _member.ReturnType !.Symbol;

            // Incoming Data type
            var discovery  = new MethodArg(RefKind.In, provider.DiscoveryType, "parent");
            var sourceType = new MethodArg(RefKind.In, _member.ContainingFullType.Symbol, "source");

            // Buffers
            var readOnlySpan = new MethodArg(_symbols.GetSymbol(typeof(ReadOnlySpan <byte>)), "readOnlySpan");
            var span         = new MethodArg(_symbols.GetSymbol(typeof(Span <byte>)), "span");
            var cursor       = new MethodArg(RefKind.Ref, _symbols.GetSymbol(typeof(SequenceCursor <byte>)), "cursor");

            // Return Data
            var readBytes    = new MethodArg(RefKind.Out, intSymbol, "readBytes");
            var writtenBytes = new MethodArg(RefKind.Out, intSymbol, "writtenBytes");
            var result       = new MethodArg(RefKind.Out, memberType, "result");

            return(new MethodSignature[] {
                MethodSignatureBuilder.CreateConstructor(_typeName, (provider.DiscoveryType, "parser")),
                MethodSignatureBuilder.CreateConstructor(_typeName, (provider.DiscoveryType, "parser"), (RefKind.Out, boolSymbol, "isSuccess")),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.TryDeserializeState(0))
                .AddArgument(discovery, readOnlySpan, readBytes, result)
                .WithReturn <bool>(),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.TryDeserializeState(0))
                .AddArgument(discovery, cursor, result)
                .WithReturn <bool>(),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.DeserializeState(0))
                .AddArgument(discovery, readOnlySpan, result)
                .WithReturn(memberType),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.DeserializeState(0))
                .AddArgument(discovery, cursor)
                .WithReturn(memberType),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.TrySerializeState(0))
                .AddArgument(discovery, sourceType, span, writtenBytes)
                .WithReturn(boolSymbol),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.SerializeState(0))
                .AddArgument(discovery, sourceType, span)
                .WithReturn(intSymbol),

                MethodSignatureBuilder.CreateMethod(_typeName, MemberMethod.GetLengthState(0))
                .AddArgument(discovery, sourceType)
                .WithReturn(intSymbol)
            });
示例#31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="IFormDecoder"/>
 /// <seealso cref="FormDecoderProviders"/>
 /// <seealso cref="LogWriter"/>
 public HttpServer(FormDecoderProvider decoderProvider, ILogWriter logWriter)
 {
     Check.Require(decoderProvider, "decoderProvider");
     _components = new ComponentProvider();
     _components.AddInstance <FormDecoderProvider>(decoderProvider);
     if (logWriter != null)
     {
         _components.AddInstance <ILogWriter>(logWriter);
         _logWriter = logWriter;
     }
     _components.Get <ILogWriter>();
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }
示例#32
0
文件: Program.cs 项目: alien-mcl/URSA
        private static void Process(string uri, string targetDirectory)
        {
            HttpUrl url;
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            if (uri.Length == 0)
            {
                throw new ArgumentOutOfRangeException("uri");
            }

            if (targetDirectory == null)
            {
                throw new ArgumentNullException("targetDirectory");
            }

            if (targetDirectory.Length == 0)
            {
                throw new ArgumentOutOfRangeException("targetDirectory");
            }

            url = UrlParser.Parse(uri) as HttpUrl;
            if (url == null)
            {
                throw new ArgumentOutOfRangeException("uri");
            }

            if (!Directory.Exists(targetDirectory))
            {
                throw new ArgumentOutOfRangeException("targetDirectory");
            }

            _container = UrsaConfigurationSection.InitializeComponentProvider();
            CreateProxy(targetDirectory, url);
        }
示例#33
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
		/// <param name="logWriter">The log writer.</param>
		/// <seealso cref="IFormDecoder"/>
		/// <seealso cref="FormDecoderProviders"/>
		/// <seealso cref="LogWriter"/>
		public HttpServer(FormDecoderProvider decoderProvider, ILogWriter logWriter)
		{
			Check.Require(decoderProvider, "decoderProvider");
		    Check.Require(logWriter, "logWriter");
			_components = new ComponentProvider();
            _components.AddInstance<FormDecoderProvider>(decoderProvider);
			_requestQueue = new RequestQueue(ProcessRequestWrapper);
		}
示例#34
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
		/// <seealso cref="IHttpSessionStore"/>
		public HttpServer(IHttpSessionStore sessionStore)
		{
		    Check.Require(sessionStore, "sessionStore");
		    _components = new ComponentFactory();
            _components.AddInstance<IHttpSessionStore>(sessionStore);
		}
示例#35
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
		/// <seealso cref="IHttpSessionStore"/>
		public HttpServer(IHttpSessionStore sessionStore)
		{
		    Check.Require(sessionStore, "sessionStore");
			_components = new ComponentProvider();
            _components.AddInstance<IHttpSessionStore>(sessionStore);
			_requestQueue = new RequestQueue(ProcessRequestWrapper);
		}
示例#36
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
		/// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
		/// <param name="logWriter">The log writer.</param>
		/// <seealso cref="IFormDecoder"/>
		/// <seealso cref="FormDecoderProviders"/>
		/// <seealso cref="LogWriter"/>
		/// <seealso cref="IHttpSessionStore"/>
		public HttpServer(FormDecoderProvider decoderProvider, IHttpSessionStore sessionStore, ILogWriter logWriter)
		{
			Check.Require(decoderProvider, "decoderProvider");
			Check.Require(sessionStore, "sessionStore");
            _components = new ComponentFactory();
            _components.AddInstance<FormDecoderProvider>(sessionStore);
            _components.AddInstance<IHttpSessionStore>(sessionStore);
            if (logWriter != null)
                _components.AddInstance<ILogWriter>(logWriter);
		}
示例#37
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="logWriter">The log writer.</param>
		/// <seealso cref="LogWriter"/>
		public HttpServer(ILogWriter logWriter)
		{
		    Check.Require(logWriter, "logWriter");
		    _components = new ComponentFactory();
            _components.AddInstance<ILogWriter>(logWriter);
		}
 public ComponentiserInvoker(IComponentProvider provider)
 {
     _provider = provider;
 }
示例#39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="provider">Used to get all components used in the server..</param>
 public HttpServer(IComponentProvider provider)
 {
     _components = provider;
 }
示例#40
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		public HttpServer()
		{
		    _components = new ComponentFactory();
		}
示例#41
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
		/// <seealso cref="IFormDecoder"/>
		/// <seealso cref="FormDecoderProviders"/>
		public HttpServer(FormDecoderProvider decoderProvider)
		{
		    Check.Require(decoderProvider, "decoderProvider");
            _components = new ComponentFactory();
            _components.AddInstance<FormDecoderProvider>(decoderProvider);
		}
示例#42
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		/// <param name="decoderProvider">Form decoders are used to convert different types of posted data to the <see cref="HttpInput"/> object types.</param>
		/// <param name="sessionStore">A session store is used to save and retrieve sessions</param>
		/// <param name="logWriter">The log writer.</param>
		/// <seealso cref="IFormDecoder"/>
		/// <seealso cref="FormDecoderProviders"/>
		/// <seealso cref="LogWriter"/>
		/// <seealso cref="IHttpSessionStore"/>
		public HttpServer(FormDecoderProvider decoderProvider, IHttpSessionStore sessionStore, ILogWriter logWriter)
		{
			Check.Require(decoderProvider, "decoderProvider");
			Check.Require(sessionStore, "sessionStore");
			_components = new ComponentProvider();
            _components.AddInstance<FormDecoderProvider>(sessionStore);
            _components.AddInstance<IHttpSessionStore>(sessionStore);
            if (logWriter != null)
                _components.AddInstance<ILogWriter>(logWriter);
			_requestQueue = new RequestQueue(ProcessRequestWrapper);
		}
示例#43
0
		/// <summary>
		/// Initializes a new instance of the <see cref="HttpServer"/> class.
		/// </summary>
		public HttpServer()
		{
		    _components = new ComponentProvider();
			_requestQueue = new RequestQueue(ProcessRequestWrapper);
		}
示例#44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpServer"/> class.
 /// </summary>
 /// <param name="logWriter">The log writer.</param>
 /// <seealso cref="LogWriter"/>
 public HttpServer(ILogWriter logWriter)
 {
     _components = new ComponentProvider();
     if (_logWriter != null)
     {
         _components.AddInstance<ILogWriter>(logWriter);
         _logWriter = logWriter;
     }
     _requestQueue = new RequestQueue(ProcessRequestWrapper);
 }