本文整理汇总了C#中XmlReader.GetEnumAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.GetEnumAttribute方法的具体用法?C# XmlReader.GetEnumAttribute怎么用?C# XmlReader.GetEnumAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.GetEnumAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadXml
public void ReadXml(XmlReader reader)
{
// Read tag attributes
MonoisotopicMass = reader.GetNullableDoubleAttribute(ATTR.massdiff_monoisotopic) ?? 0;
AverageMass = reader.GetNullableDoubleAttribute(ATTR.massdiff_average) ?? 0;
Formula = reader.GetAttribute(ATTR.formula);
Inclusion = reader.GetEnumAttribute(ATTR.inclusion, LossInclusion.Library);
// Consume tag
reader.Read();
Validate();
}
示例2: ReadXml
public override void ReadXml(XmlReader reader)
{
// Read tag attributes
base.ReadXml(reader);
string aas = reader.GetAttribute(ATTR.aminoacid);
if (!string.IsNullOrEmpty(aas))
{
AAs = aas;
// Support v0.1 format.
if (AAs[0] == '\0') // Not L10N
AAs = null;
}
Terminus = reader.GetAttribute(ATTR.terminus, ToModTerminus);
IsVariable = IsExplicit = reader.GetBoolAttribute(ATTR.variable);
Formula = reader.GetAttribute(ATTR.formula);
if (reader.GetBoolAttribute(ATTR.label_13C))
LabelAtoms |= LabelAtoms.C13;
if (reader.GetBoolAttribute(ATTR.label_15N))
LabelAtoms |= LabelAtoms.N15;
if (reader.GetBoolAttribute(ATTR.label_18O))
LabelAtoms |= LabelAtoms.O18;
if (reader.GetBoolAttribute(ATTR.label_2H))
LabelAtoms |= LabelAtoms.H2;
RelativeRT = reader.GetEnumAttribute(ATTR.relative_rt, RelativeRT.Matching);
// Allow specific masses always, but they will generate an error,
// in Validate() if there is already a formula.
MonoisotopicMass = reader.GetNullableDoubleAttribute(ATTR.massdiff_monoisotopic);
AverageMass = reader.GetNullableDoubleAttribute(ATTR.massdiff_average);
if (!IsVariable)
IsExplicit = reader.GetBoolAttribute(ATTR.explicit_decl);
UnimodId = reader.GetNullableIntAttribute(ATTR.unimod_id);
// Backward compatibility with early code that assigned -1 to some custom modifications
if (UnimodId.HasValue && UnimodId.Value == -1)
UnimodId = null;
ShortName = reader.GetAttribute(ATTR.short_name);
// Consume tag
reader.Read();
var listLosses = new List<FragmentLoss>();
reader.ReadElements(listLosses);
if (listLosses.Count > 0)
{
Losses = listLosses.ToArray();
reader.ReadEndElement();
}
Validate();
}
示例3: ReadXml
public void ReadXml(XmlReader reader)
{
Pick = reader.GetEnumAttribute(ATTR.pick, PeptidePick.library);
PeptideCount = reader.GetNullableIntAttribute(ATTR.peptide_count);
HasDocumentLibrary = reader.GetBoolAttribute(ATTR.document_library);
_rankIdName = reader.GetAttribute(ATTR.rank_type);
var list = new List<XmlNamedElement>();
// Consume tag
if (reader.IsEmptyElement)
reader.Read();
else
{
reader.ReadStartElement();
// Read child elements
IXmlElementHelper<Library> helperLib;
IXmlElementHelper<LibrarySpec> helperSpec = null;
while ((helperLib = reader.FindHelper(LIBRARY_HELPERS)) != null ||
(helperSpec = reader.FindHelper(LIBRARY_SPEC_HELPERS)) != null)
{
if (helperLib != null)
list.Add(helperLib.Deserialize(reader));
else
list.Add(helperSpec.Deserialize(reader));
}
reader.ReadEndElement();
}
var libraries = new Library[list.Count];
var librarySpecs = new LibrarySpec[list.Count];
for (int i = 0; i < list.Count; i++)
{
var library = list[i] as Library;
if (library != null)
libraries[i] = library;
else
librarySpecs[i] = (LibrarySpec) list[i];
}
Libraries = libraries;
LibrarySpecs = librarySpecs;
DoValidate();
}