Ejemplo n.º 1
0
        private void openFilesForEdition()
        {
            FormDefine defineFilePath = new FormDefine(LocRM.GetString("audioList", currentCulture), FileManipulation._listFolderName, "dir", "_audio", true, false);
            var        result         = defineFilePath.ShowDialog();

            if (result == DialogResult.OK)
            {
                isListNameValid = true;
                string choosenList = defineFilePath.ReturnValue;

                if (choosenList == "")
                {
                    isListNameValid = false;
                    return;
                }
                // removes the _audio identification from file while editing (when its saved it is always added again)
                audioListNameTextBox.Text = choosenList;

                audioList = new StrList(choosenList, AUDIO);

                string[] filePaths = audioList.ListContent.ToArray();
                DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView);
                numberFiles.Text = audioPathDataGridView.RowCount.ToString();
            }
        }
Ejemplo n.º 2
0
 private void loadingAudioFilesToDataGrid()
 {
     if (Directory.Exists(path)) // Preenche dgv com arquivos do tipo .wav no diretório dado
     {
         audioPathDataGridView.Rows.Clear();
         audioPathDataGridView.Refresh();
         currenFolderLabel.Text = path;
         string[] filePaths = null;
         filePaths = Directory.GetFiles(path, "*.WAV", SearchOption.AllDirectories);
         DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView);
         numberFiles.Text = audioPathDataGridView.RowCount.ToString();
     }
     else
     {
         /*path doesnt exist*/
     }
 }
 private void loadingAudioFilesToDataGrid()
 {
     // Fills data grid view with .wav files from data directory
     if (Directory.Exists(path))
     {
         audioPathDataGridView.Rows.Clear();
         audioPathDataGridView.Refresh();
         currenFolderLabel.Text = path;
         string[] filePaths = null;
         filePaths = Directory.GetFiles(path, "*.WAV", SearchOption.AllDirectories);
         DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView);
         numberFiles.Text = audioPathDataGridView.RowCount.ToString();
     }
     else
     {
         /*path doesnt exist*/
     }
 }
Ejemplo n.º 4
0
        private void loadingAudioFilesToDataGrid()
        {
            string[] audioFiles = FileManipulation.GetAllFilesInFolder(path, "WAV");
            // Fills data grid view with .wav files from data directory
            if (audioFiles.Length != 0)
            {
                audioPathDataGridView.Rows.Clear();
                audioPathDataGridView.Refresh();
                currenFolderLabel.Text = path;

                DGVManipulation.ReadStringListIntoDGV(audioFiles, audioPathDataGridView);
                numberFiles.Text = audioPathDataGridView.RowCount.ToString();
            }
            else
            {
                /*path doesnt exist*/
            }
        }
Ejemplo n.º 5
0
        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
                {
                    if (audioPathDataGridView.RowCount > 0)
                    {
                        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); }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        private void openFilesForEdition()
        {
            try
            {
                FormDefine defineFilePath = new FormDefine("Listas de Audio: ", Global.testFilesPath + Global.listFolderName, "lst", "_audio", true);
                var        result         = defineFilePath.ShowDialog();

                if (result == DialogResult.OK)
                {
                    string choosenList = defineFilePath.ReturnValue;
                    audioListNameTextBox.Text = choosenList.Remove(choosenList.Length - 6); // removes the _audio identification from file while editing (when its saved it is always added again)

                    string[] filePaths = StroopProgram.readDirListFile(Global.testFilesPath + Global.listFolderName + "/" + choosenList + ".lst");
                    DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView);
                    numberFiles.Text = audioPathDataGridView.RowCount.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 8
0
        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 + "/" + resultComboBox.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 = 5; j < cellArray.Length; j++)
                            {
                                if (Validations.isHexPattern(cellArray[j]))
                                {
                                    dataGridView1.Rows[i].Cells[j].Style.BackColor = ColorTranslator.FromHtml(cellArray[j]);
                                }
                            }
                        }
                        else if (cellArray.Length == (dataGridView1.ColumnCount - 1))
                        {
                            var index = line[i].IndexOf("\t");
                            if (index >= 0)
                            {
                                line[i] = line[i].Insert(index + "\t".Length, "-\t");
                            }
                            cellArray = line[i].Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
                            dataGridView1.Rows.Add(cellArray);
                            for (int j = 5; j < cellArray.Length; j++)
                            {
                                if (Validations.isHexPattern(cellArray[j]))
                                {
                                    dataGridView1.Rows[i].Cells[j].Style.BackColor = ColorTranslator.FromHtml(cellArray[j]);
                                }
                            }
                        }
                    }
                }
                // fills audio data grid view with .wav files in directory in case there are any matching the patter on combobox
                if (Directory.Exists(path))
                {
                    if (audioPathDataGridView.RowCount > 0)
                    {
                        audioPathDataGridView.Rows.Clear();
                        audioPathDataGridView.Refresh();
                    }

                    filePaths = Directory.GetFiles(path, "audio_" + resultComboBox.SelectedItem.ToString() + "*", SearchOption.AllDirectories);
                    DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }