Esempio n. 1
0
            protected ASCBundle(string virtualPath, params IBundleTransform[] transforms)
                : base(virtualPath, transforms)
            {
                Transforms.Add(new CopyrigthTransform());
                BundlePath = Path;

                if (!BundleTable.Bundles.UseCdn || virtualPath.Contains(CLIENT_SCRIPT_VPATH))
                {
                    return;
                }

                if (CoreContext.Configuration.Standalone)
                {
                    Transforms.Add(new DiscTransform());

                    BundlePath = DiscTransform.GetFullFileName(Path, ContentType);
                    if (DiscTransform.BundleExist(BundlePath))
                    {
                        CdnPath = BundlePath;
                    }
                }
                else
                {
                    Transforms.Add(new CdnTransform());
                }
            }
Esempio n. 2
0
            protected ASCBundle(string virtualPath, params IBundleTransform[] transforms)
                : base(virtualPath, transforms)
            {
                Transforms.Add(new CopyrigthTransform());

                if (!BundleTable.Bundles.UseCdn)
                {
                    return;
                }

                bool isCDN = false;

                var section = (StorageConfigurationSection)WebConfigurationManager.GetSection("storage");

                foreach (HandlerConfigurationElement h in section.Handlers)
                {
                    if (String.Compare(h.Name, "cdn", true) != 0)
                    {
                        continue;
                    }

                    if (h.Type.Equals(typeof(SelectelStorage)))
                    {
                        Transforms.Add(new SelectelStorageTransform());
                    }
                    else if (h.Type.Equals(typeof(S3Storage)))
                    {
                        Transforms.Add(new CloudFrontTransform());
                    }
                    else if (h.Type.Equals(typeof(GoogleCloudStorage)))
                    {
                        Transforms.Add(new GoogleCloudStorageTransform());
                    }
                    else if (h.Type.Equals(typeof(RackspaceCloudStorage)))
                    {
                        Transforms.Add(new RackspaceCloudStorageTransform());
                    }
                    else
                    {
                        throw new Exception("unknown argument");
                    }

                    isCDN = true;

                    break;
                }

                if (!isCDN)
                {
                    if (CoreContext.Configuration.Standalone)
                    {
                        Transforms.Add(new DiscTransform());
                        CdnPath = DiscTransform.GetUri(Path, ContentType);
                    }
                }
            }
Esempio n. 3
0
        private string GetLink()
        {
            var path = bundleData.GetStorageVirtualPath(ClientSettings.ResetCacheKey);

            if (DiscTransform.SuccessInitialized && DiscTransform.IsFile(path))
            {
                return(bundleData.GetLink(DiscTransform.GetUri(path), false));
            }

            return(BundleHelper.AddBundle(bundleData));
        }
Esempio n. 4
0
            protected ASCBundle(string virtualPath, params IBundleTransform[] transforms)
                : base(virtualPath, transforms)
            {
                Transforms.Add(new CopyrigthTransform());

                if (!BundleTable.Bundles.UseCdn)
                {
                    return;
                }

                if (CoreContext.Configuration.Standalone)
                {
                    Transforms.Add(new DiscTransform());
                    CdnPath = DiscTransform.GetUri(Path, ContentType);
                }
                else
                {
                    Transforms.Add(new CdnTransform());
                }
            }