//Read Both Inputs and Show the Form If Inputs Aren't Blank private void Execute_btn_Click(object sender, System.EventArgs e) { var forms = GetOpenForms(); DisposeUnusedForms(forms); var allTextBoxes = Input_panel.Controls.OfType <TextBox>(); if (_inputHandler.IsValidInput(allTextBoxes)) { var fileName = TextFile_txtBox.Text; var dirPath = Directory_txtBox.Text; _songListManager.MasterSongList = _fileReader.Read(fileName); _songListManager.QuerySongList = _directoryReader.Read(dirPath); var dataSet = new DataSet(_songListManager, dirPath); _textFileTable = new TextFileTable_Form(dataSet); _queryTable = new QueryTable_form(dirPath, dataSet); _textFileTable.Show(); _queryTable.Show(); } else { var title = "Invalid!"; var message = "Please make sure 2 selections have been made"; MessageBox.Show(message, title, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void Read(string path) { var expression = new Regex("^KV"); var lines = File.ReadLines(path); foreach (var line in lines) { Match match = expression.Match(line); if (match.Success && !line.EndsWith("kmh")) { Song.songMasterList.Add(GetSong((Path.GetFileNameWithoutExtension(line)))); } } var dataTableForm = new TextFileTable_Form(); dataTableForm.Show(); }