public MPCReportFile(string fileName) { ReportFileName = fileName; string[] allLines = File.ReadAllLines(fileName); Header = new MPCObsHeader(allLines); ObsLines.Clear(); int strippedLines = 0; foreach(string line in allLines) { if (line.Length > 3 && (ObsLines.Count > 0 || HEADER_TOKENS.IndexOf(line.Substring(0, 3)) == -1)) { // Parse observation line MPCObsLine obsLine = MPCObsLine.Parse(line); if (obsLine != null) ObsLines.Add(obsLine); else strippedLines++; } } if (strippedLines > 0) MessageBox.Show(string.Format("{0} lines could not be parsed are have been stripped from the file.", strippedLines), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
public MPCReportFile(string fileName, MPCObsHeader header) { ReportFileName = fileName; Header = header; }
private void btnOK_Click(object sender, EventArgs e) { if (MessageBox.Show( this, "Tangra does not perform a validation on the MPC report header. Please make sure it is correctly formatted before submitting a report. Press 'Help' for more information.", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) return; TangraConfig.Settings.Astrometry.MPCHeader.COD = tbxCOD.Text; TangraConfig.Settings.Astrometry.MPCHeader.CON = tbxCON.Text; TangraConfig.Settings.Astrometry.MPCHeader.OBS = tbxOBS.Text; TangraConfig.Settings.Astrometry.MPCHeader.MEA = tbxMEA.Text; TangraConfig.Settings.Astrometry.MPCHeader.TEL = tbxTEL.Text; TangraConfig.Settings.Astrometry.MPCHeader.CON2 = tbxCon2.Text; TangraConfig.Settings.Astrometry.MPCHeader.AC2 = tbxAck2.Text; if (m_Mode == MPCHeaderSettingsMode.NewMPCReport) { Header = new MPCObsHeader(TangraConfig.Settings.Astrometry.MPCHeader); Header.ACK = tbxAck.Text; Header.COM = tbxCom.Text; } DialogResult = DialogResult.OK; Close(); }