Example #1
0
 public void WriteString(XamlMarkupExtensionWriter writer, string value)
 {
     if (ContainCharacterToEscape(value) || value == string.Empty)
     {
         value = FormatStringInCorrectSyntax(value);
     }
     writer.sb.Append(value);
 }
Example #2
0
 protected void WritePrefix(XamlMarkupExtensionWriter writer, string prefix)
 {
     if (prefix != "")
     {
         writer.sb.Append(prefix);
         writer.sb.Append(":");
     }
 }
 public override void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     XamlMarkupExtensionWriter.Node node = writer.nodes.Pop();
     if ((node.NodeType != XamlNodeType.StartMember) || (node.XamlProperty != XamlLanguage.PositionalParameters))
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.currentState = XamlMarkupExtensionWriter.InObjectAfterMember.State;
 }
Example #4
0
 public override void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     UpdateStack(writer, property);
     if (property == XamlLanguage.PositionalParameters)
     {
         writer.currentState = InPositionalParametersBeforeValue.State;
     }
     else
     {
         WriteNonPositionalParameterMember(writer, property);
     }
 }
 public override void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     if (writer.nodes.Count == 0)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     if (writer.nodes.Pop().NodeType != XamlNodeType.StartMember)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.currentState = XamlMarkupExtensionWriter.InObjectAfterMember.State;
 }
Example #6
0
            public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
            {
                writer.Reset();

                string prefix = writer.LookupPrefix(type);

                writer.sb.Append("{");
                WritePrefix(writer, prefix);
                writer.sb.Append(XamlXmlWriter.GetTypeName(type));

                writer.nodes.Push(new Node {
                    NodeType = XamlNodeType.StartObject, XamlType = type
                });
                writer.currentState = InObjectBeforeMember.State;
            }
Example #7
0
            public override void WriteEndMember(XamlMarkupExtensionWriter writer)
            {
                if (writer.nodes.Count == 0)
                {
                    throw new InvalidOperationException(SR.Get(SRID.XamlMarkupExtensionWriterInputInvalid));
                }

                Node member = writer.nodes.Pop();

                if (member.NodeType != XamlNodeType.StartMember)
                {
                    throw new InvalidOperationException(SR.Get(SRID.XamlMarkupExtensionWriterInputInvalid));
                }

                writer.currentState = InObjectAfterMember.State;
            }
 protected void UpdateStack(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     if (writer.nodes.Count == 0)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     XamlMarkupExtensionWriter.Node objectNode = writer.nodes.Peek();
     if (objectNode.NodeType != XamlNodeType.StartObject)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.CheckMemberForUniqueness(objectNode, property);
     XamlMarkupExtensionWriter.Node item = new XamlMarkupExtensionWriter.Node {
         NodeType     = XamlNodeType.StartMember,
         XamlType     = objectNode.XamlType,
         XamlProperty = property
     };
     writer.nodes.Push(item);
 }
Example #9
0
            public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
            {
                if (!type.IsMarkupExtension)
                {
                    // can not write a non-ME object in this state in curly form
                    writer.failed = true;
                    return;
                }
                string prefix = writer.LookupPrefix(type);

                writer.sb.Append("{");
                WritePrefix(writer, prefix);
                writer.sb.Append(XamlXmlWriter.GetTypeName(type));

                writer.nodes.Push(new Node {
                    NodeType = XamlNodeType.StartObject, XamlType = type
                });
                writer.currentState = InObjectBeforeMember.State;
            }
 public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     if (!type.IsMarkupExtension)
     {
         writer.failed = true;
     }
     else
     {
         string prefix = writer.LookupPrefix(type);
         writer.sb.Append("{");
         base.WritePrefix(writer, prefix);
         writer.sb.Append(XamlXmlWriter.GetTypeName(type));
         XamlMarkupExtensionWriter.Node item = new XamlMarkupExtensionWriter.Node {
             NodeType = XamlNodeType.StartObject,
             XamlType = type
         };
         writer.nodes.Push(item);
         writer.currentState = XamlMarkupExtensionWriter.InObjectBeforeMember.State;
     }
 }
