/// <summary> /// Read MSB Data File /// </summary> /// <param name="filepath">MSB file Path</param> /// <returns></returns> public int ReadMSBData(string filepath) { string folder = Path.GetDirectoryName(filepath); string fileName = Path.GetFileName(filepath); var pred = new Predicate <SelSpectrum>(x => (x.Folder == folder && x.FileName == fileName)); int find = _selSpectrum.FindIndex(pred); if (find >= 0) { return(-1); } FileFactoryWrapper factory = FileFactoryWrapper.getInstance(); SampleSetWrapper set = factory.openFile(filepath); if (set == null) { return(-1); } for (int num = 0; num < set.getNumberOfSamples(); num++) { FileData _tmpFileNameData = new FileData(num + 1, folder, fileName); SampleWrapper sample = set.getSample((uint)num); sample.openSample(); Debug.WriteLine(sample.getSampleSet().getFileName()); DataGroupNodeWrapper root = sample.getRootDataGroupNode(); List <ReadSpectrumData> listReadSpec = new List <ReadSpectrumData>(); List <uint> DescendantList = new List <uint>(); ReadSpectrum(root, 0, 0, ref listReadSpec, DescendantList); for (uint n = 0; n < listReadSpec.Count; n++) { SpectrumWrapper spec = listReadSpec[(int)n].Spec; string precursor = ""; if (spec.getMsStage() == 1) { precursor = "-----"; } else if (spec.getMsStage() == 2) { precursor = spec.getPrecursor().ToString(); } else { precursor = "\"" + spec.getPrecursor(1).ToString(); for (int pcnt = 2; pcnt < spec.getMsStage(); pcnt++) { precursor += ("," + spec.getPrecursor(pcnt).ToString()); } precursor += "\""; } SelSpectrum selSpec = new SelSpectrum(num + 1, folder, fileName, spec.getName(), spec.getRt().ToString(), precursor, n, listReadSpec[(int)n].DescendantList, listReadSpec[(int)n].Descendant, listReadSpec[(int)n].ChildNum, listReadSpec[(int)n].SpecNum); selSpec.TotalSpecNum = n; _selSpectrum.Add(selSpec); SpectrumData tmpSpectrumNameData = new SpectrumData(); tmpSpectrumNameData.SpectrumName = spec.getName(); tmpSpectrumNameData.RT = spec.getRt(); if (spec.getMsStage() == 1) { tmpSpectrumNameData.Precusor = "-----"; } else if (spec.getMsStage() == 2) { tmpSpectrumNameData.Precusor = spec.getPrecursor().ToString(); } else { tmpSpectrumNameData.Precusor = "\"" + spec.getPrecursor(1).ToString();; for (int pcnt = 2; pcnt < spec.getMsStage(); pcnt++) { tmpSpectrumNameData.Precusor = tmpSpectrumNameData.Precusor + "," + spec.getPrecursor(pcnt).ToString(); } tmpSpectrumNameData.Precusor = tmpSpectrumNameData.Precusor + "\""; } _tmpFileNameData.SpectrumNameDataList.Add(tmpSpectrumNameData); _tmpFileNameData.SpectrumNameList.Add(spec.getName()); } _fileNameDataList.Add(_tmpFileNameData); _bindFileName.Add("[" + _tmpFileNameData.SampleTabNo.ToString() + "] " + _tmpFileNameData.FileName); _bindFileNameLastRow.Insert(_bindFileNameLastRow.Count - 1, "[" + _tmpFileNameData.SampleTabNo.ToString() + "] " + _tmpFileNameData.FileName); } factory.closeFile(set); return(0); }