public JiraCredentialsForm(string settingsFilePath, Main_Form org) { this.org = org; this.settingsFilePath = settingsFilePath; InitializeComponent(); try { using (StreamReader reader = new StreamReader(settingsFilePath)) { reader.ReadLine(); userNameTxtBox.Text = reader.ReadLine().Substring(10); passwordTxtBox.Text = reader.ReadLine().Substring(10); } } catch { MessageBox.Show("An error occurred while attempting to open settings.txt"); Close(); } }
public CrtBugForm(string selectedDateDirectoryStr, bool updatingBug) { this.selectedDateDirectoryStr = selectedDateDirectoryStr; this.updatingBug = updatingBug; InitializeComponent(); if (updatingBug) { originalSummaryStr = Main_Form.getSingleton().bugsCreatedDataGridView.SelectedCells[0].OwningRow.Cells[1].Value.ToString(); sumTxtBox.Text = originalSummaryStr; fileNamePathStr = originalSummaryStr; foreach (char c in Path.GetInvalidFileNameChars()) { if (originalSummaryStr.Contains(c.ToString())) { fileNamePathStr = originalSummaryStr.Replace(c, '\''); } } try { using (StreamReader reader = File.OpenText(this.selectedDateDirectoryStr + "Bugs\\" + fileNamePathStr + ".txt")) { string firstLine = reader.ReadLine(); originalStepsStr = reader.ReadToEnd(); stepsTxtBox.Text = originalStepsStr; stepsBoxTextSet = true; } } catch { MessageBox.Show("An error occurred while loading the selected bug."); Close(); return; } } ShowDialog(); }