public Asset(AssetType type, ScriptLocation location, string content, AssetContentType contentType = AssetContentType.File, string site = null) { if (content == null) { throw new ArgumentNullException(nameof(content)); } this.Type = type; this.Content = content; this.ContentType = contentType; this.Location = location; if (this.ContentType == AssetContentType.Inline) { this.AddOnceToken = this.Content.GetHashCode().ToString(); } this.Site = site; }
private Asset CreateAsset(string content, ScriptLocation location, AssetType assetType, AssetContentType contentType, string site) { var cleanContent = this.CleanContent(content); if (cleanContent == null) { return(null); } var asset = new Asset(assetType, location, cleanContent, contentType, site); return(asset); }
private Asset AddAsset(string content, ScriptLocation location, bool preventAddToCache, AssetType assetType, AssetContentType contentType, string site = null) { var asset = this.CreateAsset(content, location, assetType, contentType, site); return(asset == null ? null : this.Add(asset, preventAddToCache)); }