public SignatureCache(DocumentModel model, UrlResolver resolver) { _resolver = resolver; _documentedTypes = new ConcurrentDictionary<DocumentedType, TypeSignature>(new DocumentedTypeComparer()); _typeReferences = new ConcurrentDictionary<TypeReference, TypeSignature>(new TypeReferenceComparer()); _documentedMethods = new ConcurrentDictionary<DocumentedMethod, MethodSignature>(new DocumentedMethodComparer()); foreach (var @namespace in model.Assemblies.SelectMany(a => a.Namespaces)) { foreach (var type in @namespace.Types) { var typeSignature = type.Definition.GetTypeSignature(_resolver); _documentedTypes.TryAdd(type, typeSignature); _typeReferences.TryAdd(type.Definition, typeSignature); foreach (var method in type.Methods .Concat(type.Constructors) .Concat(type.Operators)) { var methodSignature = method.Definition.GetMethodSignature(_resolver); _documentedMethods.TryAdd(method, methodSignature); } } } }
private IHttpHandler CreateHttpHandler(IUrlResolver urlResolver) { MagickFormatInfo formatInfo = MagickNET.GetFormatInformation(urlResolver.Format); if (formatInfo == null || !formatInfo.IsReadable) { return(null); } IImageData imageData = ImageData.Create(urlResolver, formatInfo); if (!imageData.IsValid) { return(null); } IScriptData scriptData = urlResolver as IScriptData; if (IsValid(scriptData)) { return(new MagickScriptHandler(_settings, imageData, scriptData)); } if (HandlerHelper.CanOptimize(_settings, formatInfo)) { return(new ImageOptimizerHandler(_settings, imageData)); } if (HandlerHelper.CanCompress(_settings, formatInfo)) { return(new GzipHandler(_settings, imageData)); } return(null); }
public TwitterService(SiteConfiguration siteConfiguration, ITwitterClient twitterClient, ITinyUrlService tinyUrlService, IUrlResolver urlResolver) { _urlResolver = urlResolver; _tinyUrlService = tinyUrlService; _siteConfiguration = siteConfiguration; _twitterClient = twitterClient; }
public EndpointResolver(IUrlResolver urlResolver, IUrlSigner urlSigner, IOAuthCredentials oAuthCredentials, IApiUri apiUri) { _urlResolver = urlResolver; _urlSigner = urlSigner; _oAuthCredentials = oAuthCredentials; _apiUri = apiUri; }
public TableOfContentsTag(Topic root, IUrlResolver resolver) : base("ul") { AddClass("table-of-contents"); writeChildNodes(root, root, this, resolver); }
public void SetUp() { _siteConfiguration = new SiteConfiguration { TwitterUserName = "******", TwitterPassword = "******", }; _twitterClient = MockRepository.GenerateStub<ITwitterClient>(); _tinyUrlService = MockRepository.GenerateStub<ITinyUrlService>(); _urlResolver = MockRepository.GenerateStub<IUrlResolver>(); _twitterService = new TwitterService(_siteConfiguration, _twitterClient, _tinyUrlService, _urlResolver); _user = new User { TwitterUserName = "******", }; _post = new Post { User = _user, Title = "Test title", }; }
public static List <BookingPlace> GetListOfRestaurants(string type, string location, IUrlResolver urlResolver) { _urlResolver = urlResolver; var list = new List <BookingPlace>(); switch (type.ToLower()) { case "chinese": PopulateChineseRestaurants(location, list); break; case "german": PopulateGermanRestaurants(location, list); break; case "italian": PopulateItalianRestaurants(location, list); break; case "indian": PopulateIndianRestaurants(location, list); break; } return(list); }
public GetExtendedQueryTagsServiceTests() { _extendedQueryTagStore = Substitute.For <IExtendedQueryTagStore>(); _dicomTagParser = Substitute.For <IDicomTagParser>(); _urlResolver = Substitute.For <IUrlResolver>(); _getExtendedQueryTagsService = new GetExtendedQueryTagsService(_extendedQueryTagStore, _dicomTagParser, _urlResolver); }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, IEnumerable<IDiagnosticConfiguration> configurations) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); string diagnosticsUrl = urlResolver.Absolute(diagnosticsRelativeUrl); yield return DiagnosticRouteHelper.Instance.GetViewRoute<DiagnosticsView>( "Diagnostics Home View", guidFactory, diagnosticsRelativeUrl, ResponseResources.Diagnostics, DiagnosticsViewNamespaces, httpRuntime, view => { view.UrlResolver = urlResolver; AddLinks(view, diagnosticsUrl, configurations); }); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Common CSS", guidFactory, diagnosticsRelativeUrl + "/css/common", ResponseResources.common, httpRuntime); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Reset CSS", guidFactory, diagnosticsRelativeUrl + "/css/reset", ResponseResources.reset, httpRuntime); yield return DiagnosticRouteHelper.Instance.GetJavaScriptRoute("Diagnostics jQuery JS", guidFactory, diagnosticsRelativeUrl + "/js/jquery", ResponseResources.jquery_1_8_2_min, httpRuntime); foreach (IDiagnosticConfiguration arg in configurations) { foreach (Routing.Route route in arg.GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl)) { yield return route; } } }
public static FormsAuthenticationProvider CreateWithRouteRedirectOnFailedAuthentication(IUrlResolver urlResolver, Guid routeId, bool appendReturnUrl = false, string returnUrlQueryStringField = "ReturnURL", string cookieName = ".juniorauth") { urlResolver.ThrowIfNull("urlResolver"); cookieName.ThrowIfNull("cookieName"); return new FormsAuthenticationProvider(() => urlResolver.Route(routeId), appendReturnUrl, returnUrlQueryStringField, cookieName); }
public ExtendedContentModelMapper(IUrlResolver urlResolver, IContentModelMapper defaultContentModelMapper, ServiceAccessor <HttpContextBase> httpContextAccessor, IContentVersionRepository versionRepository) { _urlResolver = urlResolver; _defaultContentModelMapper = defaultContentModelMapper; _httpContextAccessor = httpContextAccessor; _versionRepository = versionRepository; }
public BookingDialog( BotSettings settings, BotServices services, ResponseManager responseManager, ConversationState conversationState, UserState userState, IBotTelemetryClient telemetryClient, IHttpContextAccessor httpContext) : base(nameof(BookingDialog), settings, services, responseManager, conversationState, userState, telemetryClient) { _httpContext = httpContext; // Restaurant Booking waterfall var bookingWaterfall = new WaterfallStep[] { Init, AskForFoodType, AskForDate, AskForTime, AskForAttendeeCount, ConfirmSelectionBeforeBooking, AskForRestaurant, ProcessReservationAsync }; AddDialog(new WaterfallDialog(Actions.BookRestaurant, bookingWaterfall)); // Prompts AddDialog(new ChoicePrompt(Actions.AskForFoodType, ValidateFoodType) { Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions { IncludeNumbers = true } }); AddDialog(new DateTimePrompt(Actions.AskReservationDateStep, ValidateReservationDate)); AddDialog(new DateTimePrompt(Actions.AskReservationTimeStep, ValidateReservationTime)); AddDialog(new NumberPrompt <int>(Actions.AskAttendeeCountStep, ValidateAttendeeCount)); AddDialog(new ConfirmPrompt(Actions.ConfirmSelectionBeforeBookingStep, ValidateBookingSelectionConfirmation)); AddDialog(new ChoicePrompt(Actions.RestaurantPrompt, ValidateRestaurantSelection) { Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions { IncludeNumbers = true } }); // Optional AddDialog(new ChoicePrompt(Actions.AmbiguousTimePrompt, ValidateAmbiguousTimePrompt) { Style = ListStyle.HeroCard, ChoiceOptions = new ChoiceFactoryOptions { IncludeNumbers = true } }); // Set starting dialog for component InitialDialogId = Actions.BookRestaurant; // Used to help resolve image locations in both local deployment and remote _urlResolver = new UrlResolver(httpContext, settings); }
public GetCapabilitiesHandler(IConformanceProvider provider, IUrlResolver urlResolver) { EnsureArg.IsNotNull(provider, nameof(provider)); EnsureArg.IsNotNull(urlResolver, nameof(urlResolver)); _provider = provider; _urlResolver = urlResolver; }
public LoginService(IApplicationSettings settings, IUrlResolver url, IJanrainEngageClient engageClient) { _settings = settings; _url = url; _engageClient = engageClient; }
public UserController(IUserRepository userRepository, IMapper<UserEditViewModel, User> mapper, IUrlResolver urlResolver, IResultOverride resultOverride) { _userRepository = userRepository; _mapper = mapper; _urlResolver = urlResolver; _resultOverride = resultOverride; }
public void Execute(Uri request, IHttpResponse response, IUrlResolver contentUrlResolver, IResponseStatusCodeResolver responseStatusCodeResolver) { var newUrl = RedirectRule.ContentId != null ? GetPathFromContentId(contentUrlResolver, request) : GetPathWithoutContentId(request); RedirectResponse(response, responseStatusCodeResolver, newUrl); }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, params IDiagnosticConfiguration[] configurations) { guidFactory.ThrowIfNull("guidFactory"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); return GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl, (IEnumerable<IDiagnosticConfiguration>)configurations); }
public IEnumerable <Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl, params IDiagnosticConfiguration[] configurations) { guidFactory.ThrowIfNull("guidFactory"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); configurations.ThrowIfNull("configurations"); return(GetRoutes(guidFactory, urlResolver, httpRuntime, diagnosticsRelativeUrl, (IEnumerable <IDiagnosticConfiguration>)configurations)); }
public BlogPostController(IRepository repository, IUrlResolver resolver, IBlogPostCommentService blogPostCommentService, IUserService userService, ITagService tagService) { _repository = repository; _resolver = resolver; _blogPostCommentService = blogPostCommentService; _userService = userService; _tagService = tagService; }
public SecondaryNavigationViewComponent(INavigationRepository navigationRepository, IPageDataContextRetriever pageDataContextRetriever, IUrlResolver urlResolver, ICacheDependenciesStore cacheDependenciesStore, ICacheDependenciesScope cacheDependenciesScope) { NavigationRepository = navigationRepository; PageDataContextRetriever = pageDataContextRetriever; UrlResolver = urlResolver; CacheDependenciesStore = cacheDependenciesStore; CacheDependenciesScope = cacheDependenciesScope; }
public UserController(IUserRepository userRepository, IMapper <UserEditViewModel, User> mapper, IUrlResolver urlResolver, IResultOverride resultOverride) { _userRepository = userRepository; _mapper = mapper; _urlResolver = urlResolver; _resultOverride = resultOverride; }
public BookmarksService(IContentLoader contentLoader, IUrlResolver urlResolver, IPermanentLinkMapper permanentLinkMapper) { _contentLoader = contentLoader; _urlResolver = urlResolver; _permanentLinkMapper = permanentLinkMapper; }
public TraineeDetailsScraper(IUrlResolver resolver, ICreateDirectory directory, IThreadSafeStepLogger logger, IGlobalSettings settings, IRetryWebRequests retry) { this.resolver = resolver; this.directory = directory; this.settings = settings; this.retry = retry; this.Logger = logger; }
public BundleFactory(IUrlResolver urlResolver, RequestContextAccessor <IFhirRequestContext> fhirRequestContextAccessor) { EnsureArg.IsNotNull(urlResolver, nameof(urlResolver)); EnsureArg.IsNotNull(fhirRequestContextAccessor, nameof(fhirRequestContextAccessor)); _urlResolver = urlResolver; _fhirRequestContextAccessor = fhirRequestContextAccessor; }
public SearchService( SearchHandler searchHandler, ContentSearchHandler contentSearchHandler, IUrlResolver urlResolver) { _searchHandler = searchHandler; _contentSearchHandler = contentSearchHandler; _urlResolver = urlResolver; }
public void Setup() { _repository = MockRepository.GenerateMock <IRepository>(); _resolver = MockRepository.GenerateStub <IUrlResolver>(); _blogPostCommentService = MockRepository.GenerateStub <IBlogPostCommentService>(); _userService = MockRepository.GenerateStub <IUserService>(); _tagService = MockRepository.GenerateStub <ITagService>(); _controller = new BlogPostController(_repository, _resolver, _blogPostCommentService, _userService, _tagService); }
public static string PublishedPost(this IUrlResolver resolver, PostDisplay post) { // TODO: _resolver.UrlFor<BlogController>() + "/" + ...; return(("~/blog/" + post.Published.Year + "/" + post.Published.Month + "/" + post.Published.Day + "/" + post.Slug).ToFullUrl()); }
public UrlContentProcessor(IUrlResolver urlResolver) { if (urlResolver == null) { throw new ArgumentNullException("urlResolver"); } this.urlResolver = urlResolver; }
public GetExtendedQueryTagsService( IExtendedQueryTagStore extendedQueryTagStore, IDicomTagParser dicomTagParser, IUrlResolver urlResolver) { _extendedQueryTagStore = EnsureArg.IsNotNull(extendedQueryTagStore, nameof(extendedQueryTagStore)); _dicomTagParser = EnsureArg.IsNotNull(dicomTagParser, nameof(dicomTagParser)); _urlResolver = EnsureArg.IsNotNull(urlResolver, nameof(urlResolver)); }
public RedirectBuilder WithUrlResolver(out IUrlResolver urlResolver, string newUrl = null) { var urlResolverMoq = new Mock <IUrlResolver>(); urlResolverMoq.Setup(ur => ur.GetUrl(It.IsAny <ContentReference>(), It.IsAny <string>(), It.IsAny <UrlResolverArguments>())).Returns(newUrl ?? "/newContentUrl"); urlResolver = urlResolverMoq.Object; return(this); }
/// <summary> /// Initializes a new instance of the <see cref="WebAssetItemMerger"/> class. /// </summary> /// <param name="assetRegistry">The asset registry.</param> /// <param name="urlResolver">The URL resolver.</param> /// <param name="httpServer">The HTTP server.</param> public WebAssetItemMerger(IWebAssetRegistry assetRegistry, IUrlResolver urlResolver, HttpServerUtilityBase httpServer) { Guard.IsNotNull(assetRegistry, "assetRegistry"); Guard.IsNotNull(urlResolver, "urlResolver"); Guard.IsNotNull(httpServer, "httpServer"); this.assetRegistry = assetRegistry; this.urlResolver = urlResolver; this.httpServer = httpServer; }
public static ContentReference GetContent(this IUrlResolver urlResolver, string url) { IContent contentData = urlResolver.Route(new UrlBuilder(url)); if (contentData == null) { return(ContentReference.EmptyReference); } return(contentData.ContentLink); }
public SearchEventHandler(IAzureSearchService azureSearchService, IContentLoader contentLoader, PageDocumentsProvider <T> pageDocumentsProvider, BlockDocumentsProvider <T> blockDocumentsProvider, IUrlResolver urlResolver) { _azureSearchService = azureSearchService; _contentLoader = contentLoader; _pageDocumentsProvider = pageDocumentsProvider; _blockDocumentsProvider = blockDocumentsProvider; _urlResolver = urlResolver; }
public CmsHeaderViewModelFactory(IUrlResolver urlResolver, IContentCacheKeyCreator contentCacheKeyCreator, IContentLoader contentLoader, LocalizationService localizationService) { _urlResolver = urlResolver; _contentCacheKeyCreator = contentCacheKeyCreator; _contentLoader = contentLoader; _localizationService = localizationService; }
public SchemaController(SchemaInformation schemaInformation, IUrlResolver urlResolver, ILogger <SchemaController> logger) { EnsureArg.IsNotNull(schemaInformation, nameof(schemaInformation)); EnsureArg.IsNotNull(urlResolver, nameof(urlResolver)); EnsureArg.IsNotNull(logger, nameof(logger)); _schemaInformation = schemaInformation; _urlResolver = urlResolver; _logger = logger; }
public BundleFactory(IUrlResolver urlResolver, IFhirRequestContextAccessor fhirRequestContextAccessor, ResourceDeserializer deserializer) { EnsureArg.IsNotNull(urlResolver, nameof(urlResolver)); EnsureArg.IsNotNull(fhirRequestContextAccessor, nameof(fhirRequestContextAccessor)); EnsureArg.IsNotNull(deserializer, nameof(deserializer)); _urlResolver = urlResolver; _fhirRequestContextAccessor = fhirRequestContextAccessor; _deserializer = deserializer; }
/// <summary> /// Initializes a new instance of the <see cref="WebAssetItemMerger"/> class. /// </summary> /// <param name="assetRegistry">The asset registry.</param> /// <param name="urlResolver">The URL resolver.</param> /// <param name="urlEncoder">The URL encoder.</param> public WebAssetItemMerger(IWebAssetRegistry assetRegistry, IUrlResolver urlResolver, IUrlEncoder urlEncoder) { Guard.IsNotNull(assetRegistry, "assetRegistry"); Guard.IsNotNull(urlResolver, "urlResolver"); Guard.IsNotNull(urlEncoder, "urlEncoder"); this.assetRegistry = assetRegistry; this.urlResolver = urlResolver; this.urlEncoder = urlEncoder; }
public LatestNewsBlockModelMapper(IContentTypeRepository contentTypeRepository, ReflectionService reflectionService, IContentModelReferenceConverter contentModelService, IPropertyConverterResolver propertyConverterResolver, IContentVersionRepository contentVersionRepository, ContentLoaderService contentLoaderService, UrlResolverService urlResolverService, ContentApiConfiguration apiConfig, IUrlResolver urlResolver, IContentLoader contentLoader) : base(contentTypeRepository, reflectionService, contentModelService, contentVersionRepository, contentLoaderService, urlResolverService, apiConfig, propertyConverterResolver) { _urlResolver = urlResolver; _contentLoader = contentLoader; }
/// <summary> /// Initializes a new instance of the <see cref="WebAssetRegistry"/> class. /// </summary> /// <param name="isInDebugMode">if set to <c>true</c> [is in debug mode].</param> /// <param name="cacheManager">The cache manager.</param> /// <param name="assetLocator">The asset locator.</param> /// <param name="urlResolver">The URL resolver.</param> /// <param name="pathResolver">The path resolver.</param> /// <param name="virtualPathProvider">The virtual path provider.</param> public WebAssetRegistry(bool isInDebugMode, ICacheManager cacheManager, IWebAssetLocator assetLocator, IUrlResolver urlResolver, IPathResolver pathResolver, IVirtualPathProvider virtualPathProvider) { this.isInDebugMode = isInDebugMode; this.cacheManager = cacheManager; this.assetLocator = assetLocator; this.urlResolver = urlResolver; this.pathResolver = pathResolver; this.virtualPathProvider = virtualPathProvider; }
public void SetUp() { _security = MockRepository.GenerateStub<ISecurityDataService>(); _authContext = MockRepository.GenerateMock<IAuthenticationContext>(); _resolver = MockRepository.GenerateMock<IUrlResolver>(); _controller = new LoginController(_security, _authContext, _resolver); _loginModel = new LoginViewModel(); _security.Stub(s => s.AuthenticateForUserId("foo", "bar")).Return(null); }
public PurgeOperationCapabilityProvider( SchemaInformation schemaInformation, IUrlResolver resolver) { EnsureArg.IsNotNull(schemaInformation, nameof(schemaInformation)); EnsureArg.IsNotNull(resolver, nameof(resolver)); _schemaInformation = schemaInformation; _resolver = resolver; }
public void SetUp() { _security = MockRepository.GenerateStub <ISecurityDataService>(); _authContext = MockRepository.GenerateMock <IAuthenticationContext>(); _resolver = MockRepository.GenerateMock <IUrlResolver>(); _controller = new LoginController(_security, _authContext, _resolver); _loginModel = new LoginViewModel(); _security.Stub(s => s.AuthenticateForUserId("foo", "bar")).Return(null); }
public static FormsAuthenticationProvider CreateWithRouteRedirectOnFailedAuthentication(IFormsAuthenticationHelper helper, IUrlResolver urlResolver, Guid routeId, string returnUrlQueryStringField = "ReturnURL") { helper.ThrowIfNull("helper"); urlResolver.ThrowIfNull("urlResolver"); if (returnUrlQueryStringField == "") { throw new ArgumentException("Return URL query string field cannot be an empty string.", "returnUrlQueryStringField"); } return new FormsAuthenticationProvider(helper, () => urlResolver.Route(routeId), returnUrlQueryStringField); }
public void Should_throw_argumentexception_if_hitendpoint_fired_with_null_querystring() { _urlResolver = MockRepository.GenerateMock<IUrlResolver>(); _urlResolver.Stub(x => x.Resolve(null, "", null)) .IgnoreArguments() .Return("<response status=\"error\" version=\"1.2\"><error code=\"1001\"><errorMessage>Missing parameter \"tags\".</errorMessage></error></response>"); var endpointResolver = new EndpointResolver(_urlResolver); var argException = Assert.Throws<ArgumentException>(() => endpointResolver.HitEndpoint("", "", null)); Assert.That(argException.Message, Is.EqualTo("querystring parameter cannot be null, please instantiate")); }
public void SetUp() { _flash = MockRepository.GenerateStub<IFlash>(); _auth = MockRepository.GenerateStub<IAuthenticationContext>(); _locator = MockRepository.GenerateStub<IServiceLocator>(); ServiceLocator.SetLocatorProvider(()=> _locator); _resolver = MockRepository.GenerateStub<IUrlResolver>(); _locator.Stub(l => l.GetInstance<IUrlResolver>()).Return(_resolver); _controller = new LoginController(_flash, _auth, _resolver); beforeEach(); }
public void Should_throw_api_exception_with_correct_error_if_error_xml_received() { _urlResolver = MockRepository.GenerateMock<IUrlResolver>(); _urlResolver.Stub(x => x.Resolve(null, "", null)) .IgnoreArguments() .Return("<response status=\"error\" version=\"1.2\"><error code=\"1001\"><errorMessage>Missing parameter \"tags\".</errorMessage></error></response>"); var endpointResolver = new EndpointResolver(_urlResolver); var apiException = Assert.Throws<ApiXmlException>(() => endpointResolver.HitEndpoint("", "", new NameValueCollection())); Assert.That(apiException.Message, Is.EqualTo("An error has occured in the Api")); Assert.That(apiException.Error.Code, Is.EqualTo(1001)); Assert.That(apiException.Error.ErrorMessage, Is.EqualTo("Missing parameter \"tags\".")); }
/// <summary> /// Gets the property signature for the specified property reference. /// </summary> /// <param name="property">The property reference.</param> /// <param name="resolver">The link resolver.</param> /// <returns>The property signature for the specified property reference.</returns> public static PropertySignature GetPropertySignature(this PropertyReference property, IUrlResolver resolver) { // Get the property definition. var definition = property.Resolve(); // Get the property Identity and name. var identity = CRefGenerator.GetPropertyCRef(definition); var name = definition.Name; var declaringType = definition.DeclaringType.GetTypeSignature(resolver); var propertyType = definition.PropertyType.GetTypeSignature(resolver); return new PropertySignature(identity, name, declaringType, propertyType); }
public void SetUp() { _posts = new List<Post>(); _repository = MockRepository.GenerateStub<IRepository>(); _resolver = MockRepository.GenerateStub<IUrlResolver>(); _blogPostCommentService = MockRepository.GenerateStub<IBlogPostCommentService>(); _userService = MockRepository.GenerateStub<IUserService>(); _controller = new BlogPostController(_repository, _resolver, _blogPostCommentService, _userService); _testSlug = "TESTSLUG"; _post = new Post { Slug = _testSlug }; _posts.Add(_post); }
/// <summary> /// Initializes a new instance of the <see cref="WebAssetRegistry"/> class. /// </summary> /// <param name="isInDebugMode">if set to <c>true</c> [is in debug mode].</param> /// <param name="cacheManager">The cache manager.</param> /// <param name="assetLocator">The asset locator.</param> /// <param name="urlResolver">The URL resolver.</param> /// <param name="pathResolver">The path resolver.</param> /// <param name="virtualPathProvider">The virtual path provider.</param> public WebAssetRegistry(bool isInDebugMode, ICacheManager cacheManager, IWebAssetLocator assetLocator, IUrlResolver urlResolver, IPathResolver pathResolver, IVirtualPathProvider virtualPathProvider) { Guard.IsNotNull(cacheManager, "cacheManager"); Guard.IsNotNull(assetLocator, "assetLocator"); Guard.IsNotNull(urlResolver, "urlResolver"); Guard.IsNotNull(pathResolver, "pathResolver"); Guard.IsNotNull(virtualPathProvider, "virtualPathProvider"); this.isInDebugMode = isInDebugMode; this.cacheManager = cacheManager; this.assetLocator = assetLocator; this.urlResolver = urlResolver; this.pathResolver = pathResolver; this.virtualPathProvider = virtualPathProvider; }
private void writeChildNodes(Topic root, Topic parent, HtmlTag tag, IUrlResolver resolver) { parent.Children.Each(childTopic => { var li = tag.Add("li"); li.Add("a").Attr("href", resolver.ToUrl(root, childTopic)).Text(childTopic.Title); if (childTopic.Children.Any()) { var ul = li.Add("ul"); writeChildNodes(root, childTopic, ul, resolver); } }); }
public IEnumerable<Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return DiagnosticRouteHelper.Instance.GetViewRoute<RouteTableView>( "Diagnostics Route Table View", guidFactory, diagnosticsRelativeUrl + "/route_table", ResponseResources.RouteTable, RouteTableViewNamespaces, httpRuntime, view => view.Populate(urlResolver, _routes.Value, diagnosticsRelativeUrl)); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics Route Table View CSS", guidFactory, diagnosticsRelativeUrl + "/route_table/css", ResponseResources.route_table_view, httpRuntime); }
/// <summary> /// Gets a type description for the specified type. /// </summary> /// <param name="type">The type reference.</param> /// <param name="resolver">The link resolver.</param> /// <returns>A type description for the specified type.</returns> public static TypeSignature GetTypeSignature(this TypeReference type, IUrlResolver resolver) { // Get the namespace of the type. var ns = new NamespaceSignature(type.Namespace); // Get the identity. var identity = CRefGenerator.GetTypeCRef(type); // Get the type name. var name = type.Name; var index = name.IndexOf('`'); if (index != -1) { name = name.Substring(0, index); } if (name.EndsWith("&")) { name = name.TrimEnd('&'); } // Get generic parameters and arguments. var genericParameters = new List<string>(); var genericArguments = new List<TypeSignature>(); if (type.IsGenericInstance) { // Generic arguments var genericInstanceType = type as GenericInstanceType; if (genericInstanceType != null) { genericArguments.AddRange( genericInstanceType.GenericArguments.Select( reference => GetTypeSignature(reference, resolver))); } } else if (type.HasGenericParameters) { // Generic parameters genericParameters.AddRange( type.GenericParameters.Select( genericParameter => genericParameter.Name)); } // Return the type description. var url = resolver?.GetUrl(identity); return new TypeSignature(identity, name, url, ns, genericParameters, genericArguments); }
private static IHttpHandler CreateHttpHandler(IUrlResolver urlResolver) { if (string.IsNullOrEmpty(urlResolver.FileName) || !File.Exists(urlResolver.FileName)) return null; MagickFormatInfo formatInfo = MagickNET.GetFormatInformation(urlResolver.Format); if (formatInfo == null || string.IsNullOrEmpty(formatInfo.MimeType)) return null; if (urlResolver.Script != null) return new MagickScriptHandler(urlResolver, formatInfo); if (ImageOptimizerHandler.CanOptimize(formatInfo)) return new ImageOptimizerHandler(urlResolver, formatInfo); if (GzipHandler.CanCompress(formatInfo)) return new GzipHandler(urlResolver, formatInfo); return null; }
/// <summary> /// Gets the method signature. /// </summary> /// <param name="method">The method.</param> /// <param name="resolver">The link resolver.</param> /// <returns>The method signature.</returns> public static MethodSignature GetMethodSignature(this MethodReference method, IUrlResolver resolver) { // Get the method definition. var definition = method.Resolve(); // Get the method Identity and name. var identity = CRefGenerator.GetMethodCRef(definition); var name = GetMethodName(definition); // Get the declaring type and return type. var declaringType = definition.DeclaringType.GetTypeSignature(resolver); var returnType = definition.ReturnType.GetTypeSignature(resolver); // Get generic parameters and arguments. var genericParameters = new List<string>(); if (method.HasGenericParameters) { // Generic parameters genericParameters.AddRange( method.GenericParameters.Select( genericParameter => genericParameter.Name)); } // Get all parameters. var parameters = definition.Parameters.Select( parameterDefinition => new ParameterSignature( parameterDefinition.Name, parameterDefinition.ParameterType.GetTypeSignature(resolver), parameterDefinition.IsOut, parameterDefinition.ParameterType is ByReferenceType)) .ToList(); // Get the classifications. var classification = MethodClassifier.GetMethodClassification(definition); var operatorClassification = MethodClassifier.GetOperatorClassification(definition); // Return the method signature. var url = resolver == null ? string.Empty : resolver.GetUrl(identity); return new MethodSignature(identity, name, url, classification, operatorClassification, declaringType, returnType, genericParameters, parameters); }
public IEnumerable<Routing.Route> GetRoutes(IGuidFactory guidFactory, IUrlResolver urlResolver, IHttpRuntime httpRuntime, string diagnosticsRelativeUrl) { guidFactory.ThrowIfNull("guidFactory"); urlResolver.ThrowIfNull("urlResolver"); httpRuntime.ThrowIfNull("httpRuntime"); diagnosticsRelativeUrl.ThrowIfNull("diagnosticsUrl"); yield return DiagnosticRouteHelper.Instance.GetViewRoute<AspNetView>( "Diagnostics ASP.net View", guidFactory, diagnosticsRelativeUrl + "/asp_net", ResponseResources.AspNet, AspNetViewNamespaces, httpRuntime, view => { view.UrlResolver = urlResolver; view.Populate(_cacheType, _responseGeneratorTypes, _responseHandlerTypes); }); yield return DiagnosticRouteHelper.Instance.GetStylesheetRoute("Diagnostics ASP.net View CSS", guidFactory, diagnosticsRelativeUrl + "/asp_net/css", ResponseResources.asp_net_view, httpRuntime); }
public EndpointResolver(IUrlResolver urlResolver) { _urlResolver = urlResolver; }
/// <summary> /// Creates a new instance of the TransactionRegistrar /// </summary> public TransactionRegistrar(Configuration configuration, IUrlResolver urlResolver, IHttpRequestSender requestSender) { this.configuration = configuration; this.requestSender = requestSender; this.urlResolver = urlResolver; }
public LinkToTransformHandler(IUrlResolver urls, Topic top) { _urls = urls; _top = top; }