private void SetupData() { isSetupsucces = false; DateFormat = DateTime.Now.ToString("dd-mm-yyy hh-mm"); TempdataSave = Application.StartupPath + "\\data\\temp\\" + "temp_fbdata_" + DateFormat + ".txt"; string[] CookiesFile = File.ReadAllLines(txtcookiefile.Text); string c*k = ""; foreach (string cookie in CookiesFile) { c*k = cookie; if (c*k.Contains("useragent=")) { c*k = Regex.Replace(cookie, "useragent=([a-zA-Z0-9]{100,300})", ""); } Facebook facebook = new Facebook(); facebook.Cookie = c*k; string FacebookIdentifyCodeStatus = facebook.FacebookIdentifyCode(); if (FacebookIdentifyCodeStatus == "die" || FacebookIdentifyCodeStatus == "error") { goto END_W; } string FacebookTokenStatus = ""; if (cbbtypetoken.SelectedIndex != 1) { FacebookTokenStatus = facebook.FacebookTokenNormal(); } else { FacebookTokenStatus = facebook.FacebookTokenBussine(); } if (FacebookTokenStatus == "die" || FacebookTokenStatus == "error") { goto END_W; } string FacebookIdPageStatus = facebook.FacebookPageid(); if (FacebookIdPageStatus == "die" || FacebookIdPageStatus == "not_a_page" || FacebookIdPageStatus == "error") { goto END_W; } foreach (string Idpage in facebook.Listidpage) { string ContentSave = facebook.Token + DataSeperator + cookie + DataSeperator + Idpage + DataSeperator + facebook.fb_dtsg + DataSeperator + facebook.jazoest + DataSeperator + facebook.fb_av + DataSeperator + facebook.fb_eav; File.AppendAllText(TempdataSave, ContentSave + "\r\n"); } END_W :; } if (!File.Exists(TempdataSave)) { isSetupsucces = false; AppExtension.MessageBoxShow("lỗi setup ! có thể toàn bộ cookie đã die hoặc không thể lấy data...", 3); return; } else { int CountData = Convert.ToInt32(File.ReadAllLines(TempdataSave).Length); int CountEmail = Convert.ToInt32(File.ReadAllLines(txtemail.Text).Length); if (CountEmail >= 50) { if (CountData <= 1) { isSetupsucces = false; AppExtension.MessageBoxShow("dữ liệu facebook quá ít ! nhỏ hơn 1, nên không thể chạy ! vui lòng thêm cookie...", 3); return; } } } isSetupsucces = true; btnstart.PerformClick(); }
private void GetInfoFacebook(string emmail, int row) { string subemail = emmail; if (emmail.Contains(":")) { subemail = emmail.Split(':')[0].ToString(); } int trycount = 0; int trycountcp = 0; try { startcheck: AppExtension appExtension = new AppExtension(); string datafromrandom = appExtension.RandomData(TempdataSave); string Token = datafromrandom.Split('|')[0].ToString(); string Cookie = datafromrandom.Split('|')[1].ToString(); string Idpage = datafromrandom.Split('|')[2].ToString(); string fb_dtg = datafromrandom.Split('|')[3].ToString(); string jazoet = datafromrandom.Split('|')[4].ToString(); string fb_av = datafromrandom.Split('|')[5].ToString(); string fbeav = datafromrandom.Split('|')[6].ToString(); Facebook facebook = new Facebook(); if (onlyuid.Checked) { facebook.isonlyuid = true; } facebook.Token = Token; facebook.Cookie = Cookie; facebook.IdPage = Idpage; facebook.Email = subemail; facebook.fb_dtsg = fb_dtg; facebook.jazoest = jazoet; facebook.Uidclone = fb_av; facebook.fb_eav = fbeav; facebook.FaceBookInfomation(); if (facebook.FbName == "not_id") { SaveFile(PathError, emmail); appExtension.LoadGrid(row, emmail, dtgrvdata); FailCount += 1; UpdateCount(); } else if (facebook.FbName == "error") { trycount += 1; if (trycount >= 3) { SaveFile(PathError, emmail); appExtension.LoadGrid(row, emmail, dtgrvdata); FailCount += 1; UpdateCount(); return; } goto startcheck; } else if (facebook.FbName == "checkpoint") { try { trycountcp += 1; if (trycountcp >= 3) { SaveFile(PathError, emmail); appExtension.LoadGrid(row, emmail, dtgrvdata); FailCount += 1; UpdateCount(); SaveFile("checkpointcookie.txt", Cookie); //File.AppendAllText("checkpointcookie.txt", Cookie + "\r\n"); return; } goto startcheck; } catch { } } else { SaveFile(PathSuccess, emmail + DataSeperator + facebook.ID + DataSeperator + facebook.FbName + DataSeperator + facebook.BirthDay + DataSeperator + facebook.HomeTown + DataSeperator + facebook.Friend_Count + DataSeperator + facebook.Follow_Count + DataSeperator + facebook.CreatedDay + DataSeperator + facebook.LatsOnline); appExtension.LoadGridSuccess(facebook, row, emmail, dtgrvdata); successCount += 1; UpdateCount(); } CheckedCount += 1; UpdateCount(); } catch { } }