public virtual List <IsobaricItem> ReadFromFile(string fileName) { var result = new List <IsobaricItem>(); var askedScanMode = GetScanMode(); var lowerScanMode = new HashSet <string>(from a in askedScanMode select a.ToLower()); RawReader.Open(fileName); try { FirstScan = RawReader.GetFirstSpectrumNumber(); EndScan = RawReader.GetLastSpectrumNumber(); DoAfterFileOpen(); var firstIsolationWidth = 0.0; var icount = 0; for (int scan = FirstScan; scan <= EndScan; scan++) { if (!RawReader.IsScanValid(scan)) { continue; } if (this.MsLevel == RawReader.GetMsLevel(scan)) { firstIsolationWidth = RawReader.GetIsolationWidth(scan); if (firstIsolationWidth > 0 && firstIsolationWidth < 5) { break; } icount++; if (icount > 10) { break; } } } if (firstIsolationWidth == 0.0) { firstIsolationWidth = defaultIsolationWidth; } Progress.SetMessage("Reading channel information ..."); Progress.SetRange(FirstScan, EndScan); for (int scan = FirstScan; scan <= EndScan; scan++) { if (Progress.IsCancellationPending()) { throw new UserTerminatedException(); } if (!RawReader.IsScanValid(scan)) { continue; } Progress.SetPosition(scan); if (this.MsLevel == RawReader.GetMsLevel(scan)) { string scanMode = RawReader.GetScanMode(scan).ToLower(); if (string.IsNullOrEmpty(scanMode)) { AppendScan(result, scan, "UNKNOWN", firstIsolationWidth); } else if (lowerScanMode.Count == 0 || lowerScanMode.Contains(scanMode)) { AppendScan(result, scan, scanMode.ToUpper(), firstIsolationWidth); } else { Console.WriteLine("Scan {0} is skipped with mode {1}", scan, scanMode); } } } } finally { RawReader.Close(); } return(result); }