public virtual WebAssetItemCollectionBuilder AddSharedGroup(string name)
{
Guard.IsNotNullOrEmpty(name, "name");
WebAssetItemGroup group = (assetType == WebAssetType.StyleSheet) ?
SharedWebAssets.FindStyleSheetGroup(name) :
SharedWebAssets.FindScriptGroup(name);
if (group == null)
{
throw new ArgumentException(TextResource.GroupWithSpecifiedNameDoesNotExistInAssetTypeOfSharedWebAssets.FormatWith(name, assetType), "name");
}
if (assets.FindGroupByName(name) == null)
{
// People might have the same group reference in multiple place.
// So we will skip it once it is added.
// throw new ArgumentException(TextResource.LocalGroupWithSpecifiedNameAlreadyExists.FormatWith(name));
// Add a copy of the shared asset
WebAssetItemGroup localGroup = new WebAssetItemGroup(group.Name, true)
{
DefaultPath = group.DefaultPath,
UseTelerikContentDeliveryNetwork = group.UseTelerikContentDeliveryNetwork,
ContentDeliveryNetworkUrl = group.ContentDeliveryNetworkUrl,
Enabled = group.Enabled,
Version = group.Version,
Compress = group.Compress,
CacheDurationInDays = group.CacheDurationInDays,
Combined = group.Combined
};
foreach (WebAssetItem item in group.Items)
{
localGroup.Items.Add(new WebAssetItem(item.Source));
}
assets.Add(localGroup);
}
return this;
}