protected override void DoWritePeakList(IRawFile rawFile, PeakList <Peak> pkl, string rawFileName, List <string> result)
        {
            sw.Flush();
            scanIndeies.Add(new Pair <int, long>(pkl.ScanTimes[0].Scan, sw.BaseStream.Position));

            int scan          = pkl.ScanTimes[0].Scan;
            var retentionTime = pkl.ScanTimes[0].RetentionTime;

            var activationMethod = string.Empty;

            var intent = GetScanIntent(pkl.MsLevel);

            if (rawFile is RawFileImpl)
            {
                var impl = rawFile as RawFileImpl;

                var rcf = new RawScanFilter();
                rcf.Filter       = impl.GetFilterForScanNum(scan);
                activationMethod = rcf.ActivationMethod.ToUpper();

                /* scan header info begin */
                int    numPakets         = 0;
                double RT                = 0;
                double lowMass           = 0;
                double highMass          = 0;
                double TIC               = 0;
                double basePeakMass      = 0;
                double basePeakIntensity = 0;
                int    channel           = 0;
                int    uniformTime       = 0;
                double frequency         = 0;

                impl.GetScanHeaderInfoForScanNum(
                    scan,
                    ref numPakets,
                    ref RT,
                    ref lowMass,
                    ref highMass,
                    ref TIC,
                    ref basePeakMass,
                    ref basePeakIntensity,
                    ref channel,
                    ref uniformTime,
                    ref frequency);

                lowMass  = pkl.First().Mz;
                highMass = pkl.Last().Mz;

                sw.Write(MyConvert.Format(intent + "<scan num=\"{0}\"" + lf
                                          + intent + " msLevel=\"{1}\"" + lf
                                          + intent + " peaksCount=\"{2}\"" + lf
                                          + intent + " polarity=\"{3}\"" + lf
                                          + intent + " scanType=\"{4}\"" + lf
                                          + intent + " filterLine=\"{5}\"" + lf
                                          + intent + " retentionTime=\"PT{6:G6}S\"" + lf,
                                          scan,
                                          rcf.MsLevel,
                                          pkl.Count,
                                          rcf.Polarity,
                                          rcf.ScanType,
                                          rcf.Filter,
                                          retentionTime * 60));

                sw.Write(MyConvert.Format(intent + " lowMz=\"{0:G6}\"" + lf
                                          + intent + " highMz=\"{1:G6}\"" + lf
                                          + intent + " basePeakMz=\"{2:G6}\"" + lf
                                          + intent + " basePeakIntensity=\"{3:e5}\"" + lf
                                          + intent + " totIonCurrent=\"{4:e5}\" >" + lf,
                                          lowMass,
                                          highMass,
                                          basePeakMass,
                                          basePeakIntensity,
                                          TIC));

                if (rcf.MsLevel > 1)
                {
                    sw.Write(intent + " collisionEnergy=\"{0:0}\"" + lf, rcf.CollisionEnergy);
                }

                pkl.PrecursorIntensity = impl.GetPrecursorPeak(scan).Intensity;
            }
            else
            {
                sw.Write(MyConvert.Format(intent + "<scan num=\"{0}\"" + lf
                                          + intent + " msLevel=\"{1}\"" + lf
                                          + intent + " peaksCount=\"{2}\"" + lf
                                          + intent + " scanType=\"{3}\"" + lf
                                          + intent + " retentionTime=\"PT{4:G8}S\"" + lf,
                                          scan,
                                          pkl.MsLevel,
                                          pkl.Count,
                                          pkl.ScanMode,
                                          retentionTime * 60));

                var basePeak = pkl.FindMaxIntensityPeak();
                var TIC      = pkl.Sum(m => m.Intensity);

                sw.Write(MyConvert.Format(intent + " lowMz=\"{0:0}\"" + lf
                                          + intent + " highMz=\"{1:0}\"" + lf
                                          + intent + " basePeakMz=\"{2:G6}\"" + lf
                                          + intent + " basePeakIntensity=\"{3:e5}\"" + lf
                                          + intent + " totIonCurrent=\"{4:e5}\" >" + lf,
                                          pkl.First().Mz,
                                          pkl.Last().Mz,
                                          basePeak.Mz,
                                          basePeak.Intensity,
                                          TIC));
            }

            if (pkl.MsLevel > 1)
            {
                sw.Write(MyConvert.Format(intent + " <precursorMz precursorIntensity=\"{0:0.#####}\"", pkl.PrecursorIntensity));

                if (!string.IsNullOrEmpty(activationMethod))
                {
                    sw.Write(" activationMethod=\"{0}\"", activationMethod);
                }
                if (pkl.PrecursorCharge > 0)
                {
                    sw.Write(" precursorCharge=\"{0}\"", pkl.PrecursorCharge);
                }

                sw.Write(" >");
                sw.Write(MyConvert.Format("{0:0.######}</precursorMz>" + lf, pkl.PrecursorMZ));
            }
            /* scan header info end */

            /* peak list info begin */
            sw.WriteLine(intent + " <peaks precision=\"32\"");
            sw.WriteLine(intent + "  byteOrder=\"network\"");
            sw.WriteLine(intent + "  contentType=\"m/z-int\"");
            sw.WriteLine(intent + "  compressionType=\"none\"");
            sw.WriteLine(intent + "  compressedLen=\"0\" >" + MzxmlHelper.PeakListToBase64(pkl) + "</peaks>");
            /* peak list info end */
        }