Пример #1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var hash = HashUtility.Hash(this.Hosting.WebRootPath, this.Src);
            var src  = this.Src;

            if (!string.IsNullOrEmpty(hash))
            {
                if (string.IsNullOrEmpty(this.Format))
                {
                    src = string.Format("{0}?hash={1}", this.Src, hash);
                }
                else
                {
                    src = this.Format;
                    src = src.Replace("{src}", this.Src);
                    src = src.Replace("{hash}", hash);
                }
            }
            output.Attributes.SetAttribute("src", src);
            output.Attributes.Remove(output.Attributes["hash"]);
        }
Пример #2
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var hash = HashUtility.Hash(this.Hosting.WebRootPath, this.Href);
            var href = this.Href;

            if (!string.IsNullOrEmpty(hash))
            {
                if (string.IsNullOrEmpty(this.Format))
                {
                    href = string.Format("{0}?hash={1}", this.Href, hash);
                }
                else
                {
                    href = this.Format;
                    href = href.Replace("{href}", this.Href);
                    href = href.Replace("{hash}", hash);
                }
            }
            output.Attributes.SetAttribute("href", href);
            output.Attributes.Remove(output.Attributes["hash"]);
        }