private int GetMails(string source) { int count = 0; string g = getPageSource(source); if (string.IsNullOrEmpty(g)) { return(0); } long result = 0; Regex t = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"); foreach (Match m in t.Matches(g)) { if (ValidateMail(m.Value)) { string mail = ClearEmail(m.Value); CVMail f = dal.CVMails.SingleOrDefault(b => b.Mail == mail); if (f == null) { try { lock (this) { result = (long)lastID.LastID1; dal.CVMails.InsertOnSubmit(new CVMail { asdws = (result + 1), Date = DateTime.Now, Mail = mail }); lastID.LastID1++; dal.SubmitChanges(); MailsListSession.Add(mail); count++; } } catch (Exception) { } } } } return(count); }
private int GetMails(string source) { int count = 0; string g = getPageSource(source); if (string.IsNullOrEmpty(g)) { { return(0); } } long result = 0; Regex t = new Regex(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"); foreach (Match m in t.Matches(g)) { { if (ValidateMail(m.Value)) { { string mail = ClearEmail(m.Value); CVMail f = dal.CVMails.SingleOrDefault(b => b.Mail == mail); if (f == null) { { try { lock (this) { result = (long)lastID.LastID1; dal.CVMails.InsertOnSubmit(new CVMail { asdws = (result + 1), Date = DateTime.Now, Mail = mail }); lastID.LastID1++; dal.SubmitChanges(); MailsListSession.Add(mail); count++; } } catch (Exception) { } } } } } } } return(count); }