public void HandleStepExecuted( Step step ) { if ( step.parentScore == score ) { switch ( step.command ) { case "setdate": score.SetDate( step.date ); break; case "setlocation": score.SetLocation( ( Location ) step.target ); break; case "setsequence": score.SetSequence( ( Sequence ) step.target, step.atDate, step.autoStart ); break; case "settemperature": score.SetTemperature( float.Parse ( step.content ), step.units ); break; case "setweather": score.SetWeather( step.weather ); break; case "group": step.ExecuteSubsteps(); break; } } }
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 void HandleStepExecuted( Step step ) { if ( OnStepExecuted != null ) { OnStepExecuted( step ); } }
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 ); } }