public XmlBamlPropertyElement(XmlBamlElement parent, PropertyType propertyType, PropertyDeclaration propertyDeclaration) : base(parent) { _propertyType = propertyType; this.propertyDeclaration = propertyDeclaration; this.TypeDeclaration = propertyDeclaration.DeclaringType; }
public XmlBamlProperty(XmlBamlElement parent, PropertyType propertyType, PropertyDeclaration propertyDeclaration) { this.Parent = parent; this.PropertyDeclaration = propertyDeclaration; this.propertyType = propertyType; }
public XmlBamlProperty(XmlBamlElement parent, PropertyType propertyType) { this.Parent = parent; this.propertyType = propertyType; }
void ReadStaticResourceStart() { Current.IsInStaticResource = true; short identifier = reader.ReadInt16(); byte flags = reader.ReadByte(); TypeDeclaration declaration = GetTypeDeclaration(identifier); LastKey.StaticResources.Add(declaration); XmlBamlElement element; if (elements.Any()) element = new XmlBamlElement(elements.Peek()); else element = new XmlBamlElement(); element.TypeDeclaration = declaration; elements.Push(element); nodes.Enqueue(element); }
void ReadElementStart() { LayerPush(); short identifier = reader.ReadInt16(); sbyte flags = reader.ReadSByte(); if (flags < 0 || flags > 3) throw new NotImplementedException(); Debug.Print("ElementFlags: " + flags); TypeDeclaration declaration = GetTypeDeclaration(identifier); XmlBamlElement element; XmlBamlElement parentElement = null; if (elements.Count > 0) { parentElement = elements.Peek(); element = new XmlBamlElement(parentElement); element.Position = this.reader.BaseStream.Position; // Porto l'inizio del padre all'inizio del primo figlio if (parentElement.Position == 0 && complexPropertyOpened == 0) parentElement.Position = element.Position; } else element = new XmlBamlElement(); // the type is defined in the local assembly, i.e., the main assembly // and this is the root element TypeDeclaration oldDeclaration = null; if (_resolver.IsLocalAssembly(declaration.Assembly) && parentElement == null) { oldDeclaration = declaration; declaration = GetKnownTypeDeclarationByName(declaration.Type.BaseType.AssemblyQualifiedName); } element.TypeDeclaration = declaration; element.IsImplicit = (flags & 2) == 2; elements.Push(element); if (!element.IsImplicit) nodes.Enqueue(element); if (oldDeclaration != null) { nodes.Enqueue(new XmlBamlSimpleProperty(XWPFNamespace, "Class", oldDeclaration.FullyQualifiedName.Replace('+', '.'))); } if (parentElement != null && complexPropertyOpened == 0 && !Current.IsInStaticResource && Current.Previous.IsDeferred) { if (keys != null && keys.Count > currentKey) { string key = keys[currentKey].KeyString; AddKeyToElement(key); currentKey++; } } }
void FormatElementExtension(XmlBamlElement element, StringBuilder sb) { sb.Append("{"); sb.Append(FormatTypeDeclaration(element.TypeDeclaration)); int start = nodes.IndexOf(element); nodes.RemoveAt(start); string sep = " "; while (nodes.Count > start) { XmlBamlNode node = nodes[start]; if (node is XmlBamlEndElement) { sb.Append("}"); nodes.RemoveAt(start); break; } else if (node is XmlBamlPropertyElement) { nodes.RemoveAt(start); sb.Append(sep); XmlBamlPropertyElement property = (XmlBamlPropertyElement)node; sb.Append(property.PropertyDeclaration.Name); sb.Append("="); node = nodes[start]; nodes.RemoveLast(); FormatElementExtension((XmlBamlElement)node, sb); } else if (node is XmlBamlElement) { sb.Append(sep); FormatElementExtension((XmlBamlElement)node, sb); } else if (node is XmlBamlProperty) { nodes.RemoveAt(start); sb.Append(sep); XmlBamlProperty property = (XmlBamlProperty)node; sb.Append(property.PropertyDeclaration.Name); sb.Append("="); sb.Append(property.Value); } else if (node is XmlBamlText) { nodes.RemoveAt(start); sb.Append(sep); sb.Append(((XmlBamlText)node).Text); } sep = ", "; } }
void ReadStaticResourceStart() { Current.IsInStaticResource = true; short identifier = reader.ReadInt16(); byte flags = reader.ReadByte(); TypeDeclaration declaration = GetTypeDeclaration(identifier); var lastKey = keys.LastOrDefault(); if (lastKey == null) throw new InvalidOperationException("No key mapping found for StaticResourceStart!"); lastKey.StaticResources.Add(declaration); XmlBamlElement element; if (elements.Any()) element = new XmlBamlElement(elements.Peek()); else element = new XmlBamlElement(); element.TypeDeclaration = declaration; elements.Push(element); nodes.Enqueue(element); }
public XmlBamlEndElement(XmlBamlElement start) { this.TypeDeclaration = start.TypeDeclaration; this.Namespaces.AddRange(start.Namespaces); }
public XmlBamlElement(XmlBamlElement parent) { this.Namespaces.AddRange(parent.Namespaces); }
public XmlBamlElement(XmlBamlElement parent) { this.Parent = parent; this.Namespaces.AddRange(parent.Namespaces); }