bool bad = false;
HtmlElementCollection heCol = instance.ActiveTab.FindElementsByAttribute("div", "class", "caption gs_result_i", "regexp");
for (int j=0; j<heCol.Count; j++)
{
bad = false;
var he = heCol.GetByNumber(j).FindChildByAttribute("a", "class", "gs_result_i_t_name o", "regexp", 0);
string href = he.GetAttribute("href");
var sourceList = project.Lists["Blacklist"];
lock (SyncObjects.ListSyncer)
{
for (int i=0; i < sourceList.Count; i++)
{
var str = sourceList[i];
if (str.Contains(href)) {bad = true; break;}
}
}
if (!bad);
{
try {heCol.GetByNumber(j).FindChildByAttribute("span", "InnerText", "Добавить в друзья", "regexp", 0).RiseEvent("click","Full"); sourceList.Add(href);return"ok"; }
catch (Exception) {}
}
}