/// <summary> /// /// </summary> /// <param name="info"></param> /// <param name="context"></param> protected MorestachioOperatorExpression(SerializationInfo info, StreamingContext context) { Location = CharacterLocation.FromFormatString(info.GetString(nameof(Location))); var opText = info.GetString(nameof(Operator)); Operator = MorestachioOperator.Yield().First(f => f.OperatorText.Equals(opText)); LeftExpression = info.GetValue(nameof(LeftExpression), typeof(IMorestachioExpression)) as IMorestachioExpression; RightExpression = info.GetValue(nameof(RightExpression), typeof(IMorestachioExpression)) as IMorestachioExpression; }
/// <inheritdoc /> public void ReadXml(XmlReader reader) { var opText = reader.GetAttribute(nameof(Operator)); Operator = MorestachioOperator.Yield().First(f => f.OperatorText.Equals(opText)); Location = CharacterLocation.FromFormatString(reader.GetAttribute(nameof(Location))); reader.ReadStartElement(); var leftSubTree = reader.ReadSubtree(); LeftExpression = leftSubTree.ParseExpressionFromKind(); if (reader.Name == nameof(RightExpression)) { var rightSubtree = reader.ReadSubtree(); RightExpression = rightSubtree.ParseExpressionFromKind(); } }
/// <summary> /// Creates a new Operator /// </summary> /// <param name="operator"></param> /// <param name="location"></param> public MorestachioOperatorExpression(MorestachioOperator @operator, IMorestachioExpression leftExpression, CharacterLocation location) { Operator = @operator; Location = location; LeftExpression = leftExpression; }