예제 #1
0
        string PasswordMailCheck(string bufs)
        {
            XenoCode a = new XenoCode();



            string[]       hh             = bufs.Split(new char[] { '!' });
            string         b              = hh[0];
            string         d              = a.decryption(b, login, selectedEmailAdress);
            PasswordWindow passwordWindow = new PasswordWindow();
            string         bufReplaceS    = hh[1];

            if (passwordWindow.ShowDialog() == true)
            {
                if (d == passwordWindow.Password)
                {
                    return(bufReplaceS);
                }

                else
                {
                    Decripter.IsChecked = false;
                    return("");
                }
            }
            else
            {
                Decripter.IsChecked = false;
                return("");
            }
        }
        private void Chng(object sender, EventArgs e)
        {
            if (IsEnc.IsToggled)
            {
                XenoCode a = new XenoCode();

                string[] words = Textlb.Text.Split(new char[] { ' ' });
                string   h     = words[1];
                for (int o = 3; o < h.Length; o = o + 4)
                {
                    h = h.Insert(o, " ");
                }
                string bufs = words[0] + " " + h;
                /////////////////////////
                string bufAdr = SupportClass.NumberCorrect(Adresslb.Text);
                try
                {
                    Textlb.Text = a.decryption(bufs + " &", PNumber, bufAdr);
                }
                catch
                {
                    IsEnc.IsToggled = false;
                }
            }
            else
            {
                Textlb.Text = textSms;
            }
        }
예제 #3
0
        private void Decripter_Checked(object sender, EventArgs e)
        {
            string       bufs      = new TextRange(TextMessag.Document.ContentStart, TextMessag.Document.ContentEnd).Text;
            FlowDocument document  = new FlowDocument();
            Paragraph    paragraph = new Paragraph();
            char         ch        = '!';

            var sss = Decripter.IsChecked;

            if (bufs.IndexOf(ch) == -1)
            {
                if (Convert.ToBoolean(Decripter.IsChecked))
                {
                    XenoCode a = new XenoCode();

                    paragraph.Inlines.Add(new Bold(new Run(a.decryption(bufs, login, selectedEmailAdress))));
                }
                else
                {
                    paragraph.Inlines.Add(new Bold(new Run(BufferMailText)));
                }


                document.Blocks.Add(paragraph);
                TextMessag.Document = document;
            }
            else
            {
                string bufsMail = PasswordMailCheck(bufs);
                if (bufsMail != "")
                {
                    if (Convert.ToBoolean(Decripter.IsChecked))
                    {
                        XenoCode a = new XenoCode();

                        paragraph.Inlines.Add(new Bold(new Run(a.decryption(bufsMail, login, selectedEmailAdress))));
                    }
                    else
                    {
                        paragraph.Inlines.Add(new Bold(new Run(BufferMailText)));
                    }
                    document.Blocks.Add(paragraph);
                    TextMessag.Document = document;
                }
            }
        }
예제 #4
0
        private void CheckMailPass_Checked(object sender, RoutedEventArgs e)
        {
            if ((Convert.ToBoolean(CheckMailPass.IsChecked)) && (Email.Text != ""))
            {
                PasswordWindow passwordWindow = new PasswordWindow();

                if (passwordWindow.ShowDialog() == true)
                {
                    XenoCode a = new XenoCode();
                    passEmail        = a.RSA_encryption(passwordWindow.Password, login, Email.Text) + "!";
                    Email.IsEnabled  = false;
                    ListV.Visibility = Visibility.Hidden;
                }
                else
                {
                    CheckMailPass.IsChecked = false;
                    Email.IsEnabled         = !false;
                }
            }
        }
