本文整理汇总了C#中System.Xml.XmlNode.IterateChildren方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.IterateChildren方法的具体用法?C# XmlNode.IterateChildren怎么用?C# XmlNode.IterateChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlNode
的用法示例。
在下文中一共展示了XmlNode.IterateChildren方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseMasterTrackNode
//
// <MasterTrack>...</MasterTrack>
//
private void ParseMasterTrackNode(XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Automations":
ParseAutomations(c);
break;
case "Tracks":
_tracksMapping = GetValue(c).Split(' ');
break;
}
}
});
}
示例2: ParseNoteProperties
private void ParseNoteProperties(XmlNode node, Note note, string noteId)
{
bool isBended = false;
BendPoint bendOrigin = null;
int? bendMiddleValue = null;
int? bendMiddleOffset1 = null;
int? bendMiddleOffset2 = null;
BendPoint bendDestination = null;
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
XmlElement e = (XmlElement) c;
switch (c.LocalName)
{
case "Property":
var name = e.Attributes["name"].Value;
switch (name)
{
case "String":
note.String = Std.ParseInt(GetValue(FindChildElement(c, "String"))) + 1;
break;
case "Fret":
note.Fret = Std.ParseInt(GetValue(FindChildElement(c, "Fret")));
break;
case "Tapped":
_tappedNotes[noteId] = true;
break;
case "HarmonicType":
var htype = FindChildElement(c, "HType");
if (htype != null)
{
switch (GetValue(htype))
{
case "NoHarmonic":
note.HarmonicType = HarmonicType.None;
break;
case "Natural":
note.HarmonicType = HarmonicType.Natural;
break;
case "Artificial":
note.HarmonicType = HarmonicType.Artificial;
break;
case "Pinch":
note.HarmonicType = HarmonicType.Pinch;
break;
case "Tap":
note.HarmonicType = HarmonicType.Tap;
break;
case "Semi":
note.HarmonicType = HarmonicType.Semi;
break;
case "Feedback":
note.HarmonicType = HarmonicType.Feedback;
break;
}
}
break;
case "HarmonicFret":
var hfret = FindChildElement(c, "HFret");
if (hfret != null)
{
note.HarmonicValue = Std.ParseFloat(GetValue(hfret));
}
break;
// case "Muted":
case "PalmMuted":
if (FindChildElement(c, "Enable") != null)
note.IsPalmMute = true;
break;
// case "Element":
// case "Variation":
// case "Tone":
case "Octave":
note.Octave = Std.ParseInt(GetValue(FindChildElement(c, "Number"))) - 1;
break;
case "Tone":
note.Tone = Std.ParseInt(GetValue(FindChildElement(c, "Step")));
break;
case "Bended":
isBended = true;
break;
case "BendOriginValue":
if (bendOrigin == null) bendOrigin = new BendPoint();
bendOrigin.Value = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointValueFactor);
break;
case "BendOriginOffset":
if (bendOrigin == null) bendOrigin = new BendPoint();
bendOrigin.Offset = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointPositionFactor);
break;
case "BendMiddleValue":
bendMiddleValue = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointValueFactor);
break;
case "BendMiddleOffset1":
bendMiddleOffset1 = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointPositionFactor);
break;
//.........这里部分代码省略.........
示例3: ParseMasterBar
private void ParseMasterBar(XmlNode node)
{
var masterBar = new MasterBar();
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
XmlElement e = (XmlElement) c;
switch (c.LocalName)
{
case "Time":
var timeParts = GetValue(c).Split('/');
masterBar.TimeSignatureNumerator = Std.ParseInt(timeParts[0]);
masterBar.TimeSignatureDenominator = Std.ParseInt(timeParts[1]);
break;
case "DoubleBar":
masterBar.IsDoubleBar = true;
break;
case "Section":
masterBar.Section = new Section();
masterBar.Section.Marker = GetValue(FindChildElement(c, "Letter"));
masterBar.Section.Text = GetValue(FindChildElement(c, "Text"));
break;
case "Repeat":
if (e.Attributes["start"].Value.ToLower() == "true")
{
masterBar.IsRepeatStart = true;
}
if (e.Attributes["end"].Value.ToLower() == "true" && e.Attributes["count"].Value != null)
{
masterBar.RepeatCount = Std.ParseInt(e.Attributes["count"].Value);
}
break;
// TODO case "Directions": // Coda segno etc.
case "AlternateEndings":
var alternateEndings = GetValue(c).Split(' ');
var i = 0;
for (int k = 0; k < alternateEndings.Length; k++)
{
i |= 1 << (-1 + Std.ParseInt(alternateEndings[i]));
}
masterBar.AlternateEndings = (byte)i;
break;
case "Bars":
_barsOfMasterBar.Add(GetValue(c).Split(' '));
break;
case "TripletFeel":
switch (GetValue(c))
{
case "NoTripletFeel":
masterBar.TripletFeel = TripletFeel.NoTripletFeel;
break;
case "Triplet8th":
masterBar.TripletFeel = TripletFeel.Triplet8th;
break;
case "Triplet16th":
masterBar.TripletFeel = TripletFeel.Triplet16th;
break;
case "Dotted8th":
masterBar.TripletFeel = TripletFeel.Dotted8th;
break;
case "Dotted16th":
masterBar.TripletFeel = TripletFeel.Dotted16th;
break;
case "Scottish8th":
masterBar.TripletFeel = TripletFeel.Scottish8th;
break;
case "Scottish16th":
masterBar.TripletFeel = TripletFeel.Scottish16th;
break;
}
break;
case "Key":
masterBar.KeySignature = Std.ParseInt(GetValue(FindChildElement(c, "AccidentalCount")));
break;
}
}
});
_masterBars.Add(masterBar);
}
示例4: ParseMasterBarsNode
//
// <MasterBars>...</MasterBars>
//
private void ParseMasterBarsNode(XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "MasterBar":
ParseMasterBar(c);
break;
}
}
});
}
示例5: ParseBeatProperties
private void ParseBeatProperties(XmlNode node, Beat beat)
{
bool isWhammy = false;
BendPoint whammyOrigin = null;
int? whammyMiddleValue = null;
int? whammyMiddleOffset1 = null;
int? whammyMiddleOffset2 = null;
BendPoint whammyDestination = null;
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
XmlElement e = (XmlElement) c;
switch (c.LocalName)
{
case "Property":
var name = e.Attributes["name"].Value;
switch (name)
{
case "Brush":
if (GetValue(FindChildElement(c, "Direction")) == "Up")
{
beat.BrushType = BrushType.BrushUp;
}
else
{
beat.BrushType = BrushType.BrushDown;
}
break;
// TODO: brush duration
case "PickStroke":
if (GetValue(FindChildElement(c, "Direction")) == "Up")
{
beat.PickStroke = PickStrokeType.Up;
}
else
{
beat.PickStroke = PickStrokeType.Down;
}
break;
// TODO: brush duration
case "Slapped":
if (FindChildElement(c, "Enable") != null)
beat.Slap = true;
break;
case "Popped":
if (FindChildElement(c, "Enable") != null)
beat.Pop = true;
break;
case "VibratoWTremBar":
switch (GetValue(FindChildElement(c, "Strength")))
{
case "Wide":
beat.Vibrato = VibratoType.Wide;
break;
case "Slight":
beat.Vibrato = VibratoType.Slight;
break;
}
break;
case "WhammyBar":
isWhammy = true;
break;
case "WhammyBarExtend":
case "WhammyBarOriginValue":
if (whammyOrigin == null) whammyOrigin = new BendPoint();
whammyOrigin.Value =
(int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointValueFactor);
break;
case "WhammyBarOriginOffset":
if (whammyOrigin == null) whammyOrigin = new BendPoint();
whammyOrigin.Offset =
(int)
(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointPositionFactor);
break;
case "WhammyBarMiddleValue":
whammyMiddleValue = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointValueFactor);
break;
case "WhammyBarMiddleOffset1":
whammyMiddleOffset1 = (int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointPositionFactor);
break;
case "WhammyBarMiddleOffset2":
whammyMiddleOffset2 = (int) (Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointPositionFactor);
break;
case "WhammyBarDestinationValue":
if (whammyDestination == null)
whammyDestination = new BendPoint(BendPoint.MaxPosition);
whammyDestination.Value =
(int)(Std.ParseFloat(GetValue(FindChildElement(c, "Float"))) * BendPointValueFactor);
break;
case "WhammyBarDestinationOffset":
if (whammyDestination == null) whammyDestination = new BendPoint();
whammyDestination.Offset =
(int)
//.........这里部分代码省略.........
示例6: ParseBeats
//
// <Beats>...</Beats>
//
private void ParseBeats(XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Beat":
ParseBeat((XmlElement)c);
break;
}
}
});
}
示例7: ParseAutomations
private void ParseAutomations(XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Automation":
ParseAutomation(c);
break;
}
}
});
}
示例8: ParseAutomation
private void ParseAutomation(XmlNode node)
{
string type = null;
bool isLinear = false;
string barId = null;
float ratioPosition = 0;
float value = 0;
int reference = 0;
string text = null;
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Type":
type = GetValue(c);
break;
case "Linear":
isLinear = GetValue(c).ToLower() == "true";
break;
case "Bar":
barId = GetValue(c);
break;
case "Position":
ratioPosition = Std.ParseFloat(GetValue(c));
break;
case "Value":
var parts = GetValue(c).Split(' ');
value = Std.ParseFloat(parts[0]);
reference = Std.ParseInt(parts[1]);
break;
case "Text":
text = GetValue(c);
break;
}
}
});
if (type == null) return;
Automation automation = null;
switch (type)
{
case "Tempo":
automation = Automation.BuildTempoAutomation(isLinear, ratioPosition, value, reference);
break;
// TODO: other automations
}
if (automation != null)
{
automation.Text = text;
}
if (barId != null)
{
if (!_automations.ContainsKey(barId))
{
_automations[barId] = new FastList<Automation>();
}
_automations[barId].Add(automation);
}
}
示例9: ParseTracksNode
//
// <Tracks>...</Tracks>
//
private void ParseTracksNode(XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Track":
ParseTrack((XmlElement)c);
break;
}
}
});
}
示例10: ParseTrackProperties
private void ParseTrackProperties(Track track, XmlNode node)
{
node.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Property":
ParseTrackProperty(track, (XmlElement)c);
break;
}
}
});
}
示例11: ParseScoreNode
//
// <Score>...</Score>
//
private void ParseScoreNode(XmlNode element)
{
element.IterateChildren(c =>
{
if (c.NodeType == XmlNodeType.Element)
{
switch (c.LocalName)
{
case "Title":
Score.Title = GetValue(c.FirstChild);
break;
case "SubTitle":
Score.SubTitle = GetValue(c.FirstChild);
break;
case "Artist":
Score.Artist = GetValue(c.FirstChild);
break;
case "Album":
Score.Album = GetValue(c.FirstChild);
break;
case "Words":
Score.Words = GetValue(c.FirstChild);
break;
case "Music":
Score.Music = GetValue(c.FirstChild);
break;
case "WordsAndMusic":
if (c.FirstChild != null && c.FirstChild.ToString() != "")
{
Score.Words = GetValue(c.FirstChild);
Score.Music = GetValue(c.FirstChild);
}
break;
case "Copyright":
Score.Copyright = GetValue(c.FirstChild);
break;
case "Tabber":
Score.Tab = GetValue(c.FirstChild);
break;
}
}
});
}