Bundle CreateExternalBundle(string reference, Bundle referencer, CassetteSettings settings)
 {
     var bundleFactory = GetBundleFactory(referencer.GetType());
     var externalBundle = bundleFactory.CreateExternalBundle(reference);
     externalBundle.Process(settings);
     return externalBundle;
 }
 Bundle CreateExternalBundle(string url, Bundle referencer)
 {
     var bundleFactory = GetBundleFactory(referencer.GetType());
     var externalBundle = bundleFactory.CreateExternalBundle(url);
     externalBundle.Process(settings);
     return externalBundle;
 }
Пример #3
0
        Bundle CreateExternalBundle(string url, Bundle referencer)
        {
            var bundleFactory  = GetBundleFactory(referencer.GetType());
            var externalBundle = bundleFactory.CreateExternalBundle(url);

            externalBundle.Process(settings);
            return(externalBundle);
        }
        Bundle CreateExternalBundle(string reference, Bundle referencer, CassetteSettings settings)
        {
            var bundleFactory  = GetBundleFactory(referencer.GetType());
            var externalBundle = bundleFactory.CreateExternalBundle(reference);

            externalBundle.Process(settings);
            return(externalBundle);
        }
Пример #5
0
        protected virtual IBundleModel CreateModel(Bundle bundle)
        {
            IBundleModel result =
                _modelFactories.Select(f => f.Create(bundle)).FirstOrDefault(m => m != null) ??
                throw ErrorHelper.ModelFactoryNotAvailable(bundle.GetType());

            result.Changed += BundleChanged;
            return(result);
        }
 public string CreateBundleUrl(Bundle bundle)
 {
     return(getCurrentContext()
            .ToFullPath(string.Format("~/{0}/{1}/{2}_{3}",
                                      RoutePrefix,
                                      ConventionalBundlePathName(bundle.GetType()),
                                      bundle.Path.Substring(2),
                                      bundle.Hash.ToHexString())));
 }
Пример #7
0
 public string CreateBundleUrl(Bundle bundle)
 {
     return(urlModifier.Modify(string.Format("{0}/{1}/{2}_{3}",
                                             RoutePrefix,
                                             ConventionalBundlePathName(bundle.GetType()),
                                             bundle.PathWithoutPrefix,
                                             bundle.Hash.ToHexString()
                                             )));
 }
Пример #8
0
 public string BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable<BundleFile> files)
 {
     var adHocBundle = bundle as AdHocBundle;
     if (adHocBundle == null)
     {
         throw new ArgumentException(String.Format("The AdHocBundleBuilder is only meant to be used by an AdHocBundle. This one is called from a bundle of type '{0}'", bundle.GetType()), "bundle");
     }
     return adHocBundle.Content;
 }
Пример #9
0
        /// <summary>
        /// Bundle 클래스 Json파일로 저장.
        /// </summary>
        public static void FromJsonData(this Bundle bundle)
        {
            var filePath = $"{LocalDataManager.DataPath}/{bundle.GetType ().Name}.json";

            if (!File.Exists(filePath))
            {
                return;
            }
            var dataString = File.ReadAllText(filePath);

            JsonUtility.FromJsonOverwrite(dataString, bundle);
        }
Пример #10
0
        /// <summary>
        /// Bundle 클래스 Json파일로 저장.
        /// </summary>
        public static Bundle FromJsonData(this Bundle bundle)
        {
            var filePath = $"{Application.persistentDataPath}/{bundle.GetType().Name}.json";

            if (!File.Exists(filePath))
            {
                return(bundle);
            }
            var dataString = File.ReadAllText(filePath);

            JsonUtility.FromJsonOverwrite(dataString, bundle);

            return(bundle);
        }
        private void BindControls()
        {
            var answers = Answers.Map();

            lblBundleName.Text = _formBundle.GetType().Name;

            var availableProducts            = _productService.GetAvailable(answers);
            var bundleProductTypes           = _formBundle.Products.Select(p => p.GetType()).ToArray();
            var availableProductsNotInBundle = availableProducts.Where(p => !bundleProductTypes.Contains(p.GetType())).ToList();

            lstBoxProducts_DataSource = availableProductsNotInBundle.Select(x => new ProductListItem {
                Value = x, Text = x.GetType().Name
            }).ToList();
            BindData(lstBoxProducts, lstBoxProducts_DataSource);

            listBoxSelectedProducts_DataSource = _formBundle.Products.Select(x => new ProductListItem {
                Value = x, Text = x.GetType().Name
            }).ToList();
            BindData(listBoxSelectedProducts, listBoxSelectedProducts_DataSource);
        }
Пример #12
0
        public string BuildBundleContent(Bundle bundle, BundleContext context, IEnumerable <BundleFile> files)
        {
            var adHocBundle = bundle as AdHocBundle;

            if (adHocBundle == null)
            {
                throw new ArgumentException(String.Format("The AdHocBundleBuilder is only meant to be used by an AdHocBundle. This one is called from a bundle of type '{0}'", bundle.GetType()), "bundle");
            }
            return(adHocBundle.Content);
        }
Пример #13
0
        protected Bundle ProcessSingleBundle(IFileHelper fileHelper, IDirectory directory, List<Bundle> bundlesToSort,
            Dictionary<string, string> uncachedToCachedFiles, Bundle bundle, AssignHash hasher)
        {
            Trace.Source.TraceInformation("Processing {0} {1}", bundle.GetType().Name, bundle.Path);

            //need to process early to generate an accurate hash.
            if (IsCompositeBundle(bundle))
            {
                bundle.Process(settings);
            }
            else
            {
                hasher.Process(bundle, settings);
            }

            var bundleKey = CassetteSettings.bundles.GetSafeString(Encoding.Default.GetString(bundle.Hash));
            if (CassetteSettings.bundles.ContainsKey(fileHelper, directory, uncachedToCachedFiles, bundleKey, bundle))
            {
                bundle = CassetteSettings.bundles.GetBundle(fileHelper, directory, uncachedToCachedFiles, bundleKey, bundle);
                bundlesToSort.Add(bundle);
            }
            else
            {
                var unprocessedAssetPaths = CassetteSettings.bundles.GetAssetPaths(bundle);
                if (!IsCompositeBundle(bundle))
                {
                    bundle.Process(settings);
                }
                CassetteSettings.bundles.AddBundle(fileHelper, uncachedToCachedFiles, bundleKey, bundle, unprocessedAssetPaths);
            }
            return bundle;
        }
Пример #14
0
        /// <summary>
        /// Json파일 Bundle클래스로 저장.
        /// </summary>
        public static void ToJsonData(this Bundle bundle)
        {
            var filePath = $"{LocalDataManager.DataPath}/{bundle.GetType ().Name}.json";

            File.WriteAllText(filePath, JsonUtility.ToJson(bundle));
        }