// Token: 0x060020F1 RID: 8433 RVA: 0x00097790 File Offset: 0x00095990 public void WriteEndComplexProperty() { this.VerifyWriteState(); BamlRecordType bamlRecordType = this.Pop(); switch (bamlRecordType) { case BamlRecordType.PropertyComplexStart: { int lineNumber = 0; int linePosition = 0; int depth = this._depth - 1; this._depth = depth; XamlPropertyComplexEndNode xamlPropertyComplexEnd = new XamlPropertyComplexEndNode(lineNumber, linePosition, depth); this._bamlRecordWriter.WritePropertyComplexEnd(xamlPropertyComplexEnd); goto IL_11F; } case BamlRecordType.PropertyArrayStart: { int lineNumber2 = 0; int linePosition2 = 0; int depth = this._depth - 1; this._depth = depth; XamlPropertyArrayEndNode xamlPropertyArrayEndNode = new XamlPropertyArrayEndNode(lineNumber2, linePosition2, depth); this._bamlRecordWriter.WritePropertyArrayEnd(xamlPropertyArrayEndNode); goto IL_11F; } case BamlRecordType.PropertyIListStart: { int lineNumber3 = 0; int linePosition3 = 0; int depth = this._depth - 1; this._depth = depth; XamlPropertyIListEndNode xamlPropertyIListEndNode = new XamlPropertyIListEndNode(lineNumber3, linePosition3, depth); this._bamlRecordWriter.WritePropertyIListEnd(xamlPropertyIListEndNode); goto IL_11F; } case BamlRecordType.PropertyIDictionaryStart: { int lineNumber4 = 0; int linePosition4 = 0; int depth = this._depth - 1; this._depth = depth; XamlPropertyIDictionaryEndNode xamlPropertyIDictionaryEndNode = new XamlPropertyIDictionaryEndNode(lineNumber4, linePosition4, depth); this._bamlRecordWriter.WritePropertyIDictionaryEnd(xamlPropertyIDictionaryEndNode); goto IL_11F; } } throw new InvalidOperationException(SR.Get("BamlWriterBadScope", new object[] { bamlRecordType.ToString(), BamlRecordType.PropertyComplexEnd.ToString() })); IL_11F: this._parserContext.PopScope(); }
// Token: 0x060020F9 RID: 8441 RVA: 0x00097BFC File Offset: 0x00095DFC private void VerifyEndTagState(BamlRecordType expectedStartTag, BamlRecordType endTagBeingWritten) { this.VerifyWriteState(); BamlRecordType bamlRecordType = this.Pop(); if (bamlRecordType != expectedStartTag) { throw new InvalidOperationException(SR.Get("BamlWriterBadScope", new object[] { bamlRecordType.ToString(), endTagBeingWritten.ToString() })); } }
private BamlRecordType ReadRecordType(out TextLineSections text) { long pos = Position; int recordId = _reader.ReadByte(); Position = pos; BamlRecordType val = (BamlRecordType)recordId; string meaning = string.Format("{0} [BamlRecord]", val.ToString()); byte[] bytes = _reader.ReadBytes(1); text = new TextLineSections(pos, bytes, meaning); return(val); }
public static IHandler LookupHandler(BamlRecordType type) { #if DEBUG switch (type) { case BamlRecordType.AssemblyInfo: case BamlRecordType.TypeInfo: case BamlRecordType.AttributeInfo: case BamlRecordType.StringInfo: break; default: if (!handlers.ContainsKey(type)) throw new NotSupportedException(type.ToString()); break; } #endif return handlers.ContainsKey(type) ? handlers[type] : null; }
// Token: 0x060020ED RID: 8429 RVA: 0x00097364 File Offset: 0x00095564 public void WriteXmlnsProperty(string localName, string xmlNamespace) { this.VerifyWriteState(); BamlRecordType bamlRecordType = this.PeekRecordType(); if (bamlRecordType != BamlRecordType.ElementStart && bamlRecordType != BamlRecordType.PropertyComplexStart && bamlRecordType != BamlRecordType.PropertyArrayStart && bamlRecordType != BamlRecordType.PropertyIListStart && bamlRecordType != BamlRecordType.PropertyIDictionaryStart) { throw new InvalidOperationException(SR.Get("BamlWriterBadXmlns", new object[] { "WriteXmlnsProperty", bamlRecordType.ToString() })); } XamlXmlnsPropertyNode xamlXmlnsPropertyNode = new XamlXmlnsPropertyNode(0, 0, this._depth, localName, xmlNamespace); this._bamlRecordWriter.WriteNamespacePrefix(xamlXmlnsPropertyNode); this._parserContext.XmlnsDictionary[localName] = xmlNamespace; }
public static IHandler LookupHandler(BamlRecordType type) { #if DEBUG switch (type) { case BamlRecordType.AssemblyInfo: case BamlRecordType.TypeInfo: case BamlRecordType.AttributeInfo: case BamlRecordType.StringInfo: break; default: if (!handlers.ContainsKey(type)) { throw new NotSupportedException(type.ToString()); } break; } #endif return(handlers.ContainsKey(type) ? handlers[type] : null); }
// Token: 0x060020EE RID: 8430 RVA: 0x000973F4 File Offset: 0x000955F4 public void WriteDefAttribute(string name, string value) { this.VerifyWriteState(); BamlRecordType bamlRecordType = this.PeekRecordType(); if (bamlRecordType != BamlRecordType.ElementStart && name != "Uid") { throw new InvalidOperationException(SR.Get("BamlWriterNoInElement", new object[] { "WriteDefAttribute", bamlRecordType.ToString() })); } if (name == "Key") { DefAttributeData defAttributeData = this._extensionParser.IsMarkupExtensionDefAttribute(this.PeekElementType(), ref value, 0, 0, 0); if (defAttributeData != null) { if (name != "Key") { defAttributeData.IsSimple = false; } if (defAttributeData.IsSimple) { int num = defAttributeData.Args.IndexOf(':'); string prefix = string.Empty; string localName = defAttributeData.Args; if (num > 0) { prefix = defAttributeData.Args.Substring(0, num); localName = defAttributeData.Args.Substring(num + 1); } string namespaceURI = this._parserContext.XmlnsDictionary[prefix]; string empty = string.Empty; string empty2 = string.Empty; Type type = null; Type type2 = null; bool elementType = ((IParserHelper)this).GetElementType(false, localName, namespaceURI, ref empty, ref empty2, ref type, ref type2); if (elementType) { XamlDefAttributeKeyTypeNode xamlDefNode = new XamlDefAttributeKeyTypeNode(0, 0, this._depth, empty2, type.Assembly.FullName, type); this._bamlRecordWriter.WriteDefAttributeKeyType(xamlDefNode); } else { defAttributeData.IsSimple = false; DefAttributeData defAttributeData2 = defAttributeData; defAttributeData2.Args += "}"; } } if (!defAttributeData.IsSimple) { this._extensionParser.CompileDictionaryKey(this._markupExtensionNodes, defAttributeData); } return; } } XamlDefAttributeNode xamlDefNode2 = new XamlDefAttributeNode(0, 0, this._depth, name, value); this._bamlRecordWriter.WriteDefAttribute(xamlDefNode2); }
// Token: 0x060020EB RID: 8427 RVA: 0x000970C0 File Offset: 0x000952C0 public void WriteProperty(string assemblyName, string ownerTypeFullName, string propName, string value, BamlAttributeUsage propUsage) { this.VerifyWriteState(); BamlRecordType bamlRecordType = this.PeekRecordType(); if (bamlRecordType != BamlRecordType.ElementStart) { throw new InvalidOperationException(SR.Get("BamlWriterNoInElement", new object[] { "WriteProperty", bamlRecordType.ToString() })); } object obj; Type declaringType; this.GetDpOrPi(assemblyName, ownerTypeFullName, propName, out obj, out declaringType); AttributeData attributeData = this._extensionParser.IsMarkupExtensionAttribute(declaringType, propName, ref value, 0, 0, 0, obj); if (attributeData == null) { XamlPropertyNode xamlPropertyNode = new XamlPropertyNode(0, 0, this._depth, obj, assemblyName, ownerTypeFullName, propName, value, propUsage, false); Type propertyType = XamlTypeMapper.GetPropertyType(obj); if (propertyType == typeof(DependencyProperty)) { Type declaringType2 = null; this._dpProperty = XamlTypeMapper.ParsePropertyName(this._parserContext, value, ref declaringType2); if (this._bamlRecordWriter != null && this._dpProperty != null) { short valueId; short attributeOrTypeId = this._parserContext.MapTable.GetAttributeOrTypeId(this._bamlRecordWriter.BinaryWriter, declaringType2, this._dpProperty.Name, out valueId); if (attributeOrTypeId < 0) { xamlPropertyNode.ValueId = attributeOrTypeId; xamlPropertyNode.MemberName = null; } else { xamlPropertyNode.ValueId = valueId; xamlPropertyNode.MemberName = this._dpProperty.Name; } } } else if (this._dpProperty != null) { xamlPropertyNode.ValuePropertyType = this._dpProperty.PropertyType; xamlPropertyNode.ValuePropertyMember = this._dpProperty; xamlPropertyNode.ValuePropertyName = this._dpProperty.Name; xamlPropertyNode.ValueDeclaringType = this._dpProperty.OwnerType; string fullName = this._dpProperty.OwnerType.Assembly.FullName; this._dpProperty = null; } this._bamlRecordWriter.WriteProperty(xamlPropertyNode); return; } if (!attributeData.IsSimple) { this._extensionParser.CompileAttribute(this._markupExtensionNodes, attributeData); return; } if (attributeData.IsTypeExtension) { Type typeFromBaseString = this._xamlTypeMapper.GetTypeFromBaseString(attributeData.Args, this._parserContext, true); XamlPropertyWithTypeNode xamlPropertyWithType = new XamlPropertyWithTypeNode(0, 0, this._depth, obj, assemblyName, ownerTypeFullName, propName, typeFromBaseString.FullName, typeFromBaseString.Assembly.FullName, typeFromBaseString, string.Empty, string.Empty); this._bamlRecordWriter.WritePropertyWithType(xamlPropertyWithType); return; } XamlPropertyWithExtensionNode xamlPropertyNode2 = new XamlPropertyWithExtensionNode(0, 0, this._depth, obj, assemblyName, ownerTypeFullName, propName, attributeData.Args, attributeData.ExtensionTypeId, attributeData.IsValueNestedExtension, attributeData.IsValueTypeExtension); this._bamlRecordWriter.WritePropertyWithExtension(xamlPropertyNode2); }
/***************************************************************************\ * * BamlWriter.VerifyEndTagState * * Verify that we are in a good state to perform a record write and that * the xamlnodetype on the node type stack is of the expected type. This * is called when an end tag record is written * \***************************************************************************/ private void VerifyEndTagState( BamlRecordType expectedStartTag, BamlRecordType endTagBeingWritten) { VerifyWriteState(); BamlRecordType startTagState = Pop(); if (startTagState != expectedStartTag) { throw new InvalidOperationException(SR.Get(SRID.BamlWriterBadScope, startTagState.ToString(), endTagBeingWritten.ToString())); } }