/// <summary> /// Gets the named attribute /// </summary> /// <returns>An empty string is returned if a matching attribute is not found or if the attribute does not have a specified or default value.</returns> public string GetAttribute(string attributeName) { if (_xmlElement == null) { return(_geckoElement.GetAttribute(attributeName)); } else { return(_xmlElement.GetAttribute(attributeName)); } }
private int getEpisodeNumber(GeckoHtmlElement element) { string title = element.GetAttribute("href"); var reg = Regex.Match(title, "([Ss]([0-9][0-9])[Ee]([0-9][0-9]))"); if (!reg.Success) { reg = Regex.Match(title, @"(\d+)[x]([0-9][0-9])"); } return(int.Parse(reg.Groups[3].Value)); }
/// <summary> /// An example event handler for the DomClick event. /// Prevents a link click from navigating. /// </summary> private void StopLinksNavigating(object sender, DomEventArgs e) { if (sender == null) { return; } if (e == null) { return; } if (e.Target == null) { return; } var element = e.Target.CastToGeckoElement(); GeckoHtmlElement clicked = element as GeckoHtmlElement; if (clicked == null) { return; } // prevent clicking on Links from navigation to the if (clicked.TagName == "A") { e.Handled = true; MessageBox.Show(sender as IWin32Window, String.Format("You clicked on Link {0}", clicked.GetAttribute("href"))); } }