Login Register






[C#] FB Friend Adder! filter_list
Author
Message
RE: [C#] FB Friend Adder! #7
(02-28-2013, 03:46 AM)Cyber-Savage Wrote: Did you make this? Because I don't see any credits.

It's only 2 methods of code, how hard could it have been? :huh:

...

Code:
private void button_Click_1(object sender, EventArgs e) { webBrowser1.ScriptErrorsSuppressed = true; webBrowser1.Navigate("https://www.facebook.com/find-friends/browser/"); webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted; } void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { for (int i = 0; i < 700; i++) { if (webBrowser1.Document.All[i].Id != null) if (webBrowser1.Document.All[i].Id.StartsWith("u_")) webBrowser1.Document.All[i].InvokeMember("click"); } System.Threading.Thread.Sleep(10000); webBrowser1.Navigate("https://www.facebook.com/find-friends/browser/"); }

On every button click you are adding the handler to the DocumentCompleted event method? Why...

Your loop:
Code:
for (int i = 0; i < 700; i++) { if (webBrowser1.Document.All[i].Id != null) if (webBrowser1.Document.All[i].Id.StartsWith("u_")) webBrowser1.Document.All[i].InvokeMember("click"); }

I think it's safe to say that as soon as we find an ID that doesn't exist we won't find another after that, so why not place a break; in here at that time to avoid unnecessary checks to all the rest of the iterations? The issue here is that you're using 700 as a constant value as well hardcoded into the program. Why not make it dynamic? Check the number of values you can find?

I don't use fb though so I can't say. I'm assuming it's in sequential ascending order though for each of the results on that search page.

Code:
System.Threading.Thread.Sleep(10000); webBrowser1.Navigate("https://www.facebook.com/find-friends/browser/");

Absolute worst thing you can do... Very abusive way of using Thread.Sleep().
-- cxS

[ Haskell/.NET/C/C++ - Software Engineer ]

Reply





Messages In This Thread
[C#] FB Friend Adder! - by The High Roller - 02-28-2013, 03:35 AM
RE: [C#] FB Friend Adder! - by The High Roller - 02-28-2013, 03:38 AM
RE: [C#] FB Friend Adder! - by The High Roller - 02-28-2013, 03:42 AM
RE: [C#] FB Friend Adder! - by Bannedshee - 02-28-2013, 03:46 AM
RE: [C#] FB Friend Adder! - by cxS - 02-28-2013, 08:05 AM
RE: [C#] FB Friend Adder! - by Bannedshee - 03-01-2013, 07:58 PM
RE: [C#] FB Friend Adder! - by cxS - 03-01-2013, 08:11 PM
RE: [C#] FB Friend Adder! - by Prestige - 02-28-2013, 03:59 PM
RE: [C#] FB Friend Adder! - by cxS - 03-01-2013, 08:29 AM
RE: [C#] FB Friend Adder! - by Prestige - 03-02-2013, 07:55 PM
RE: [C#] FB Friend Adder! - by cxS - 03-02-2013, 09:25 PM
RE: [C#] FB Friend Adder! - by Bannedshee - 03-02-2013, 09:29 PM
RE: [C#] FB Friend Adder! - by cxS - 03-03-2013, 04:28 AM
RE: [C#] FB Friend Adder! - by Bannedshee - 03-03-2013, 05:04 AM
RE: [C#] FB Friend Adder! - by Balls - 03-02-2013, 11:22 PM
RE: [C#] FB Friend Adder! - by Prestige - 03-06-2013, 08:04 PM