예제 #1
0
 //constructor
 public HtaParser(HtaOptions htaops, String html, String baseUrl)
 {
     _html = html;
       _baseUrl = baseUrl;
       _hta.LoadHtml(_html);
       _HtaHeader(htaops);
       _HtaStyles(htaops);
       _HtaScripts(htaops);
       _FixUrls();
 }
예제 #2
0
        /// <summary>
        /// Adds Local Java and VB Scripts.
        /// This can allow you to add to the remote site.
        /// </summary>
        /// <param name="htaops"></param>
        private void _HtaScripts(HtaOptions htaops)
        {
            if (htaops.LocalJavaScript)
              {
            HtmlNode jscriptElement = _hta.CreateElement("script");
            jscriptElement.SetAttributeValue("id", "local");
            jscriptElement.SetAttributeValue("language", "Javascript");
            jscriptElement.SetAttributeValue("src", "scripts/main.js");
            HtmlNode headNode = _hta.DocumentNode.SelectSingleNode("//head");
            headNode.AppendChild(jscriptElement.Clone());
              }

              if (htaops.LocalVbScript)
              {
            HtmlNode vScriptElement = _hta.CreateElement("script");
            vScriptElement.SetAttributeValue("id", "local");
            vScriptElement.SetAttributeValue("language", "VBScript");
            vScriptElement.SetAttributeValue("src", "scripts/main.vbs");
            HtmlNode headNode = _hta.DocumentNode.SelectSingleNode("//head");
            headNode.AppendChild(vScriptElement.Clone());
              }
        }
예제 #3
0
        /// <summary>
        /// Links a local css Stylesheet.
        /// </summary>
        /// <param name="htaops"></param>
        private void _HtaStyles(HtaOptions htaops)
        {
            if (htaops.LocalStyleSheet)
              {
            HtmlNode styleElement = _hta.CreateElement("link");
            styleElement.SetAttributeValue("id", "local");
            styleElement.SetAttributeValue("rel", "stylesheet");
            styleElement.SetAttributeValue("type", "text/css");
            styleElement.SetAttributeValue("href", "styles/theme.css");
            HtmlNode headNode = _hta.DocumentNode.SelectSingleNode("//head");
            headNode.AppendChild(styleElement.Clone());

              }
        }
예제 #4
0
 /// <summary>
 /// Adds the local HTA:Application header and all the options.
 /// </summary>
 /// <param name="htaops"></param>
 private void _HtaHeader(HtaOptions htaops)
 {
     HtmlNode htaElement = _hta.CreateElement("HTA:APPLICATION");
       htaElement.SetAttributeValue("id", htaops.Id);
       htaElement.SetAttributeValue("AppName", htaops.AppName);
       htaElement.SetAttributeValue("border", htaops.Border);
       htaElement.SetAttributeValue("borderStyle", htaops.BorderStyle);
       htaElement.SetAttributeValue("showInTaskbar", htaops.ShowInTaskBar);
       htaElement.SetAttributeValue("sysMenu", htaops.SysMenu);
       //add hta tag to html string.
       HtmlNode headNode = _hta.DocumentNode.SelectSingleNode("//head");
       headNode.AppendChild(htaElement.Clone());
 }