Пример #1
0
        private void changeName_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count < 1)
            {
                return;
            }

            int    id       = Int32.Parse(dataGridView1.SelectedRows[0].Cells[0].Value.ToString());
            int    index    = dataGridView1.SelectedRows[0].Index;
            string pathName = LabelPath.Text + $"\\{id}\\Text.txt";
            string name     = File.ReadAllText(pathName);

            try
            {
                name = Librari.DeShifrovka(name, Key);
            }
            catch (Exception)
            {
                Librari.MessadgeToConsole(Console, "failed to decrypt Name");
            }

            EnterString enter = new EnterString(name);

            if (enter.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            File.WriteAllText(pathName, Librari.Shifrovka(enter.GetName, Key));
            dataGridView1[1, index].Value = enter.GetName;
        }
Пример #2
0
        public ImportCompositions(string PathFolder, string Key, string NameFolderKeys)
        {
            InitializeComponent();
            this.PathFolder = PathFolder;
            this.Key        = Key;
            nameFolderKeys  = NameFolderKeys;
            Concole.Items.Add("Importer have been runed");
            var folders = Directory.GetDirectories(PathFolder);

            Concole.Items.Add("folder have been finded");
            foreach (var folder in folders)
            {
                try {
                    string Name        = new StreamReader(folder + "\\Text.txt").ReadToEnd();
                    var    NumberPhoto = Directory.GetFiles(folder, "*jpg", SearchOption.TopDirectoryOnly);
                    dataGridView1.Rows.Add(
                        folder.Split('\\').Last(),
                        Librari.DeShifrovka(Name, Key),
                        false,
                        NumberPhoto.Length,
                        new Bitmap(NumberPhoto.First()),
                        new StreamReader(folder + $"\\{nameFolderKeys}\\0Key.txt").ReadToEnd()
                        );
                }
                catch (Exception)
                {
                    Concole.Items.Add($"failed to get into the folder \"{folder.Split('\\').Last()}\"");
                    continue;
                }
            }
        }
Пример #3
0
 private void toolStripButtonTranslate_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         string text = "";
         try
         {
             text = row.Cells[1].Value.ToString();
             row.Cells[1].Value = Librari.DeShifrovka(text, Key);
         }
         catch (Exception)
         {
             Librari.MessadgeToConsole(Console, $"failed to decipher \"{text}\"");
         }
     }
 }