/// <summary> /// Export to a transition list to a file or to memory. /// </summary> /// <param name="fileName">A file on disk to export to, or null to export to memory.</param> public void Export(string fileName) { bool single = (Strategy == ExportStrategy.Single); RequiredPeptides = GetRequiredPeptides(single); if (MaxTransitions.HasValue && RequiredPeptides.TransitionCount > MaxTransitions) { throw new IOException(string.Format(Resources.AbstractMassListExporter_Export_The_number_of_required_transitions__0__exceeds_the_maximum__1__, RequiredPeptides.TransitionCount, MaxTransitions)); } using (var fileIterator = new FileIterator(fileName, single, IsPrecursorLimited, WriteHeaders)) { MemoryOutput = fileIterator.MemoryOutput; fileIterator.Init(); if (MethodType != ExportMethodType.Standard && Strategy == ExportStrategy.Buckets) { ExportScheduledBuckets(fileIterator); } else { ExportNormal(fileIterator, single); } fileIterator.Commit(); } }