public ISpectrum GetSpectrum(int scanNum) { try { if (reader.GetMSnOrder(scanNum) == 1) { GeneralSpectrum spectrum = new GeneralSpectrum(1, scanNum); List <IPeak> peaks = reader.Read(scanNum); spectrum.SetPeaks(peaks); return(spectrum); } else { int msOrder = reader.GetMSnOrder(scanNum); TypeOfMSActivation type = reader.GetActivation(scanNum); double[] mzCharge = reader.GetParentMZCharge(scanNum); ISpectrum spectrum = new GeneralSpectrumMSn(msOrder, scanNum, type, mzCharge[0], (int)mzCharge[1]); List <IPeak> peaks = reader.Read(scanNum); spectrum.SetPeaks(peaks); return(spectrum); } } catch (Exception e) { Console.WriteLine(e.Message); return(null); } }