Example #11
0
            public override void WriteEndObject(XamlMarkupExtensionWriter writer)
            {
                if (writer.nodes.Count == 0)
                {
                    throw new InvalidOperationException(SR.Get(SRID.XamlMarkupExtensionWriterInputInvalid));
                }

                Node node = writer.nodes.Pop();

                if (node.NodeType != XamlNodeType.StartObject)
                {
                    throw new InvalidOperationException(SR.Get(SRID.XamlMarkupExtensionWriterInputInvalid));
                }

                writer.sb.Append("}");

                if (writer.nodes.Count == 0)
                {
                    writer.currentState = Start.State;
                }
                else
                {
                    Node member = writer.nodes.Peek();
                    if (member.NodeType != XamlNodeType.StartMember)
                    {
                        throw new InvalidOperationException(SR.Get(SRID.XamlMarkupExtensionWriterInputInvalid));
                    }

                    if (member.XamlProperty == XamlLanguage.PositionalParameters)
                    {
                        writer.currentState = InPositionalParametersAfterValue.State;
                    }
                    else
                    {
                        writer.currentState = InMemberAfterValueOrEndObject.State;
                    }
                }
            }
 protected void WriteNonPositionalParameterMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     if (XamlXmlWriter.IsImplicit(property) || (property.IsDirective && (property.Type.IsCollection || property.Type.IsDictionary)))
     {
         writer.failed = true;
     }
     else
     {
         if (property.IsDirective)
         {
             writer.sb.Append(this.Delimiter);
             base.WritePrefix(writer, writer.LookupPrefix(property));
             writer.sb.Append(property.Name);
         }
         else if (property.IsAttachable)
         {
             writer.sb.Append(this.Delimiter);
             base.WritePrefix(writer, writer.LookupPrefix(property));
             string str = property.DeclaringType.Name + "." + property.Name;
             writer.sb.Append(str);
         }
         else
         {
             writer.sb.Append(this.Delimiter);
             writer.sb.Append(property.Name);
         }
         writer.sb.Append("=");
         writer.currentState = XamlMarkupExtensionWriter.InMember.State;
     }
 }
 public override void WriteEndObject(XamlMarkupExtensionWriter writer)
 {
     if (writer.nodes.Count == 0)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     if (writer.nodes.Pop().NodeType != XamlNodeType.StartObject)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.sb.Append("}");
     if (writer.nodes.Count == 0)
     {
         writer.currentState = XamlMarkupExtensionWriter.Start.State;
     }
     else
     {
         XamlMarkupExtensionWriter.Node node2 = writer.nodes.Peek();
         if (node2.NodeType != XamlNodeType.StartMember)
         {
             throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
         }
         if (node2.XamlProperty == XamlLanguage.PositionalParameters)
         {
             writer.currentState = XamlMarkupExtensionWriter.InPositionalParametersAfterValue.State;
         }
         else
         {
             writer.currentState = XamlMarkupExtensionWriter.InMemberAfterValueOrEndObject.State;
         }
     }
 }
Example #14
0
 public virtual void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     writer.failed = true;
 }
 public void WriteString(XamlMarkupExtensionWriter writer, string value)
 {
     if (ContainCharacterToEscape(value) || (value == string.Empty))
     {
         value = FormatStringInCorrectSyntax(value);
     }
     writer.sb.Append(value);
 }
Example #16
0
 public virtual void WriteNamespace(XamlMarkupExtensionWriter writer, NamespaceDeclaration namespaceDeclaration)
 {
     writer.failed = true;
 }
 public override void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     XamlMarkupExtensionWriter.Node node = writer.nodes.Pop();
     if ((node.NodeType != XamlNodeType.StartMember) || (node.XamlProperty != XamlLanguage.PositionalParameters))
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.currentState = XamlMarkupExtensionWriter.InObjectAfterMember.State;
 }
 public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     writer.sb.Append(this.Delimiter);
     writer.currentState = XamlMarkupExtensionWriter.InMember.State;
     writer.currentState.WriteStartObject(writer, type);
 }
Example #19
0
 public override void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     WriteString(writer, value);
     writer.currentState = InMemberAfterValueOrEndObject.State;
 }
