예제 #1
0
        public void Init(IValueProvider valueProvider, IPathProvider pathProvider)
        {
            var needAttr = htmlElement.htmlAttribute()
                           .ToDictionary(
                key => key.htmlAttributeName().TAG_NAME().GetText().ToUpper(),
                value => new HtmlAttributeManager(value).Value
                );

            if (needAttr["REL"]?.ToUpper() != "STYLESHEET")
            {
                return;
            }

            var fileName = needAttr["HREF"];

            if (fileName == null)
            {
                return;
            }

            string path = pathProvider.GetPathFile(fileName);

            File = valueProvider.GetFile(path);
            if (File == null)
            {
                return;
            }

            htmlElement.AddChild(new BufferValueContext <File>(htmlElement, File));
        }