internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { ChangeGhostEffect = new XmlFormula(xRoot, XmlConstants.ChangeGhostEffect); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { TimesToRepeat = new XmlFormula(xRoot, XmlConstants.TimesToRepeat); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Size = new XmlFormula(xRoot, XmlConstants.SizeChange); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Volume = new XmlFormula(xRoot, XmlConstants.Volume); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { ChangeBrightness = new XmlFormula(xRoot, XmlConstants.ChangeBrightness); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { XPosition = new XmlFormula(xRoot, XmlConstants.XPosition); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Degrees = new XmlFormula(xRoot, XmlConstants.TurnLeftDegrees); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { YMovement = new XmlFormula(xRoot, XmlConstants.YPositionChange); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { TimeToWaitInSeconds = new XmlFormula(xRoot, XmlConstants.TimeToWaitInSeconds); } }
internal override XElement CreateXml() { var xRoot = new XElement(XmlConstants.Brick); xRoot.SetAttributeValue(XmlConstants.Type, XmlConstants.XmlNoteBrickType); if ((FNote == null) && (Note != null)) { //necessary as there is right now no gui support for formaulas in this brick FNote = new XmlFormula { FormulaTree = new XmlFormulaTree { VariableType = "STRING", VariableValue = Note } }; } if (Note != null) { var xElement = FNote.CreateXml(); xElement.SetAttributeValue(XmlConstants.Category, XmlConstants.Note); var xFormulalist = new XElement(XmlConstants.FormulaList); xFormulalist.Add(xElement); xRoot.Add(xFormulalist); } return(xRoot); }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Steps = new XmlFormula(xRoot, XmlConstants.Steps); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { Transparency = new XmlFormula(xRoot, XmlConstants.Transparency); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { DurationInSeconds = new XmlFormula(xRoot, XmlConstants.DurationInSeconds); XDestination = new XmlFormula(xRoot, XmlConstants.XDestination); YDestination = new XmlFormula(xRoot, XmlConstants.YDestination); } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { FNote = new XmlFormula(xRoot, XmlConstants.Note); Note = FNote.FormulaTree.VariableValue; } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { FText = new XmlFormula(xRoot, XmlConstants.Speak); Text = FText.FormulaTree.VariableValue; } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { VariableFormula = new XmlFormula(xRoot, XmlConstants.VariableChange); if (xRoot.Element(XmlConstants.UserVariable) != null) { UserVariable = new XmlUserVariable(xRoot.Element(XmlConstants.UserVariable)); } } }
internal override void LoadFromXml(XElement xRoot) { if (xRoot != null) { IfCondition = new XmlFormula(xRoot, XmlConstants.XmlIFCONDITION); } /*if (xRoot.Element("ifElseBrick") != null) * { * IfLogicElseBrickReference = new XmlIfLogicElseBrickReference(xRoot.Element("ifElseBrick")); * } * if (xRoot.Element("ifEndBrick") != null) * { * IfLogicEndBrickReference = new XmlIfLogicEndBrickReference(xRoot.Element("ifEndBrick")); * }*/ }
public void XmlFormulaTest() { TextReader sr = new StringReader("<formula category=\"IF_CONDITION\"> <leftChild> <leftChild> <leftChild> <leftChild> <leftChild> <type>USER_VARIABLE</type> <value>x speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>x speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </leftChild> <rightChild> <leftChild> <type>USER_VARIABLE</type> <value>y speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>y speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </rightChild> <type>OPERATOR</type> <value>PLUS</value> </leftChild> <type>FUNCTION</type> <value>SQRT</value> </leftChild> <rightChild> <type>NUMBER</type> <value>2</value> </rightChild> <type>OPERATOR</type> <value>GREATER_THAN</value> </leftChild> <rightChild> <leftChild> <type>SENSOR</type> <value>OBJECT_X</value> </leftChild> <rightChild> <type>NUMBER</type> <value>55</value> </rightChild> <type>OPERATOR</type> <value>SMALLER_THAN</value> </rightChild> <type>OPERATOR</type> <value>LOGICAL_AND</value> </formula>"); var xRoot = XElement.Load(sr); TextReader refSr = new StringReader("<formula category=\"IF_CONDITION\"> <leftChild> <leftChild> <leftChild> <leftChild> <leftChild> <type>USER_VARIABLE</type> <value>x speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>x speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </leftChild> <rightChild> <leftChild> <type>USER_VARIABLE</type> <value>y speed</value> </leftChild> <rightChild> <type>USER_VARIABLE</type> <value>y speed</value> </rightChild> <type>OPERATOR</type> <value>MULT</value> </rightChild> <type>OPERATOR</type> <value>PLUS</value> </leftChild> <type>FUNCTION</type> <value>SQRT</value> </leftChild> <rightChild> <type>NUMBER</type> <value>2</value> </rightChild> <type>OPERATOR</type> <value>GREATER_THAN</value> </leftChild> <rightChild> <leftChild> <type>SENSOR</type> <value>OBJECT_X</value> </leftChild> <rightChild> <type>NUMBER</type> <value>55</value> </rightChild> <type>OPERATOR</type> <value>SMALLER_THAN</value> </rightChild> <type>OPERATOR</type> <value>LOGICAL_AND</value> </formula>"); var refXRoot = XElement.Load(refSr); var testObject = new XmlFormula(xRoot); var referenceObject = new XmlFormula() { FormulaTree = new XmlFormulaTree(refXRoot) }; Assert.AreEqual(referenceObject, testObject); }
internal override void LoadFromXml(XElement xRoot) { Motor = xRoot.Element("motor").Value; Speed = new XmlFormula(xRoot.Element("speed")); }
internal override void LoadFromXml(XElement xRoot) { DurationInSeconds = new XmlFormula(xRoot.Element("durationInSeconds")); Frequency = new XmlFormula(xRoot.Element("frequency")); }
internal override void LoadFromXml(XElement xRoot) { Degrees = new XmlFormula(xRoot.Element("degrees")); Motor = xRoot.Element("motor").Value; }
public FormulaTree Convert(XmlFormula formula) { return(formula == null ? null : Convert(formula.FormulaTree)); }