Example #20
0
 public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     writer.sb.Append(Delimiter);
     writer.currentState = InMember.State;
     writer.currentState.WriteStartObject(writer, type);
 }
Example #21
0
 public override void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     writer.sb.Append(Delimiter);
     WriteString(writer, value);
     writer.currentState = InPositionalParametersAfterValue.State;
 }
Example #22
0
 public override void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     UpdateStack(writer, property);
     WriteNonPositionalParameterMember(writer, property);
 }
Example #23
0
 public virtual void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     writer.failed = true;
 }
Example #24
0
 public virtual void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     writer.failed = true;
 }
 public override void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     base.UpdateStack(writer, property);
     base.WriteNonPositionalParameterMember(writer, property);
 }
 public virtual void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     writer.failed = true;
 }
 public override void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     base.UpdateStack(writer, property);
     if (property == XamlLanguage.PositionalParameters)
     {
         writer.currentState = XamlMarkupExtensionWriter.InPositionalParametersBeforeValue.State;
     }
     else
     {
         base.WriteNonPositionalParameterMember(writer, property);
     }
 }
 public virtual void WriteNamespace(XamlMarkupExtensionWriter writer, NamespaceDeclaration namespaceDeclaration)
 {
     writer.failed = true;
 }
 public override void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     writer.sb.Append(this.Delimiter);
     base.WriteString(writer, value);
     writer.currentState = XamlMarkupExtensionWriter.InPositionalParametersAfterValue.State;
 }
 public virtual void WriteStartMember(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     writer.failed = true;
 }
 public override void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     writer.Reset();
     string prefix = writer.LookupPrefix(type);
     writer.sb.Append("{");
     base.WritePrefix(writer, prefix);
     writer.sb.Append(XamlXmlWriter.GetTypeName(type));
     XamlMarkupExtensionWriter.Node item = new XamlMarkupExtensionWriter.Node {
         NodeType = XamlNodeType.StartObject,
         XamlType = type
     };
     writer.nodes.Push(item);
     writer.currentState = XamlMarkupExtensionWriter.InObjectBeforeMember.State;
 }
Example #32
0
 public virtual void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     writer.failed = true;
 }
 public virtual void WriteGetObject(XamlMarkupExtensionWriter writer)
 {
     writer.failed = true;
 }
 public override void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     base.WriteString(writer, value);
     writer.currentState = XamlMarkupExtensionWriter.InMemberAfterValueOrEndObject.State;
 }
 protected void WritePrefix(XamlMarkupExtensionWriter writer, string prefix)
 {
     if (prefix != "")
     {
         writer.sb.Append(prefix);
         writer.sb.Append(":");
     }
 }
 public override void WriteEndMember(XamlMarkupExtensionWriter writer)
 {
     if (writer.nodes.Count == 0)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     if (writer.nodes.Pop().NodeType != XamlNodeType.StartMember)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.currentState = XamlMarkupExtensionWriter.InObjectAfterMember.State;
 }
 public virtual void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type)
 {
     writer.failed = true;
 }
 protected void UpdateStack(XamlMarkupExtensionWriter writer, XamlMember property)
 {
     if (writer.nodes.Count == 0)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     XamlMarkupExtensionWriter.Node objectNode = writer.nodes.Peek();
     if (objectNode.NodeType != XamlNodeType.StartObject)
     {
         throw new InvalidOperationException(System.Xaml.SR.Get("XamlMarkupExtensionWriterInputInvalid"));
     }
     writer.CheckMemberForUniqueness(objectNode, property);
     XamlMarkupExtensionWriter.Node item = new XamlMarkupExtensionWriter.Node {
         NodeType = XamlNodeType.StartMember,
         XamlType = objectNode.XamlType,
         XamlProperty = property
     };
     writer.nodes.Push(item);
 }
 public virtual void WriteValue(XamlMarkupExtensionWriter writer, string value)
 {
     writer.failed = true;
 }
Example #40
0
 public virtual void WriteGetObject(XamlMarkupExtensionWriter writer)
 {
     writer.failed = true;
 }