예제 #5
0
        private void IsTg(object sender, EventArgs e)
        {
            if (IsEnc.IsToggled)
            {
                try
                {
                    XenoCode a = new XenoCode();
                    Textlb.Text = a.decryption(Textlb.Text, login, Adresslb.Text);
                }
                catch

                {
                    IsEnc.IsToggled = false;
                }
            }
            else
            {
                Textlb.Text = bufs;
            }
        }
        string sendEmail()
        {
            try
            {
                MailMessage mail = new MailMessage();

                string[]   words      = login.Split(new char[] { '@' });
                string     smtp       = "smtp." + words[1];
                SmtpClient SmtpServer = new SmtpClient(smtp);
                mail.From = new MailAddress(login);
                mail.To.Add(AdressEmail.Text);
                mail.Subject = HeaderEmail.Text;

                XenoCode a = new XenoCode();
                if (IsEnc.IsToggled)
                {
                    mail.Body = a.RSA_encryption(BodyEmail.Text, login, AdressEmail.Text) + "&";
                }
                else
                {
                    mail.Body = BodyEmail.Text;
                }
                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(login, pass);
                SmtpServer.EnableSsl   = true;
                ServicePointManager.ServerCertificateValidationCallback = delegate(object sender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
                {
                    return(true);
                };
                SmtpServer.Send(mail);
                BodyEmail.Text = AdressEmail.Text = HeaderEmail.Text = "";
                return("good");
            }
            catch (Exception ei)
            {
                DisplayAlert("Ошибка", "Не отправлено!", "ОK");
                return(ei.ToString());
            }
        }
        private void SendClik(object sender, EventArgs e)
        {
            if (checkNullString())
            {
                try
                {
                    string bufNumber = SupportClass.NumberCorrect(AdressEmail.Text);
                    if (IsEnc.IsToggled)
                    {
                        string bufs = "";

                        XenoCode a = new XenoCode();

                        bufs = a.RSA_encryption(BodyEmail.Text, PNumber, bufNumber);

                        ////////////////////////////////////////
                        string[] words  = bufs.Split(new char[] { ' ' });
                        string   header = words[0] + " ";
                        bufs = bufs.Replace(words[0], " ");
                        bufs = bufs.Replace(" ", "");
                        bufs = header + bufs;
                        DependencyService.Get <Interface>().Send(bufNumber, bufs);
                    }
                    else
                    {
                        DependencyService.Get <Interface>().Send(bufNumber, BodyEmail.Text);
                    }

                    BodyEmail.Text = AdressEmail.Text = "";
                }
                catch
                {
                    DisplayAlert("Ошибка", "Не отправлено!", "ОK");
                }
            }
        }
예제 #8
0
        private void SendB_Click(object sender, RoutedEventArgs e)
        {
            var textRange = new TextRange(TextMessag.Document.ContentStart, TextMessag.Document.ContentEnd);

            if ((Email.Text.Length > 0) && (textRange.Text.Length > 0) && (Header.Text.Length > 0))
            {
                MailAddress from = new MailAddress(login, "");
                // кому отправляем
                MailAddress to = new MailAddress(Email.Text);
                // создаем объект сообщения
                MailMessage m = new MailMessage(from, to);
                // тема письма
                m.Subject = Header.Text;

                if (Convert.ToBoolean(Encripter.IsChecked))
                {
                    XenoCode a = new XenoCode();

                    m.Body = passEmail + a.RSA_encryption(textRange.Text, login, Email.Text) + "&";
                }
                else

                {
                    m.Body = textRange.Text;
                }
                // адрес smtp-сервера и порт, с которого будем отправлять письмо
                string[]   words = login.Split(new char[] { '@' });
                string     smt   = "smtp." + words[1];
                SmtpClient smtp  = new SmtpClient(smt, 587);
                // логин и пароль
                smtp.Credentials = new NetworkCredential(login, pass);
                smtp.EnableSsl   = true;

                try
                {
                    smtp.Send(m);
                    FlowDocument document  = new FlowDocument();
                    Paragraph    paragraph = new Paragraph();
                    paragraph.Inlines.Add(new Bold(new Run("")));
                    document.Blocks.Add(paragraph);
                    TextMessag.Document = document;

                    if (Convert.ToBoolean(CheckSave.IsChecked))
                    {
                        GoToAddress WindowAddres = new GoToAddress();

                        if (WindowAddres.ShowDialog() == true)
                        {
                            AddressBook ad = new AddressBook(Email.Text, login, pass);
                            ad.Show();
                            CloseCheck = true;
                            this.Close();
                        }
                    }
                    Email.Text = Header.Text = "";
                }
                catch
                {
                    MessageBox.Show("Письмо не отправлено!", "Ошибка");
                }
            }
            else
            {
                MessageBox.Show("Не все поля заполнены!", "Внимание!");
            }
        }