示例#1
0
        public void AddMail(AddMailToList addMailToList)
        {
            try
            {
                using (var client = new ImapClient())
                {
                    GetMailSuffix getMailSuffix = new GetMailSuffix();
                    string        IMapAddress   = "imap." + getMailSuffix.GetSuffix(addMailToList.mail.Text);
                    client.ServerCertificateValidationCallback = (s, c, h, z) => true;
                    client.Connect(IMapAddress, 993, true);
                    client.Authenticate(addMailToList.mail.Text, addMailToList.password.Password);
                    client.Disconnect(true);

                    List <string> TMail     = new List <string>(); TMail.Add(addMailToList.mail.Text);
                    List <string> TPassword = new List <string>(); TPassword.Add(addMailToList.password.Password);

                    File.AppendAllLines("C:/KursachMailClient/" + addMailToList.Login + "/Boxes.txt", TMail);
                    File.AppendAllLines("C:/KursachMailClient/" + addMailToList.Login + "/Data.txt", TPassword);

                    ChooseMail CM = new ChooseMail(File.ReadAllText(@"/user.txt"));
                    CM.Show();

                    addMailToList.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#2
0
 public static void Load(ChooseMail chooseMail, string Login)
 {
     if (File.Exists("C:/KursachMailClient/" + Login + "/Boxes.txt") == true)
     {
         var Mails = File.ReadLines("C:/KursachMailClient/" + Login + "/Boxes.txt").ToList();
         for (int i = 0; i < Mails.Count; i++)
         {
             chooseMail.MSList.Items.Add(new LetterConstruction {
                 Name = Mails[i]
             });
         }
     }
 }
示例#3
0
        public static void CheckLettersData(ChooseMail chooseMail, string Login)
        {
            List <string> Boxes = new List <string> {
                "Входящие", "Исходящие", "Спам", "Корзина"
            };
            var Mails = File.ReadLines("C:/KursachMailClient/" + Login + "/Boxes.txt").ToList();

            foreach (string _box in Boxes)
            {
                if (!Directory.Exists("C:/KursachMailClient/" + Login + "/" + Convert.ToString(Mails[chooseMail.MSList.SelectedIndex]) +
                                      "/" + _box + "/Письма"))
                {
                    Directory.CreateDirectory("C:/KursachMailClient/" + Login + "/" + Convert.ToString(Mails[chooseMail.MSList.SelectedIndex]) +
                                              "/" + _box + "/Письма");
                }
                if (!File.Exists("C:/KursachMailClient/" + Login + "/" + Mails[chooseMail.MSList.SelectedIndex] + "/" + _box + "/ID.txt"))
                {
                    File.Create("C:/KursachMailClient/" + Login + "/" + Mails[chooseMail.MSList.SelectedIndex] + "/" + _box + "/ID.txt");
                }
            }
        }
示例#4
0
        public void Enter(StartWindow startWindow, string path)
        {
            string prKey  = File.ReadAllText(path + startWindow.mail.Text + "/Private.txt");
            Crypto crypto = new Crypto();

            if (!Directory.Exists(path + startWindow.mail.Text))
            {
                MessageBox.Show("Аккаунт не существует");
            }
            else
            {
                if (startWindow.password.Password == crypto.Decrypt(File.ReadAllText(path + startWindow.mail.Text + "/PFile.txt"), prKey))
                {
                    File.WriteAllText(@"/user.txt", startWindow.mail.Text);
                    ChooseMail chooseMail = new ChooseMail(startWindow.mail.Text);
                    chooseMail.Show();
                    startWindow.Close();
                }
                else
                {
                    MessageBox.Show("Данные ведены неверно");
                }
            }
        }
示例#5
0
        public static void Chip(ChooseMail chooseMail, string Login)
        {
            var Mails = File.ReadLines("C:/KursachMailClient/" + Login + "/Boxes.txt").ToList();

            File.WriteAllText(@"/temp.txt", Convert.ToString(Convert.ToString(Mails[chooseMail.MSList.SelectedIndex])));
        }