本文整理汇总了C#中IXmlNode.GetElementsByTagName方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlNode.GetElementsByTagName方法的具体用法?C# IXmlNode.GetElementsByTagName怎么用?C# IXmlNode.GetElementsByTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmlNode
的用法示例。
在下文中一共展示了IXmlNode.GetElementsByTagName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseNoteBeat
private bool ParseNoteBeat(IXmlNode element, Track track, Bar bar, bool chord, bool isFirstBeat)
{
int voiceIndex = 0;
var voiceNodes = element.GetElementsByTagName("voice");
if (voiceNodes.Length > 0)
{
voiceIndex = Std.ParseInt(Std.GetNodeValue(voiceNodes[0])) - 1;
}
Beat beat;
var voice = GetOrCreateVoice(bar, voiceIndex);
if (chord || (isFirstBeat && voice.Beats.Count == 1))
{
beat = voice.Beats[voice.Beats.Count - 1];
}
else
{
beat = new Beat();
voice.AddBeat(beat);
}
var note = new Note();
beat.AddNote(note);
beat.IsEmpty = false;
element.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "grace":
//var slash = e.GetAttribute("slash");
//var makeTime = Std.ParseInt(e.GetAttribute("make-time"));
//var stealTimePrevious = Std.ParseInt(e.GetAttribute("steal-time-previous"));
//var stealTimeFollowing = Std.ParseInt(e.GetAttribute("steal-time-following"));
beat.GraceType = GraceType.BeforeBeat;
beat.Duration = Duration.ThirtySecond;
break;
case "duration":
beat.Duration = (Duration)Std.ParseInt(Std.GetNodeValue(c));
break;
case "tie":
ParseTied(c, note);
break;
case "cue":
// not supported
break;
case "instrument":
// not supported
break;
case "type":
switch (Std.GetNodeValue(c))
{
case "256th":
beat.Duration = Duration.TwoHundredFiftySixth;
break;
case "128th":
beat.Duration = Duration.OneHundredTwentyEighth;
break;
case "breve":
beat.Duration = Duration.DoubleWhole;
break;
case "long":
beat.Duration = Duration.QuadrupleWhole;
break;
case "64th":
beat.Duration = Duration.SixtyFourth;
break;
case "32nd":
beat.Duration = Duration.ThirtySecond;
break;
case "16th":
beat.Duration = Duration.Sixteenth;
break;
case "eighth":
beat.Duration = Duration.Eighth;
break;
case "quarter":
beat.Duration = Duration.Quarter;
break;
case "half":
beat.Duration = Duration.Half;
break;
case "whole":
beat.Duration = Duration.Whole;
break;
}
break;
case "dot":
note.IsStaccato = true;
break;
case "accidental":
ParseAccidental(c, note);
break;
case "time-modification":
ParseTimeModification(c, beat);
break;
case "stem":
// not supported
//.........这里部分代码省略.........