Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Created July 9, 2013 10:35
Show Gist options
  • Save AlexArchive/5956398 to your computer and use it in GitHub Desktop.
Save AlexArchive/5956398 to your computer and use it in GitHub Desktop.
Old School Runescape Client Without HTML Menu
internal sealed class RunescapeClient : WebBrowser
{
private const string RUNESCAPE_CLIENT_URL = "http://oldschool33.runescape.com/j1";
internal RunescapeClient()
{
ScrollBarsEnabled = false;
ScriptErrorsSuppressed = true;
IsWebBrowserContextMenuEnabled = false;
AllowWebBrowserDrop = false;
Navigate(RUNESCAPE_CLIENT_URL);
}
protected override void OnDocumentCompleted(WebBrowserDocumentCompletedEventArgs e)
{
if (Document != null && ValidClientUrl(e.Url.ToString()))
{
HtmlElement tableElement = Document.GetElementsByTagName("table")[1];
tableElement.InnerText = string.Empty;
}
}
private static bool ValidClientUrl(string url)
{
return Regex.IsMatch(url, @"http://oldschool\d{1,2}.runescape.com/j1");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment