Example #1
0
        protected void buildLogger()
        {
            string       s;
            StreamReader sr;
            bool         foundPath = false;

            string st = System.Windows.Forms.Application.StartupPath;

            if (File.Exists(st + @"\logFile.dat"))
            {
                sr = new StreamReader(st + @"\logFile.dat");
                while (sr.Peek() > -1)
                {
                    s = sr.ReadLine();
                    if (s.IndexOf("HomeRangeLogPath") == 0)
                    {
                        fw        = FileWriter.FileWriter.getHomeRangeLogger(s.Substring(s.IndexOf(" ")));
                        foundPath = true;
                        break;
                    }
                }
                sr.Close();
            }
            if (!foundPath)
            {
                fw = new FileWriter.EmptyFileWriter();
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            List <Person> contactBook = new List <Person>();

            contactBook.Add(new Person("Oleg", "Vysotskiy", "*****@*****.**", "0672200521"));
            contactBook.Add(new Person("Lera", "Vysotska", "*****@*****.**", "0672200521"));
            var email = from em in contactBook select em.Email;

            MailAddress from = new MailAddress("*****@*****.**", "Oleg");

            SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);

            smtp.Credentials = new NetworkCredential("vysotskiyod", "19051985");
            smtp.EnableSsl   = true;

            foreach (var i in email)
            {
                ISender sender = new ConsoleSender();
                sender.Send("Some message " + i);

                var         sender2 = new EmailSender.EmailSender();
                MailAddress to      = new MailAddress(i);
                MailMessage m       = new MailMessage(from, to);
                m.Subject = "Тест";

                sender2.SetEmailProviderInfo(m, smtp);
                string wrMess;
                wrMess = Console.ReadLine();
                sender2.Send(wrMess);

                FileWriter.FileWriter fwm = new FileWriter.FileWriter();
                fwm.Send(wrMess);
            }


            Console.ReadLine();
        }