Ejemplo n.º 1
0
        public void Menu_Load(object sender, EventArgs e)
        {
            Shifr.raskl();
            Shifr.read();

            for (int i = 0; i < Config.names.Length; i++)
            {
                if (Config.names[i] == button_settings.Name)
                {
                    button_settings.Text = Config.names[i + 1];
                }
                if (Config.names[i] == Create.Name)
                {
                    Create.Text = Config.names[i + 1];
                }
                if (Config.names[i] == Get.Name)
                {
                    Get.Text = Config.names[i + 1];
                }
                if (Config.names[i] == Help.Name)
                {
                    Help.Text = Config.names[i + 1];
                }
                if (Config.names[i] == "error")
                {
                    Config.error = Config.names[i + 1];
                }
            }
        }
Ejemplo n.º 2
0
        public static void Overwhite()
        {
            String pas = File.ReadAllText("pas.txt");

            Config.vs = pas.Split(new char[] { ':', '\r', '\n', '|', }, StringSplitOptions.RemoveEmptyEntries);
            List <string> l = new List <string>();

            for (int i = 1; i <= Config.vs.Length; i++)
            {
                if (i % 3 == 0)
                {
                    Shifr.translate(Config.vs[i - 1]);
                    l.Add(Config.textdeshifr);
                    Config.textdeshifr = "";
                }
                else
                {
                    l.Add(Config.vs[i - 1]);
                }
            }
            File.WriteAllText("pas.txt", "");
            Shifr.raskl();
            StreamWriter f = new StreamWriter("pas.txt", true);

            for (int i = 1; i <= l.Count; i++)
            {
                if (i % 3 == 0)
                {
                    Shifr.doit(l[i - 1], Config.alf);
                    f.Write(l[i - 3] + ":" + l[i - 2] + ":" + Convert.ToString(Config.dif) + "+" + Config.textshifr + Environment.NewLine);
                    Config.textshifr = "";
                }
            }
            f.Close();
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        private void Get_Load(object sender, EventArgs e)
        {
            comboBox_site.Items.Clear();

            Shifr.raskl();
            Shifr.read();
            for (int i = 0; i < Config.names.Length; i++)
            {
                if (Config.names[i] == label_choose.Name)
                {
                    // label_choose.Text = " ";
                    label_choose.Text = Config.names[i + 1];
                }
                if (Config.names[i] == this.Name)
                {
                    this.Text = Config.names[i + 1];
                }
                if (Config.names[i] == label_password.Name)
                {
                    label_password.Text = Config.names[i + 1];
                }
                if (Config.names[i] == button_get.Name)
                {
                    button_get.Text = Config.names[i + 1];
                }
                if (Config.names[i] == label_name.Name)
                {
                    label_name.Text = Config.names[i + 1];
                }
            }


            String pas = File.ReadAllText("pas.txt");

            Config.vs = pas.Split(new char[] { ':', '\r', '\n', '|', }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < Config.vs.Length; i++)
            {
                if (i % 3 == 0)
                {
                    comboBox_site.Items.Add(Config.vs[i]);
                }
            }
        }
Ejemplo n.º 5
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");
                    }
                }
            }
        }