Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }