Пример #1
0
        private void button_add_Click(object sender, EventArgs e)
        {
            char [] elem = textBox1.Text.ToCharArray();
            bool    est  = false;

            for (int i = 0; i < Config.alf.Length; i++)
            {
                for (int u = 0; u < elem.Length; u++)
                {
                    if (elem[u] == Config.alf[i])
                    {
                        est = true;
                        MessageBox.Show(Config.It_is);
                        break;
                    }


                    else if (elem[u] == '+' || elem[u] == '"' || elem[u] == ':' || elem[u] == '|')
                    {
                        if (Config.rus_lang)
                        {
                            MessageBox.Show("Это служебный символ");
                        }
                        else
                        {
                            MessageBox.Show("This is a service symbol");
                        }
                        est = true;
                        break;
                    }
                }
            }
            if (!est)
            {
                StreamWriter f = new StreamWriter("Resours\\alfeng.txt", true);
                for (int i = 0; i < elem.Length; i++)
                {
                    f.WriteLine(elem[i]);
                }

                MessageBox.Show("Ok!");
                f.Close();

                Shifr.Overwhite();
                see();
                Shifr.raskl();

                New_element_Load(sender, e);
            }
        }
Пример #2
0
        private void button_delete_Click(object sender, EventArgs e)
        {
            bool est = false;

            char[] elem = textBox1.Text.ToCharArray();
            for (int u = 0; u < elem.Length; u++)
            {
                for (int i = 0; i < Config.alf.Length; i++)
                {
                    if (elem[u] == Config.alf[i])
                    {
                        Config.alf[i] = '\n';
                        est           = true;
                    }



                    else if (elem[u] == '+' || elem[u] == '"' || elem[u] == ':' || elem[u] == '|')
                    {
                        if (Config.rus_lang)
                        {
                            MessageBox.Show("Это служебный символ");
                        }
                        else
                        {
                            MessageBox.Show("This is a service symbol");
                        }
                        est = false;
                        break;
                    }
                }
                if (est)
                {
                    File.WriteAllText("Resours\\alfeng.txt", "");
                    StreamWriter f = new StreamWriter("Resours\\alfeng.txt", true);
                    for (int y = 0; y < Config.alf.Length; y++)
                    {
                        f.WriteLine(Config.alf[y]);
                    }

                    MessageBox.Show("Ok!");
                    f.Close();

                    Shifr.Overwhite();
                    see();
                    Shifr.raskl();

                    New_element_Load(sender, e);
                }
                else
                {
                    if (Config.rus_lang)
                    {
                        MessageBox.Show("Такого символа нет");
                    }
                    else
                    {
                        MessageBox.Show("It is not had this symbol");
                    }
                }
            }
        }