IHTMLElementCollection elements = HtmlUtils.GetElementCollection(browser.Document, "div");
foreach (IHTMLElement element in elements)
{
string html = element.outerHTML;
//
if (element.className == "item" && !StringUtils.Contains(html, "desc2"))
{
int duration = 30;
decimal value = 0m;
try
{
//$0.0010 USD
5 seconds
string[] tokens = StringUtils.GetTokens(StringUtils.RemoveQuotes(html), "{}${} USD{}{} seconds{}");
duration = int.Parse(tokens[3]);
value = 100 * decimal.Parse(tokens[1], CultureInfo.InvariantCulture.NumberFormat);
}
catch (Exception ex)
{
LogItem item = new LogItem(ex.ToString());
item.Save();
}
string link = StringUtils.GetTokens(StringUtils.RemoveQuotes(html), "{}{}")[1];
link = string.Format("{0}/{1}", source.BaseUrl, link);
link = link.Replace("&", "&");
Command command = new AdCommand(link, duration + 5, AdCommand.BonusValue.Cents, value, source.Name);
CommandEngine engine = CommandEngine.GetEngine();
engine.Commands.Add(command);
}
}
return false;
}
public override decimal GetReferrals(WebBrowserControl browser, PTCSource source)
{
throw new NotImplementedException();
}
}
}