Bundle FindBundle()
        {
            var path = "~/" + routeData.GetRequiredString("path");

            Trace.Source.TraceInformation("Handling bundle request for \"{0}\".", path);
            path = RemoveTrailingHashFromPath(path);
            return(bundleContainer.FindBundleContainingPath <T>(path));
        }
Exemple #2
0
        IEnumerable <XElement> CreateReferenceElements(Bundle bundle, IBundleContainer bundleContainer)
        {
            var references = (
                from asset in bundle.Assets
                from r in asset.References
                where r.Type == AssetReferenceType.DifferentBundle || r.Type == AssetReferenceType.Url
                select bundleContainer.FindBundleContainingPath <Bundle>(r.Path).Path
                ).Concat(bundle.References)
                             .Distinct(StringComparer.OrdinalIgnoreCase);

            return(from reference in references
                   select new XElement("Reference", new XAttribute("Path", reference)));
        }
 public static bool TryGetAssetByPath(this IBundleContainer bundleContainer, string path, out IAsset asset, out Bundle bundle)
 {
     bundle = bundleContainer.FindBundleContainingPath <Bundle>(path);
     if (bundle == null)
     {
         asset = null;
         return(false);
     }
     else
     {
         asset = bundle.FindAssetByPath(path);
         return(asset != null);
     }
 }
Exemple #4
0
        Bundle GetBundle(string path, Func <Bundle> createExternalBundle)
        {
            path = PathUtilities.AppRelative(path);

            var bundle = bundleContainer.FindBundleContainingPath <Bundle>(path);

            if (bundle == null && path.IsUrl())
            {
                bundle = createExternalBundle();
                bundle.Process(settings);
            }

            if (bundle == null)
            {
                throw new ArgumentException("Cannot find an asset bundle containing the path \"" + path + "\".");
            }

            return(bundle);
        }
Exemple #5
0
        IEnumerable<XElement> CreateReferenceElements(Bundle bundle, IBundleContainer bundleContainer)
        {
            var references = (
                from asset in bundle.Assets
                from r in asset.References
                where r.Type == AssetReferenceType.DifferentBundle || r.Type == AssetReferenceType.Url
                select bundleContainer.FindBundleContainingPath<Bundle>(r.Path).Path
            ).Concat(bundle.References)
             .Distinct(StringComparer.OrdinalIgnoreCase);

            return from reference in references
                   select new XElement("Reference", new XAttribute("Path", reference));
        }
Exemple #6
0
 public override T FindBundleContainingPath <T>(string path)
 {
     return(bundleContainer.FindBundleContainingPath <T>(path));
 }
 public virtual T FindBundleContainingPath <T>(string path)
     where T : Bundle
 {
     return(bundleContainer.FindBundleContainingPath <T>(path));
 }