// Token: 0x060021BA RID: 8634 RVA: 0x000A8248 File Offset: 0x000A6448 internal void CompileAttribute(ArrayList xamlNodes, AttributeData data) { string fullName = data.DeclaringType.Assembly.FullName; string fullName2 = data.DeclaringType.FullName; Type propertyType; bool propertyCanWrite; XamlTypeMapper.GetPropertyType(data.Info, out propertyType, out propertyCanWrite); XamlNode value; XamlNode value2; switch (BamlRecordManager.GetPropertyStartRecordType(propertyType, propertyCanWrite)) { case BamlRecordType.PropertyArrayStart: value = new XamlPropertyArrayStartNode(data.LineNumber, data.LinePosition, data.Depth, data.Info, fullName, fullName2, data.PropertyName); value2 = new XamlPropertyArrayEndNode(data.LineNumber, data.LinePosition, data.Depth); goto IL_164; case BamlRecordType.PropertyIListStart: value = new XamlPropertyIListStartNode(data.LineNumber, data.LinePosition, data.Depth, data.Info, fullName, fullName2, data.PropertyName); value2 = new XamlPropertyIListEndNode(data.LineNumber, data.LinePosition, data.Depth); goto IL_164; case BamlRecordType.PropertyIDictionaryStart: value = new XamlPropertyIDictionaryStartNode(data.LineNumber, data.LinePosition, data.Depth, data.Info, fullName, fullName2, data.PropertyName); value2 = new XamlPropertyIDictionaryEndNode(data.LineNumber, data.LinePosition, data.Depth); goto IL_164; } value = new XamlPropertyComplexStartNode(data.LineNumber, data.LinePosition, data.Depth, data.Info, fullName, fullName2, data.PropertyName); value2 = new XamlPropertyComplexEndNode(data.LineNumber, data.LinePosition, data.Depth); IL_164: xamlNodes.Add(value); this.CompileAttributeCore(xamlNodes, data); xamlNodes.Add(value2); }
// Token: 0x060020F0 RID: 8432 RVA: 0x000975CC File Offset: 0x000957CC public void WriteStartComplexProperty(string assemblyName, string ownerTypeFullName, string propName) { this.VerifyWriteState(); this._parserContext.PushScope(); this.ProcessMarkupExtensionNodes(); Type type = null; bool propertyCanWrite = true; object obj; Type type2; this.GetDpOrPi(assemblyName, ownerTypeFullName, propName, out obj, out type2); if (obj == null) { MethodInfo mi = this.GetMi(assemblyName, ownerTypeFullName, propName, out type2); if (mi != null) { XamlTypeMapper.GetPropertyType(mi, out type, out propertyCanWrite); } } else { type = XamlTypeMapper.GetPropertyType(obj); PropertyInfo propertyInfo = obj as PropertyInfo; if (propertyInfo != null) { propertyCanWrite = propertyInfo.CanWrite; } else { DependencyProperty dependencyProperty = obj as DependencyProperty; if (dependencyProperty != null) { propertyCanWrite = !dependencyProperty.ReadOnly; } } } int depth; if (type == null) { this.Push(BamlRecordType.PropertyComplexStart); int lineNumber = 0; int linePosition = 0; depth = this._depth; this._depth = depth + 1; XamlPropertyComplexStartNode xamlComplexPropertyNode = new XamlPropertyComplexStartNode(lineNumber, linePosition, depth, null, assemblyName, ownerTypeFullName, propName); this._bamlRecordWriter.WritePropertyComplexStart(xamlComplexPropertyNode); return; } BamlRecordType propertyStartRecordType = BamlRecordManager.GetPropertyStartRecordType(type, propertyCanWrite); this.Push(propertyStartRecordType); switch (propertyStartRecordType) { case BamlRecordType.PropertyArrayStart: { int lineNumber2 = 0; int linePosition2 = 0; depth = this._depth; this._depth = depth + 1; XamlPropertyArrayStartNode xamlPropertyArrayStartNode = new XamlPropertyArrayStartNode(lineNumber2, linePosition2, depth, obj, assemblyName, ownerTypeFullName, propName); this._bamlRecordWriter.WritePropertyArrayStart(xamlPropertyArrayStartNode); return; } case BamlRecordType.PropertyIListStart: { int lineNumber3 = 0; int linePosition3 = 0; depth = this._depth; this._depth = depth + 1; XamlPropertyIListStartNode xamlPropertyIListStart = new XamlPropertyIListStartNode(lineNumber3, linePosition3, depth, obj, assemblyName, ownerTypeFullName, propName); this._bamlRecordWriter.WritePropertyIListStart(xamlPropertyIListStart); return; } case BamlRecordType.PropertyIDictionaryStart: { int lineNumber4 = 0; int linePosition4 = 0; depth = this._depth; this._depth = depth + 1; XamlPropertyIDictionaryStartNode xamlPropertyIDictionaryStartNode = new XamlPropertyIDictionaryStartNode(lineNumber4, linePosition4, depth, obj, assemblyName, ownerTypeFullName, propName); this._bamlRecordWriter.WritePropertyIDictionaryStart(xamlPropertyIDictionaryStartNode); return; } } int lineNumber5 = 0; int linePosition5 = 0; depth = this._depth; this._depth = depth + 1; XamlPropertyComplexStartNode xamlComplexPropertyNode2 = new XamlPropertyComplexStartNode(lineNumber5, linePosition5, depth, obj, assemblyName, ownerTypeFullName, propName); this._bamlRecordWriter.WritePropertyComplexStart(xamlComplexPropertyNode2); }
/// <summary> /// Write the start of a complex property /// </summary> /// <remarks> /// A complex property start marks the beginning of an object that exists /// in a property on an element in the tree. /// </remarks> public void WriteStartComplexProperty( string assemblyName, string ownerTypeFullName, string propName) { VerifyWriteState(); _parserContext.PushScope(); ProcessMarkupExtensionNodes(); object dpOrPi; Type ownerType; Type propertyType = null; bool propertyCanWrite = true; GetDpOrPi(assemblyName, ownerTypeFullName, propName, out dpOrPi, out ownerType); if (dpOrPi == null) { MethodInfo mi = GetMi(assemblyName, ownerTypeFullName, propName, out ownerType); if (mi != null) { XamlTypeMapper.GetPropertyType(mi, out propertyType, out propertyCanWrite); } } else { propertyType = XamlTypeMapper.GetPropertyType(dpOrPi); PropertyInfo pi = dpOrPi as PropertyInfo; if (pi != null) { propertyCanWrite = pi.CanWrite; } else { DependencyProperty dp = dpOrPi as DependencyProperty; if (dp != null) { propertyCanWrite = !dp.ReadOnly; } } } // Based on the type of the property, we could write this as // a complex IList, Array, IDictionary or a regular complex property. // NOTE: The order this is checked in must the same order as the // XamlReaderHelper.CompileComplexProperty so that we have // the same property behavior (eg - if something implements // IDictionary and IList, it is treated as an IList) if (propertyType == null) { // Unknown complex properties are written out using the string // information passed. This applies to things like Set.Value // and other style related DPs Push(BamlRecordType.PropertyComplexStart); XamlPropertyComplexStartNode propertyStart = new XamlPropertyComplexStartNode( 0, 0, _depth++, null, assemblyName, ownerTypeFullName, propName); _bamlRecordWriter.WritePropertyComplexStart(propertyStart); } else { BamlRecordType recordType = BamlRecordManager.GetPropertyStartRecordType(propertyType, propertyCanWrite); Push(recordType); switch (recordType) { case BamlRecordType.PropertyArrayStart: { XamlPropertyArrayStartNode arrayStart = new XamlPropertyArrayStartNode( 0, 0, _depth++, dpOrPi, assemblyName, ownerTypeFullName, propName); _bamlRecordWriter.WritePropertyArrayStart(arrayStart); break; } case BamlRecordType.PropertyIDictionaryStart: { XamlPropertyIDictionaryStartNode dictionaryStart = new XamlPropertyIDictionaryStartNode( 0, 0, _depth++, dpOrPi, assemblyName, ownerTypeFullName, propName); _bamlRecordWriter.WritePropertyIDictionaryStart(dictionaryStart); break; } case BamlRecordType.PropertyIListStart: { XamlPropertyIListStartNode listStart = new XamlPropertyIListStartNode( 0, 0, _depth++, dpOrPi, assemblyName, ownerTypeFullName, propName); _bamlRecordWriter.WritePropertyIListStart(listStart); break; } default: // PropertyComplexStart { XamlPropertyComplexStartNode node = new XamlPropertyComplexStartNode( 0, 0, _depth++, dpOrPi, assemblyName, ownerTypeFullName, propName); _bamlRecordWriter.WritePropertyComplexStart(node); break; } } } }