using System; using System.Collections.Generic; using System.Linq; using System.Text; #if WIN32 using MSHTML; #else using mshtml; #endif using sharpknife.Utils; using System.Globalization; using sharpknife.Controls; using System.Drawing; using System.IO; using sharpknife.Data; using sharpknife.Commands; using sharpknife.Engines; namespace sharpknife.Strategies { class MyFreeSharesStrategy : Strategy { public override bool CheckLogin(WebBrowserControl browser, PTCSource source) { //WELCOME TO //MyFreeShares MEMBERS AREA ! string html = browser.Html; if (StringUtils.Contains(html, "Cannot modify header information")) { return true; } // IHTMLElementCollection elements = HtmlUtils.GetElementCollection(browser.Document, "input"); foreach (IHTMLElement element in elements) { IHTMLInputElement input = (IHTMLInputElement)element; if (input.value == "Sign up") { return true; } } return false; } public override void Login(WebBrowserControl browser, PTCSource source) { IHTMLElementCollection inputFields = HtmlUtils.GetElementCollection(browser.Document, "input"); foreach (IHTMLInputElement element in inputFields) { if (element.name == "user") { element.value = source.Username; } else if (element.name == "loza") { element.value = source.Password; } else if (element.name == "Submit2") { element.form.submit(); return; } } } public override decimal GetBalance(WebBrowserControl browser, PTCSource source) { string html = browser.Html; html = StringUtils.RemoveNewLines(html); html = StringUtils.RemoveQuotes(html); string value = StringUtils.GetTokens(html, "CURRENT {}BALANCE : {}