public void ProcessDefaultValue(string propertyName, XamlMember propertyValue, XamlReader reader, IXamlLineInfo lineInfo) { ActivityPropertyHolder holder; if (!this.PropertyHolders.TryGetValue(propertyName, out holder)) { throw FxTrace.Exception.AsError(DynamicActivityXamlReader.CreateXamlException(System.Activities.SR.InvalidProperty(propertyName), lineInfo)); } holder.ProcessDefaultValue(propertyValue, reader, lineInfo); }
public void ProcessDefaultValue(XamlMember propertyValue, XamlReader subReader, IXamlLineInfo lineInfo) { XamlReader reader; bool flag = false; subReader.Read(); if (!subReader.Member.IsNameValid) { throw FxTrace.Exception.AsError(DynamicActivityXamlReader.CreateXamlException(System.Activities.SR.InvalidXamlMember(subReader.Member.Name), lineInfo)); } this.nodes.Writer.WriteStartMember(propertyValue, lineInfo); subReader.Read(); if (subReader.NodeType == XamlNodeType.GetObject) { subReader.Read(); subReader.Read(); reader = subReader.ReadSubtree(); reader.Read(); } else { reader = subReader; } if ((reader.NodeType != XamlNodeType.EndMember) && (reader.NodeType != XamlNodeType.StartObject)) { flag = true; this.nodes.Writer.WriteStartObject(this.Type, lineInfo); this.nodes.Writer.WriteStartMember(XamlLanguage.Initialization, lineInfo); } while (!reader.IsEof) { this.nodes.Writer.WriteNode(reader, lineInfo); reader.Read(); } reader.Close(); if (!object.ReferenceEquals(reader, subReader)) { subReader.Read(); while (subReader.Read()) { this.nodes.Writer.WriteNode(subReader, lineInfo); } } if (flag) { this.nodes.Writer.WriteEndObject(lineInfo); this.nodes.Writer.WriteEndMember(lineInfo); } subReader.Close(); }
public ActivityPropertyHolder(DynamicActivityXamlReader parent, XamlReader reader) { this.parent = parent; this.nodes = new XamlNodeQueue(parent.SchemaContext); IXamlLineInfo innerReaderLineInfo = parent.innerReaderLineInfo; reader.Read(); this.nodes.Writer.WriteStartObject(parent.activityPropertyXamlType, innerReaderLineInfo); int num = 1; int a = 0; int num3 = 0; bool flag = reader.Read(); while (flag) { XamlMember activityPropertyName; switch (reader.NodeType) { case XamlNodeType.StartObject: case XamlNodeType.GetObject: { num++; DynamicActivityXamlReader.IncrementIfPositive(ref a); DynamicActivityXamlReader.IncrementIfPositive(ref num3); if ((num3 <= 0) || !(reader.Type == parent.xamlTypeXamlType)) { goto Label_0231; } this.nodes.Writer.WriteStartObject(parent.typeXamlType, innerReaderLineInfo); flag = reader.Read(); continue; } case XamlNodeType.EndObject: { num--; if (num != 0) { goto Label_0213; } flag = reader.Read(); continue; } case XamlNodeType.StartMember: if (!(reader.Member.DeclaringType == XamlLanguage.Property)) { goto Label_0231; } activityPropertyName = reader.Member; if (!(activityPropertyName == DynamicActivityXamlReader.xPropertyName)) { break; } activityPropertyName = parent.activityPropertyName; if (a == 0) { a = 1; } goto Label_0115; case XamlNodeType.EndMember: DynamicActivityXamlReader.DecrementIfPositive(ref a); DynamicActivityXamlReader.DecrementIfPositive(ref num3); goto Label_0231; case XamlNodeType.Value: if (a != 1) { goto Label_014F; } this.Name = reader.Value as string; goto Label_0231; default: goto Label_0231; } if (activityPropertyName == DynamicActivityXamlReader.xPropertyType) { activityPropertyName = parent.activityPropertyType; if (num3 == 0) { num3 = 1; } } else { if (activityPropertyName != DynamicActivityXamlReader.xPropertyAttributes) { throw FxTrace.Exception.AsError(DynamicActivityXamlReader.CreateXamlException(System.Activities.SR.PropertyMemberNotSupportedByActivityXamlServices(activityPropertyName.Name), innerReaderLineInfo)); } activityPropertyName = parent.activityPropertyAttributes; } Label_0115: this.nodes.Writer.WriteStartMember(activityPropertyName, innerReaderLineInfo); flag = reader.Read(); continue; Label_014F: if (num3 == 1) { XamlTypeName xamlTypeName = XamlTypeName.Parse(reader.Value as string, parent.namespaceTable); XamlType xamlType = parent.SchemaContext.GetXamlType(xamlTypeName); if (xamlType == null) { throw FxTrace.Exception.AsError(DynamicActivityXamlReader.CreateXamlException(System.Activities.SR.InvalidPropertyType(reader.Value as string, this.Name), innerReaderLineInfo)); } this.Type = xamlType; } goto Label_0231; Label_0213: DynamicActivityXamlReader.DecrementIfPositive(ref a); DynamicActivityXamlReader.DecrementIfPositive(ref num3); Label_0231: this.nodes.Writer.WriteNode(reader, innerReaderLineInfo); flag = reader.Read(); } reader.Close(); }