Esempio n. 1
0
        public IEnumerable <Asset> ResolveUrls(string[] vpaths)
        {
            if (vpaths == null || vpaths.Length == 0)
            {
                return(Enumerable.Empty <Asset>());
            }

            var assets = new List <Asset>(vpaths.Length);

            foreach (var vpath in vpaths)
            {
                if (!VirtualPathHelper.IsVirtualPath(vpath))
                {
                    continue;
                }
                if (BundleManager.IsBundle(vpath))
                {
                    assets.Add(new Asset(vpath, AssetType.Bundle));
                }
                // case single virtual file
                else if (VirtualPathUtils.IsVirtualFile(vpath))
                {
                    assets.Add(new Asset(vpath, GetAssetType(vpath)));
                }
                // case virtual directory
                else if (VirtualPathUtils.IsVirtualDirectory(vpath))
                {
                    foreach (var vfilepath in VirtualPathUtils.GetResourcesFiles(vpath))
                    {
                        assets.Add(new Asset("~" + vfilepath, GetAssetType(vfilepath)));
                    }
                }
            }
            return(assets);
        }
Esempio n. 2
0
 public AssetResolver(IBundleManager bundleManager)
 {
     BundleManager    = bundleManager;
     VirtualPathUtils = new VirtualPathHelper(bundleManager.VirtualPathProvider);
 }