public FormShowAudio(string dataFolderPath) { InitializeComponent(); path = dataFolderPath; string[] filePaths = null; if (Directory.Exists(dataFolderPath)) // Preenche dgv com arquivos do tipo .wav no diretório dado { filePaths = Directory.GetFiles(path, "*.WAV", SearchOption.AllDirectories); DGVManipulation.readStringListIntoDGV(filePaths, audioPathDataGridView); numberFiles.Text = audioPathDataGridView.RowCount.ToString(); } }
private void openAudioDirectory() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Multiselect = true; openFileDialog.Filter = "WAV Audio (*.WAV)|*.WAV"; try { if (openFileDialog.ShowDialog() == DialogResult.OK) { string[] fileNames = openFileDialog.FileNames; DGVManipulation.readStringListIntoDGV(fileNames, audioPathDataGridView); numberFiles.Text = audioPathDataGridView.RowCount.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void openFilesForEdition() { try { FormDefine defineFilePath = new FormDefine("Listas de Audio: ", path, "lst", "_audio", true); var result = defineFilePath.ShowDialog(); if (result == DialogResult.OK) { string dir = defineFilePath.ReturnValue; audioListNameTextBox.Text = dir.Remove(dir.Length - 6); // removes the _audio identification from file while editing (when its saved it is always added again) string[] filePaths = StroopProgram.readDirListFile(path + "/" + dir + ".lst"); DGVManipulation.readStringListIntoDGV(filePaths, audioPathDataGridView); numberFiles.Text = audioPathDataGridView.RowCount.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.dataGridView1.DataSource = null; this.dataGridView1.Rows.Clear(); string[] line; string[] filePaths = null; try { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); line = StroopProgram.readDataFile(path + "/" + comboBox1.SelectedItem.ToString() + ".txt"); if (line.Count() > 0) { for (int i = 0; i < line.Count(); i++) { string[] cellArray = line[i].Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); if (cellArray.Length == dataGridView1.Columns.Count) { dataGridView1.Rows.Add(cellArray); for (int j = 0; j < cellArray.Length; j++) { if (Regex.IsMatch(cellArray[j], hexPattern)) { dataGridView1.Rows[i].Cells[j].Style.BackColor = ColorTranslator.FromHtml(cellArray[j]); } } } } } if (Directory.Exists(path)) // Preenche dgv com arquivos do tipo .wav no diretório dado que possua o padrao da comboBox { audioPathDataGridView.Rows.Clear(); audioPathDataGridView.Refresh(); filePaths = Directory.GetFiles(path, "audio_" + comboBox1.SelectedItem.ToString() + "*", SearchOption.AllDirectories); DGVManipulation.readStringListIntoDGV(filePaths, audioPathDataGridView); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }