public void LoadFromFile(string fileName) { if (!File.Exists(fileName)) { throw new FileNotFoundException("Parameter file not found", fileName); } XElement docRoot = XElement.Load(fileName); ApplicationTitle = docRoot.Element("Version").Value; MergeResult = Convert.ToBoolean(docRoot.Element("MergeResult").Value); ConflictType = ResolveSearchEngineConflictTypeFactory.Find(docRoot.GetChildValue("ConflictType", ResolveSearchEngineConflictTypeFactory.DiscardAll.Name)); if (docRoot.Element("MinimumEngineAgreeCount") != null) { MinimumEngineAgreeCount = int.Parse(docRoot.Element("MinimumEngineAgreeCount").Value); } if (docRoot.Element("MergeResultFromSameEngineButDifferentSearchParameters") != null) { KeepTopPeptideFromSameEngineButDifferentSearchParameters = bool.Parse(docRoot.Element("MergeResultFromSameEngineButDifferentSearchParameters").Value); } if (docRoot.Element("PeptideRetrieval") != null) { PeptideRetrieval = bool.Parse(docRoot.Element("PeptideRetrieval").Value); } Database.Load(docRoot); FalseDiscoveryRate.Load(docRoot); Classification.Load(docRoot); PeptideFilter.Load(docRoot); try { DatasetList.Load(docRoot); DatasetList.ForEach(m => m.Parent = this); } catch (Exception ex) { MessageBox.Show("Load dataset error :" + ex.Message); } }
public XElement ToXml() { XElement docRoot = new XElement("BuildSummaryOption", new XElement("Version", ApplicationTitle), new XElement("MergeResult", MergeResult), new XElement("ConflictType", ConflictType), new XElement("MinimumEngineAgreeCount", MinimumEngineAgreeCount), new XElement("MergeResultFromSameEngineButDifferentSearchParameters", KeepTopPeptideFromSameEngineButDifferentSearchParameters), new XElement("PeptideRetrieval", PeptideRetrieval)); Database.Save(docRoot); FalseDiscoveryRate.Save(docRoot); Classification.Save(docRoot); PeptideFilter.Save(docRoot); DatasetList.Save(docRoot); return(docRoot); }