public Step( XmlElement xml, Score score ) { int i, n; XmlNodeList elements; Step step; data = xml; command = data.Name.ToLower(); if ( data.Attributes.GetNamedItem( "itemRef" ) != null ) { itemRef = data.Attributes.GetNamedItem( "itemRef" ).InnerXml; } if ( data.Attributes.GetNamedItem( "delay" ) != null ) { delay = float.Parse( data.Attributes.GetNamedItem( "delay" ).InnerXml ) * .001f; } content = data.InnerText; parentScore = score; elements = xml.ChildNodes; n = elements.Count; substeps = new List<Step>(); for ( i = 0; i < n; i++ ) { if ( elements[ i ].NodeType == XmlNodeType.Element ) { step = new Step( ( XmlElement ) elements[ i ], parentScore ); substeps.Add( step ); } } ParseCommand(); }
public Sequence( string text, Score score ) { parentScore = score; usedIndexes = new List<int>(); id = "sequence" + parentScore.sequences.Length; repeat = true; string[] lines = text.Split( new string[] { "\r\n", "\n" }, StringSplitOptions.None ); int i; int n = lines.Length; string line; string lineLower; Step step; steps = new List<Step>(); for ( i = 0; i < n; i++ ) { line = lines[ i ]; lineLower = line.ToLower(); if ( !lineLower.StartsWith( "stepwise.title:" ) && !lineLower.StartsWith( "stepwise.credit:" ) && !lineLower.StartsWith( "stepwise.description:" ) ) { step = new Step( line, parentScore ); steps.Add ( step ); } } }
public Character( XmlElement xml, Score score ) { data = xml; parentScore = score; id = xml.Attributes.GetNamedItem( "id" ).InnerXml; firstName = xml.Attributes.GetNamedItem( "firstName" ).InnerXml; lastName = xml.Attributes.GetNamedItem( "lastName" ).InnerXml; fullName = firstName + (( lastName == "" ) ? "" : " " + lastName ); }
public Location( XmlElement xml, Score score ) { data = xml; parentScore = score; id = xml.Attributes.GetNamedItem( "id" ).InnerXml; latitude = float.Parse( xml.Attributes.GetNamedItem( "lat" ).InnerXml ); longitude = float.Parse( xml.Attributes.GetNamedItem( "lon" ).InnerXml ); name = xml.InnerText; }
public Step( string text, Score score ) { parentScore = score; command = "narrate"; content = text; tone = SpeechTone.NORMAL; delay = 0; substeps = new List<Step>(); ParseCommand(); }
public Sequence( XmlElement xml, Score score ) { int i, n; XmlNode attr; XmlNodeList elements; Step step; parentScore = score; attr = xml.Attributes.GetNamedItem( "id" ); if ( attr != null ) { id = attr.InnerXml; } else { id = "sequence" + parentScore.sequences.Length; } attr = xml.Attributes.GetNamedItem( "shuffle" ); if ( attr != null ) { shuffle = attr.InnerXml == "true" ? true : false; } attr = xml.Attributes.GetNamedItem( "repeat" ); if ( attr != null ) { repeat = true; if ( !int.TryParse( attr.InnerXml, out count ) ) { count = -1; // repeat infinitely } } usedIndexes = new List<int>(); elements = xml.ChildNodes; n = elements.Count; steps = new List<Step>(); for ( i = 0; i < n; i++ ) { step = new Step( ( XmlElement ) elements[ i ], parentScore ); steps.Add ( step ); } }
public virtual bool Load( string text ) { if ( text != null ) { if ( text.IndexOf( "<stepwise>" ) != -1 ) { xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml( text ); score = new Score( xmlDoc.DocumentElement ); score.Init(); } catch { return false; } } else { score = new Score( text ); } } else { return false; } return true; }