private void DataConvert(object sender, EventArgs e) { if (string.IsNullOrEmpty(dataSourceEntry.Text) || string.IsNullOrEmpty(newFileNameEntry.Text) || string.IsNullOrEmpty(outputPathEntry.Text) || string.IsNullOrEmpty(PropertiesToAddEntry.Text)) { ShowMessage("Missing fields, please make sure all data fields are filled in..."); } try { FileCrud fileCrud = new FileCrud(); string data = fileCrud.DataSourceReader(dataSourceEntry.Text); string[] split = Regex.Split(PropertiesToAddEntry.Text, ","); string header = fileCrud.BuildHeader(PropertiesToAddEntry.Text, split); string tsvdata = string.Empty; tsvdata += header; tsvdata += fileCrud.BuildFile(data, split); bool success = fileCrud.WriteDataToTSV(outputPathEntry.Text, newFileNameEntry.Text, tsvdata); if (success) { ShowMessage("Success! new file created."); } else { ShowMessage("Failed to create new file. Please try again"); } } catch (Exception ex) { Console.WriteLine(ex); ShowMessage("Error: something has gone very wrong, please try again. Ensure all fields are filled in properly, and with proper spelling."); } }
private void StartConverting(object sender, EventArgs e) { DataViewEntry.Text = msgs[0]; FileCrud.AutomatedLearning(msgs); }