public void Init() { var builder = new ContainerBuilder(); builder.RegisterType<ResourceManager>().As<IResourceManager>(); builder.RegisterType<ResourceFileHashProvider>().As<IResourceFileHashProvider>(); builder.RegisterType<TestManifestProvider>().As<IResourceManifestProvider>().SingleInstance(); _container = builder.Build(); _resourceManager = _container.Resolve<IResourceManager>(); _resourceFileHashProvider = _container.Resolve<IResourceFileHashProvider>(); _testManifest = _container.Resolve<IResourceManifestProvider>() as TestManifestProvider; }
public CoreShapes( Work <WorkContext> workContext, Work <IResourceManager> resourceManager, Work <IHttpContextAccessor> httpContextAccessor, Work <IShapeFactory> shapeFactory, IResourceFileHashProvider resourceHashProvider ) { _workContext = workContext; _resourceManager = resourceManager; _httpContextAccessor = httpContextAccessor; _shapeFactory = shapeFactory; _resourceFileHashProvider = resourceHashProvider; T = NullLocalizer.Instance; }
public string ResolveUrl(RequireSettings settings, string applicationPath, bool ssl, IResourceFileHashProvider resourceFileHashProvider) { string url; string physicalPath = null; // Url priority: if (!ssl || (ssl && CdnSupportsSsl)) //Not ssl or ssl and cdn supports it { if (settings.DebugMode) { url = settings.CdnMode ? Coalesce(UrlCdnDebug, UrlDebug, UrlCdn, Url) : Coalesce(UrlDebug, Url, UrlCdnDebug, UrlCdn); } else { url = settings.CdnMode ? Coalesce(UrlCdn, Url, UrlCdnDebug, UrlDebug) : Coalesce(Url, UrlDebug, UrlCdn, UrlCdnDebug); } } else //ssl and cdn does not support it, only evaluate non-cdn url's { url = settings.DebugMode ? Coalesce(UrlDebug, Url) : Coalesce(Url, UrlDebug); } if (url == UrlDebug) { physicalPath = PhysicalPathDebug; } else if (url == Url) { physicalPath = PhysicalPath; } if (String.IsNullOrEmpty(url)) { return(null); } if (!String.IsNullOrEmpty(settings.Culture)) { string nearestCulture = FindNearestCulture(settings.Culture); if (!String.IsNullOrEmpty(nearestCulture)) { url = Path.ChangeExtension(url, nearestCulture + Path.GetExtension(url)); } } if (!Uri.IsWellFormedUriString(url, UriKind.Absolute) && !VirtualPathUtility.IsAbsolute(url) && !VirtualPathUtility.IsAppRelative(url) && !String.IsNullOrEmpty(BasePath)) { // relative urls are relative to the base path of the module that defined the manifest url = VirtualPathUtility.Combine(BasePath, url); } if (VirtualPathUtility.IsAppRelative(url)) { url = applicationPath != null ? VirtualPathUtility.ToAbsolute(url, applicationPath) : VirtualPathUtility.ToAbsolute(url); } if (settings.FileHashMode && !String.IsNullOrEmpty(physicalPath) && File.Exists(physicalPath)) { url = AddQueryStringValue(url, "fileHash", resourceFileHashProvider.GetResourceFileHash(physicalPath)); } return(url); }
public string ResolveUrl(RequireSettings settings, string applicationPath, IResourceFileHashProvider resourceFileHashProvider) { return(ResolveUrl(settings, applicationPath, false, resourceFileHashProvider)); }
public TagBuilder GetTagBuilder(RequireSettings baseSettings, string appPath, IResourceFileHashProvider resourceFileHashProvider) { var tagBuilder = new TagBuilder(Resource.TagName); tagBuilder.MergeAttributes(Resource.TagBuilder.Attributes); if (!String.IsNullOrEmpty(Resource.FilePathAttributeName)) { var resolvedUrl = GetResourceUrl(baseSettings, appPath, false, resourceFileHashProvider); if (!String.IsNullOrEmpty(resolvedUrl)) { tagBuilder.MergeAttribute(Resource.FilePathAttributeName, resolvedUrl, true); } } return(tagBuilder); }
public string GetResourceUrl(RequireSettings baseSettings, string appPath, bool ssl, IResourceFileHashProvider resourceFileHashProvider) { return(Resource.ResolveUrl(baseSettings == null ? Settings : baseSettings.Combine(Settings), appPath, ssl, resourceFileHashProvider)); }