IEnumerable<Bundle> GetBundles(string path, Func<Bundle> createExternalBundle)
        {
            path = PathUtilities.AppRelative(path);

            var bundles = bundleContainer.FindBundlesContainingPath(path).ToArray();
            if (bundles.Length == 0 && path.IsUrl())
            {
                var bundle = createExternalBundle();
                bundle.Process(settings);
                bundles = new[] { bundle };
            }

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

            return bundles;
        }
Exemple #2
0
        public static bool TryGetAssetByPath(this IBundleContainer bundleContainer, string path, out IAsset asset, out Bundle bundle)
        {
            var results =
                from b in bundleContainer.FindBundlesContainingPath(path)
                let a = b.FindAssetByPath(path)
                        where a != null
                        select new { Bundle = b, Asset = a };

            var result = results.FirstOrDefault();

            if (result != null)
            {
                asset  = result.Asset;
                bundle = result.Bundle;
                return(true);
            }
            else
            {
                asset  = null;
                bundle = null;
                return(false);
            }
        }
Exemple #3
0
 public virtual T FindBundleContainingPath <T>(string path)
     where T : Bundle
 {
     return(bundleContainer.FindBundlesContainingPath(path).OfType <T>().FirstOrDefault());
 }
Exemple #4
0
 public override T FindBundleContainingPath <T>(string path)
 {
     return(bundleContainer.FindBundlesContainingPath(path).OfType <T>().FirstOrDefault());
 }