本文整理汇总了C#中XmlReader.GetAttributeInt64方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.GetAttributeInt64方法的具体用法?C# XmlReader.GetAttributeInt64怎么用?C# XmlReader.GetAttributeInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.GetAttributeInt64方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadRelease
protected Release ReadRelease(XmlReader reader)
{
reader.AssertElementStart(Keys.Release);
Release release = new Release();
release.JoinedAlbumArtists = reader.GetAttributeOrNull(Keys.JoinedAlbumArtists);
release.Title = reader.GetAttributeOrNull(Keys.Title);
release.ReleaseDate = ReleaseDate.Parse(reader.GetAttributeOrNull(Keys.ReleaseDate));
release.OriginalReleaseDate = ReleaseDate.Parse(reader.GetAttributeOrNull(Keys.OriginalReleaseDate));
release.CatalogNumber = reader.GetAttributeOrNull(Keys.CatalogNumber);
release.Label = reader.GetAttributeOrNull(Keys.Label);
release.Country = reader.GetAttributeOrNull(Keys.Country);
release.FlagMessage = reader.GetAttributeOrNull(Keys.FlagMessage);
release.IsFlagged = release.FlagMessage != null;
release.Notes = reader.GetAttributeOrNull(Keys.Notes);
release.WikipediaPageName = reader.GetAttributeOrNull(Keys.WikipediaPageName);
release.DiscogsReleaseId = reader.GetAttributeInt32(Keys.DiscogsReleaseId, 0);
release.DiscogsMasterId = reader.GetAttributeInt32(Keys.DiscogsMasterId, 0);
release.Genre = reader.GetAttributeOrNull(Keys.Genre);
release.Score = reader.GetAttributeInt32(Keys.Score, 0);
release.DynamicRange = reader.GetAttributeDouble(Keys.DynamicRange, double.NaN);
release.ReplayGainAlbumGain = reader.GetAttributeDouble(Keys.AlbumGain, double.NaN);
release.ReplayGainAlbumPeak = reader.GetAttributeDouble(Keys.AlbumPeak, double.NaN);
if (reader.GetAttributeOrNull(Keys.DateAdded) != null)
{
release.DateAdded = new DateTime(reader.GetAttributeInt64(Keys.DateAdded, 0));
}
if (reader.GetAttributeOrNull(Keys.DateAudioModified) != null)
{
release.DateAudioModified = new DateTime(reader.GetAttributeInt64(Keys.DateAudioModified, 0));
}
if (reader.GetAttributeOrNull(Keys.DateModified) != null)
{
release.DateModified = new DateTime(reader.GetAttributeInt64(Keys.DateModified, 0));
}
if (reader.IsEmptyElement)
{
throw new FormatException(InvalidXmlDatabase);
}
while (reader.Read())
{
if (reader.IsElementEnd(Keys.Release))
{
break;
}
if (reader.IsElementStart(Keys.Artists))
{
this.ReadArtists(reader, release);
}
else if (reader.IsElementStart(Keys.Tracks))
{
this.ReadTracks(reader, release);
}
else if (reader.IsElementStart(Keys.Images))
{
this.ReadImages(reader, release);
}
else if (reader.IsElementStart(Keys.AdditionalFiles))
{
this.ReadAdditionalFiles(reader, release);
}
}
return release;
}