예제 #1
0
        void ReadStartMember()
        {
            var xt   = types.Peek();
            var name = r.LocalName;
            int idx  = name.IndexOf('.');

            if (idx >= 0)
            {
                string tname = name.Substring(0, idx);
                var    xtn   = new XamlTypeName(r.NamespaceURI, tname, null);
                xt   = SchemaContext.GetXamlType(xtn) ?? new XamlType(xtn.Namespace, xtn.Name, null, SchemaContext);
                name = name.Substring(idx + 1);
            }

            var xm = (XamlMember)FindStandardDirective(name, AllowedMemberLocations.MemberElement) ?? xt.GetAttachableMember(name) ?? xt.GetMember(name);

            if (xm == null)
            {
                // create unknown member.
                xm = new XamlMember(name, xt, false);                  // FIXME: not sure if isAttachable is always false.
            }
            current = current_member = xm;
            members.Push(xm);

            node_type = XamlNodeType.StartMember;
            inside_object_not_member = false;

            r.Read();
        }
 // Token: 0x0600229A RID: 8858 RVA: 0x000ABEE5 File Offset: 0x000AA0E5
 internal XamlNode(XamlNodeType tokenType, int lineNumber, int linePosition, int depth)
 {
     this._token        = tokenType;
     this._lineNumber   = lineNumber;
     this._linePosition = linePosition;
     this._depth        = depth;
 }
예제 #3
0
        bool MoveToNextMarkupExtensionAttributeMember()
        {
            if (markup_extension_attr_members != null)
            {
                switch (node_type)
                {
                case XamlNodeType.StartObject:
                case XamlNodeType.EndMember:
                    // -> next member or end object
                    if (!markup_extension_attr_members.MoveNext())
                    {
                        node_type = XamlNodeType.EndObject;
                    }
                    else
                    {
                        current = current_member = markup_extension_attr_members.Current.Key;
                        members.Push(current_member);
                        node_type = XamlNodeType.StartMember;
                    }
                    return(true);

                case XamlNodeType.EndObject:
                    types.Pop();
                    get_flags.Pop();
                    markup_extension_attr_members = null;
                    return(false);

                case XamlNodeType.StartMember:
                    node_type = XamlNodeType.Value;
                    current   = markup_extension_attr_members.Current.Value;
                    if (current_member == XamlLanguage.PositionalParameters)
                    {
                        markup_extension_attr_values = ((List <string>)current).GetEnumerator();
                        goto case XamlNodeType.Value;
                    }
                    return(true);

                case XamlNodeType.Value:
                    if (markup_extension_attr_values != null)
                    {
                        if (markup_extension_attr_values.MoveNext())
                        {
                            current = markup_extension_attr_values.Current;
                        }
                        else
                        {
                            node_type = XamlNodeType.EndMember;
                            markup_extension_attr_values = null;
                        }
                    }
                    else
                    {
                        node_type = XamlNodeType.EndMember;
                    }
                    return(true);
                }
            }
            return(false);
        }
예제 #4
0
 void SetGetObject()
 {
     types.Push(current_member.Type);
     get_flags.Push(true);
     current   = current_member = null;
     node_type = XamlNodeType.GetObject;
     inside_object_not_member = true;
 }
예제 #5
0
        void ReadValue()
        {
            current = r.Value;

            r.Read();

            node_type = XamlNodeType.Value;
        }
예제 #6
0
 public XamlNode(InternalNodeType internalNodeType)
 {
     Debug.Assert(internalNodeType == InternalNodeType.EndOfAttributes ||
                  internalNodeType == InternalNodeType.StartOfStream ||
                  internalNodeType == InternalNodeType.EndOfStream, "XamlNode ctor: Illegal Internal node type");
     _nodeType         = XamlNodeType.None;
     _internalNodeType = internalNodeType;
     _data             = null;
 }
예제 #7
0
        void ReadEndMember()
        {
            r.Read();

            current_member           = members.Pop();
            current                  = null;
            node_type                = XamlNodeType.EndMember;
            inside_object_not_member = true;
        }
예제 #8
0
        void WritePendingValue(XamlNodeType nodeType)
        {
            if (!hasPendingValue)
            {
                return;
            }

            XamlMember xm = CurrentMember;

            WritePendingStartMember(nodeType);

            if (w.WriteState != WriteState.Attribute)
            {
                WritePendingNamespaces();
            }

            string s = GetValueString(xm, pendingValue);

            // It looks like a bad practice, but since .NET disables
            // indent around XData, I assume they do this, instead
            // of examining valid Text value by creating XmlReader
            // and call XmlWriter.WriteNode().
            if (xm.DeclaringType == XamlLanguage.XData && xm == XamlLanguage.XData.GetMember("Text"))
            {
                w.WriteRaw(s);
                hasPendingValue = false;
                pendingValue    = null;
                return;
            }

            var state = object_states.Peek();

            switch (state.PositionalParameterIndex)
            {
            case -1:
                break;

            case 0:
                state.PositionalParameterIndex++;
                break;

            default:
                if (inside_toplevel_positional_parameter)
                {
                    throw new XamlXmlWriterException(String.Format("The XAML reader input has more than one positional parameter values within a top-level object {0} because it tries to write all of the argument values as an attribute value of the first argument. While XamlObjectReader can read such an object, XamlXmlWriter cannot write such an object to XML.", state.Type));
                }

                state.PositionalParameterIndex++;
                w.WriteString(", ");
                break;
            }
            w.WriteString(s);

            hasPendingValue = false;
            pendingValue    = null;
        }
예제 #9
0
        bool MoveToNextStoredMember()
        {
            if (MoveToNextMarkupExtensionAttributeMember())
            {
                return(true);
            }

            if (stored_member_enumerator != null)
            {
                // FIXME: value might have to be deserialized.
                switch (node_type)
                {
                case XamlNodeType.StartObject:
                case XamlNodeType.EndMember:
                    // -> StartMember
                    if (stored_member_enumerator.MoveNext())
                    {
                        current   = current_member = stored_member_enumerator.Current.Key;
                        node_type = XamlNodeType.StartMember;
                        return(true);
                    }
                    break;

                case XamlNodeType.StartMember:
                    // -> Value or StartObject (of MarkupExtension)
                    var v = stored_member_enumerator.Current.Value;
                    current = v;
                    // Try markup extension
                    // FIXME: is this rule correct?
                    if (!String.IsNullOrEmpty(v) && v [0] == '{')
                    {
                        var pai = ParsedMarkupExtensionInfo.Parse(v, xaml_namespace_resolver, sctx);
                        types.Push(pai.Type);
                        get_flags.Push(false);
                        current   = pai.Type;
                        node_type = XamlNodeType.StartObject;
                        markup_extension_attr_members = pai.Arguments.GetEnumerator();
                    }
                    else
                    {
                        node_type = XamlNodeType.Value;
                    }
                    return(true);

                case XamlNodeType.EndObject:                 // of MarkupExtension
                case XamlNodeType.Value:
                    // -> EndMember
                    current   = null;
                    node_type = XamlNodeType.EndMember;
                    return(true);
                }
            }

            stored_member_enumerator = null;
            return(false);
        }
예제 #10
0
 public void Clear()
 {
     Type         = null;
     Member       = null;
     Namespace    = null;
     NodeType     = XamlNodeType.None;
     Value        = null;
     LineNumber   = 0;
     LinePosition = 0;
 }
예제 #11
0
        // ======================================

        private void Add(XamlNodeType nodeType, object data)
        {
            if (nodeType != XamlNodeType.None)
            {
                XamlNode node = new XamlNode(nodeType, data);
                _nodeQueue.Enqueue(node);
                return;
            }
            Debug.Assert(XamlNode.IsEof_Helper(nodeType, data));
            _nodeQueue.Enqueue(_endOfStreamNode);
        }
 // Token: 0x060022D7 RID: 8919 RVA: 0x000AC368 File Offset: 0x000AA568
 internal XamlElementStartNode(XamlNodeType tokenType, int lineNumber, int linePosition, int depth, string assemblyName, string typeFullName, Type elementType, Type serializerType, bool isEmptyElement, bool needsDictionaryKey, bool isInjected) : base(tokenType, lineNumber, linePosition, depth)
 {
     this._assemblyName       = assemblyName;
     this._typeFullName       = typeFullName;
     this._elementType        = elementType;
     this._serializerType     = serializerType;
     this._isEmptyElement     = isEmptyElement;
     this._needsDictionaryKey = needsDictionaryKey;
     this._useTypeConverter   = false;
     this.IsInjected          = isInjected;
 }
 internal static bool IsEof_Helper(XamlNodeType nodeType, object data)
 {
     if ((nodeType == XamlNodeType.None) && (data is InternalNodeType))
     {
         InternalNodeType type = (InternalNodeType)data;
         if (type == InternalNodeType.EndOfStream)
         {
             return(true);
         }
     }
     return(false);
 }
 private void Add(XamlNodeType nodeType, object data)
 {
     if (nodeType != XamlNodeType.None)
     {
         XamlNode item = new XamlNode(nodeType, data);
         this._nodeQueue.Enqueue(item);
     }
     else
     {
         this._nodeQueue.Enqueue(this._endOfStreamNode);
     }
 }
 private void Add(XamlNodeType nodeType, object data)
 {
     if (nodeType != XamlNodeType.None)
     {
         XamlNode item = new XamlNode(nodeType, data);
         this._nodeQueue.Enqueue(item);
     }
     else
     {
         this._nodeQueue.Enqueue(this._endOfStreamNode);
     }
 }
예제 #16
0
 bool CheckNextNamespace()
 {
     do
     {
         if (r.NamespaceURI == XamlLanguage.Xmlns2000Namespace)
         {
             current   = new NamespaceDeclaration(r.Value, r.Prefix == "xmlns" ? r.LocalName : String.Empty);
             node_type = XamlNodeType.NamespaceDeclaration;
             return(true);
         }
     } while (r.MoveToNextAttribute());
     return(false);
 }
예제 #17
0
        void ReadEndType(bool skipRead)
        {
            var wasGet = get_flags.Pop();

            if (!skipRead && !wasGet)
            {
                r.Read();
            }

            types.Pop();
            current   = null;
            node_type = XamlNodeType.EndObject;
            inside_object_not_member = false;
        }
예제 #18
0
        void ReadStartXData()
        {
            var    xt    = XamlLanguage.XData;
            string xdata = r.ReadInnerXml();

            stored_member_enumerator = new List <Pair> (new Pair [] { new Pair(xt.GetMember("Text"), xdata) }).GetEnumerator();

            types.Push(xt);
            get_flags.Push(false);
            current   = xt;
            node_type = XamlNodeType.StartObject;
            inside_object_not_member = true;
            is_xdata = true;
        }
예제 #19
0
        bool ReadExtraStartMember()
        {
            var xm = GetExtraMember(types.Peek());

            if (xm != null && current != xm)
            {
                inside_object_not_member = false;
                current = current_member = xm;
                members.Push(xm);
                node_type = XamlNodeType.StartMember;
                return(true);
            }
            return(false);
        }
 private void Add(XamlNodeType nodeType, object data)
 {
     if (!base.IsDisposed)
     {
         if (nodeType != XamlNodeType.None)
         {
             this.AddToBuffer(new XamlNode(nodeType, data));
         }
         else
         {
             this.AddToBuffer(new XamlNode(XamlNode.InternalNodeType.EndOfStream));
             this._providerFullEvent.Set();
         }
     }
 }
 // Token: 0x060022A6 RID: 8870 RVA: 0x000ABFA8 File Offset: 0x000AA1A8
 internal XamlPropertyBaseNode(XamlNodeType token, int lineNumber, int linePosition, int depth, object propertyMember, string assemblyName, string typeFullName, string propertyName) : base(token, lineNumber, linePosition, depth)
 {
     if (typeFullName == null)
     {
         throw new ArgumentNullException("typeFullName");
     }
     if (propertyName == null)
     {
         throw new ArgumentNullException("propertyName");
     }
     this._propertyMember = propertyMember;
     this._assemblyName   = assemblyName;
     this._typeFullName   = typeFullName;
     this._propName       = propertyName;
 }
예제 #22
0
 private void Add(XamlNodeType nodeType, object data)
 {
     if (!base.IsDisposed)
     {
         if (nodeType != XamlNodeType.None)
         {
             this.AddToBuffer(new XamlNode(nodeType, data));
         }
         else
         {
             this.AddToBuffer(new XamlNode(XamlNode.InternalNodeType.EndOfStream));
             this._providerFullEvent.Set();
         }
     }
 }
예제 #23
0
 private void Add(XamlNodeType nodeType, object data)
 {
     if (IsDisposed)
     {
         return;
     }
     if (nodeType != XamlNodeType.None)
     {
         AddToBuffer(new XamlNode(nodeType, data));
         return;
     }
     Debug.Assert(XamlNode.IsEof_Helper(nodeType, data));
     AddToBuffer(new XamlNode(XamlNode.InternalNodeType.EndOfStream));
     _providerFullEvent.Set();
 }
 private void Add(XamlNodeType nodeType, object data)
 {
     if (this._readMode)
     {
         throw new XamlException(System.Xaml.SR.Get("CannotWriteClosedWriter"));
     }
     if (nodeType != XamlNodeType.None)
     {
         XamlNode item = new XamlNode(nodeType, data);
         this._nodeList.Add(item);
     }
     else
     {
         this._readMode = true;
     }
 }
 private void Add(XamlNodeType nodeType, object data)
 {
     if (this._readMode)
     {
         throw new XamlException(System.Xaml.SR.Get("CannotWriteClosedWriter"));
     }
     if (nodeType != XamlNodeType.None)
     {
         XamlNode item = new XamlNode(nodeType, data);
         this._nodeList.Add(item);
     }
     else
     {
         this._readMode = true;
     }
 }
예제 #26
0
 public XamlXmlNodeInfo(XamlNodeType nodeType, object nodeValue, IXmlLineInfo lineInfo)
 {
     NodeType  = nodeType;
     NodeValue = nodeValue;
     if (lineInfo != null && lineInfo.HasLineInfo())
     {
         HasLineInfo  = true;
         LineNumber   = lineInfo.LineNumber;
         LinePosition = lineInfo.LinePosition;
     }
     else
     {
         HasLineInfo  = false;
         LineNumber   = 0;
         LinePosition = 0;
     }
 }
예제 #27
0
 private void Add(XamlNodeType nodeType, object data)
 {
     if (!_readMode)
     {
         if (nodeType != XamlNodeType.None)
         {
             XamlNode node = new XamlNode(nodeType, data);
             _nodeList.Add(node);
             return;
         }
         Debug.Assert(XamlNode.IsEof_Helper(nodeType, data));
         _readMode = true;
     }
     else
     {
         throw new XamlException(SR.Get(SRID.CannotWriteClosedWriter));
     }
 }
예제 #28
0
        private void SkipFromTo(XamlNodeType startNodeType, XamlNodeType endNodeType)
        {
            int num = 1;

            while (num > 0)
            {
                this.Read();
                XamlNodeType nodeType = this.NodeType;
                if (nodeType == startNodeType)
                {
                    num++;
                }
                else if (nodeType == endNodeType)
                {
                    num--;
                }
            }
        }
예제 #29
0
        public XamlNode(XamlNodeType nodeType)
        {
#if DEBUG
            switch (nodeType)
            {
            case XamlNodeType.EndObject:
            case XamlNodeType.EndMember:
            case XamlNodeType.GetObject:
                break;

            default:
                Debug.Assert(false, "XamlNode Ctor missing data argument");
                break;
            }
#endif
            _nodeType         = nodeType;
            _internalNodeType = InternalNodeType.None;
            _data             = null;
        }
예제 #30
0
        private bool LimitedRead()
        {
            if (this.IsEof)
            {
                return(false);
            }
            XamlNodeType nodeType = this._reader.NodeType;

            if (this._rootIsStartMember)
            {
                switch (nodeType)
                {
                case XamlNodeType.StartMember:
                    this._depth++;
                    break;

                case XamlNodeType.EndMember:
                    this._depth--;
                    break;
                }
            }
            else
            {
                switch (nodeType)
                {
                case XamlNodeType.StartObject:
                case XamlNodeType.GetObject:
                    this._depth++;
                    break;

                case XamlNodeType.EndObject:
                    this._depth--;
                    break;
                }
            }
            if (this._depth == 0)
            {
                this._done = true;
            }
            this._reader.Read();
            return(!this.IsEof);
        }
예제 #31
0
        bool ReadExtraEndMember()
        {
            var xm = GetExtraMember(types.Peek());

            // FIXME: unlike ReadExtraEndMember, I removed current
            // member check, as current_member might be kept since
            // ReadExtraStartMember(). And for PositionalParameters
            // I cannot "clean up" this field. I guess it is still
            // safe, but might cause some corner-case bugs.
            // I may have to simplify the entire implementation
            // like I did for (now push-based) XamlObjectReader.
            if (xm != null)
            {
                inside_object_not_member = true;
                current_member           = members.Pop();
                node_type = XamlNodeType.EndMember;
                return(true);
            }
            return(false);
        }
예제 #32
0
        void WritePendingStartMember(XamlNodeType nodeType)
        {
            var cm = CurrentMemberState;

            if (cm == null || cm.OccuredAs != AllowedMemberLocations.Any)
            {
                return;
            }

            var state = object_states.Peek();

            if (nodeType == XamlNodeType.Value)
            {
                OnWriteStartMemberAttribute(state.Type, CurrentMember);
            }
            else
            {
                OnWriteStartMemberElement(state.Type, CurrentMember);
            }
        }
예제 #33
0
        public override bool Read()
        {
            var result = reader.Read();

            if (result)
            {
                nodeType      = reader.NodeType;
                isEof         = reader.IsEof;
                namespaceDecl = reader.Namespace;
                type          = reader.Type;
                value         = reader.Value;
                member        = reader.Member;

                if (member != null && member.GetType() == typeof(XamlMember))
                {
                    member = TransformMember(member);
                }
            }

            return(result);
        }
예제 #34
0
 /// <summary>
 /// Contstructor 
 /// </summary>
 internal XamlPropertyComplexEndNode( 
     XamlNodeType   token, 
     int lineNumber,
     int linePosition, 
     int depth)
     : base (token,lineNumber,linePosition,depth)
 {
 } 
예제 #35
0
 /// <summary> 
 /// Internal Constructor
 /// </summary> 
 internal XamlPropertyComplexStartNode(
     XamlNodeType   token,
     int            lineNumber,
     int            linePosition, 
     int            depth,
     object         propertyMember,    // DependencyProperty or MethodInfo or PropertyInfo 
     string         assemblyName, 
     string         typeFullName,
     string         propertyName) 
     : base (token,
             lineNumber,
             linePosition,
             depth, 
             propertyMember,
             assemblyName, 
             typeFullName, 
             propertyName)
 { 
 }
예제 #36
0
            /// <summary> 
            /// Constructor
            /// </summary>
            internal XamlPropertyBaseNode(
                XamlNodeType   token, 
                int         lineNumber,
                int         linePosition, 
                int         depth, 
                object      propertyMember,    // DependencyProperty or MethodInfo or PropertyInfo
                string      assemblyName, 
                string      typeFullName,
                string      propertyName)
                : base (token,
                        lineNumber, 
                        linePosition,
                        depth) 
            { 
                if (typeFullName == null)
                { 
                    throw new ArgumentNullException("typeFullName");
                }
                if (propertyName == null)
                { 
                    throw new ArgumentNullException("propertyName");
                } 
 
                _propertyMember = propertyMember;
                _assemblyName = assemblyName; 
                _typeFullName = typeFullName;
                _propName = propertyName;
            }
예제 #37
0
		bool CheckNextNamespace ()
		{
			do {
				if (r.NamespaceURI == XamlLanguage.Xmlns2000Namespace) {
					current = new NamespaceDeclaration (r.Value, r.Prefix == "xmlns" ? r.LocalName : String.Empty);
					node_type = XamlNodeType.NamespaceDeclaration;
					return true;
				}
			} while (r.MoveToNextAttribute ());
			return false;
		}
예제 #38
0
		void SetGetObject ()
		{
			current = null; // do not clear current_member as it is reused in the next Read().
			node_type = XamlNodeType.GetObject;
			inside_object_not_member = true;
			types.Push (current_member.Type);
		}
예제 #39
0
		bool MoveToNextMarkupExtensionAttributeMember ()
		{
			if (markup_extension_attr_members != null) {
				switch (node_type) {
				case XamlNodeType.StartObject:
				case XamlNodeType.EndMember:
					// -> next member or end object
					if (!markup_extension_attr_members.MoveNext ()) {
						node_type = XamlNodeType.EndObject;
					} else {
						current = current_member = markup_extension_attr_members.Current.Key;
						members.Push (current_member);
						node_type = XamlNodeType.StartMember;
					}
					return true;
				case XamlNodeType.EndObject:
					types.Pop ();
					markup_extension_attr_members = null;
					return false;
				case XamlNodeType.StartMember:
					node_type = XamlNodeType.Value;
					current = markup_extension_attr_members.Current.Value;
					if (current_member == XamlLanguage.PositionalParameters) {
						markup_extension_attr_values = ((List<string>) current).GetEnumerator ();
						goto case XamlNodeType.Value;
					}
					return true;
				case XamlNodeType.Value:
					if (markup_extension_attr_values != null) {
						if (markup_extension_attr_values.MoveNext ())
							current = markup_extension_attr_values.Current;
						else {
							node_type = XamlNodeType.EndMember;
							markup_extension_attr_values = null;
						}
					}
					else
						node_type = XamlNodeType.EndMember;
					return true;
				}
			}
			return false;
		}
예제 #40
0
파일: XamlNode.cs 프로젝트: telurmasin/mono
		public XamlNodeInfo (XamlNodeType nodeType, XamlObject value)
		{
			node_type = nodeType;
			this.value = value;
			member = default (XamlNodeMember);
		}
예제 #41
0
 internal static bool IsEof_Helper (XamlNodeType nodeType, object data)
 {
     if ((nodeType == XamlNodeType.None) && (data is InternalNodeType)) {
         InternalNodeType type = (InternalNodeType)data;
         if (type == InternalNodeType.EndOfStream) {
             return true;
         }
     }
     return false;
 }
예제 #42
0
 public XamlNode (XamlNodeType nodeType)
 {
     this._nodeType = nodeType;
     this._internalNodeType = InternalNodeType.None;
     this._data = null;
 }
예제 #43
0
		void ReadEndType ()
		{
			r.Read ();

			types.Pop ();
			current = null;
			node_type = XamlNodeType.EndObject;
			inside_object_not_member = false;
		}
예제 #44
0
 public XamlNode (XamlNodeType nodeType, object data)
 {
     this._nodeType = nodeType;
     this._internalNodeType = InternalNodeType.None;
     this._data = data;
 }
예제 #45
0
 public XamlNode (InternalNodeType internalNodeType)
 {
     this._nodeType = XamlNodeType.None;
     this._internalNodeType = internalNodeType;
     this._data = null;
 }
예제 #46
0
 public XamlNode (LineInfo lineInfo)
 {
     this._nodeType = XamlNodeType.None;
     this._internalNodeType = InternalNodeType.LineInfo;
     this._data = lineInfo;
 }
예제 #47
0
		void ReadStartMember ()
		{
			var name = r.LocalName;

			current_member = types.Peek ().GetMember (name);
			current = current_member;

			node_type = XamlNodeType.StartMember;
			inside_object_not_member = false;
		}
예제 #48
0
 public void Clear()
 {
     Type = null;
     Member = null;
     Namespace = null;
     NodeType = XamlNodeType.None;
     Value = null;
     LineNumber = 0;
     LinePosition = 0;
 }
예제 #49
0
		bool MoveToNextStoredMember ()
		{
			if (MoveToNextMarkupExtensionAttributeMember ())
				return true;

			if (stored_member_enumerator != null) {
				// FIXME: value might have to be deserialized.
				switch (node_type) {
				case XamlNodeType.StartObject:
				case XamlNodeType.EndMember:
					// -> StartMember
					if (stored_member_enumerator.MoveNext ()) {
						current = current_member = stored_member_enumerator.Current.Key;
						node_type = XamlNodeType.StartMember;
						return true;
					}
					break;
				case XamlNodeType.StartMember:
					// -> Value or StartObject (of MarkupExtension)
					var v = stored_member_enumerator.Current.Value;
					current = v;
					// Try markup extension
					// FIXME: is this rule correct?
					if (!String.IsNullOrEmpty (v) && v [0] == '{') {
						var pai = ParsedMarkupExtensionInfo.Parse (v, xaml_namespace_resolver, sctx);
						types.Push (pai.Type);
						current = pai.Type;
						node_type = XamlNodeType.StartObject;
						markup_extension_attr_members = pai.Arguments.GetEnumerator ();
					}
					else
						node_type = XamlNodeType.Value;
					return true;
				case XamlNodeType.EndObject: // of MarkupExtension
				case XamlNodeType.Value:
					// -> EndMember
					current = null;
					node_type = XamlNodeType.EndMember;
					return true;
				}
			}

			stored_member_enumerator = null;
			return false;
		}
예제 #50
0
		XamlXmlNodeInfo Node (XamlNodeType nodeType, object nodeValue)
		{
			return new XamlXmlNodeInfo(nodeType, nodeValue, line_info);
		}
예제 #51
0
파일: XamlNode.cs 프로젝트: telurmasin/mono
		public XamlNodeInfo (XamlNodeType nodeType, XamlNodeMember member)
		{
			node_type = nodeType;
			this.value = default (XamlObject);
			this.member = member;
		}
예제 #52
0
		bool MoveToNextAttributeMember ()
		{
			if (stored_member_enumerator != null) {
				// FIXME: value might have to be deserialized.
				switch (node_type) {
				case XamlNodeType.StartObject:
				case XamlNodeType.EndMember:
					// -> StartMember
					if (stored_member_enumerator.MoveNext ()) {
						current = current_member = stored_member_enumerator.Current.Key;
						node_type = XamlNodeType.StartMember;
						return true;
					}
					break;
				case XamlNodeType.StartMember:
					// -> Value
					current = stored_member_enumerator.Current.Value;
					node_type = XamlNodeType.Value;
					return true;
				case XamlNodeType.Value:
					// -> EndMember
					current = null;
					node_type = XamlNodeType.EndMember;
					return true;
				}
			}

			stored_members.Clear ();
			stored_member_enumerator = null;
			return false;
		}
예제 #53
0
		void ReadEndMember ()
		{
			r.Read ();

			current = current_member = null;
			node_type = XamlNodeType.EndMember;
			inside_object_not_member = true;
		}
예제 #54
0
 /// <summary>
 /// Constructor 
 /// </summary>
 internal XamlNode(
     XamlNodeType tokenType,
     int          lineNumber, 
     int          linePosition,
     int          depth) 
 { 
     _token = tokenType;
     _lineNumber = lineNumber; 
     _linePosition = linePosition;
     _depth = depth;
 }
예제 #55
0
            internal XamlElementStartNode( 
                XamlNodeType tokenType,
                int          lineNumber,
                int          linePosition,
                int          depth, 
                string       assemblyName,
                string       typeFullName, 
                Type         elementType, 
                Type         serializerType,
                bool         isEmptyElement, 
                bool         needsDictionaryKey,
                bool         isInjected)
                : base (tokenType,lineNumber,linePosition,depth)
 
            {
                _assemblyName       = assemblyName; 
                _typeFullName       = typeFullName; 
                _elementType        = elementType;
                _serializerType     = serializerType; 
                _isEmptyElement     = isEmptyElement;
                _needsDictionaryKey = needsDictionaryKey;
                _useTypeConverter   = false;
                IsInjected          = isInjected; 
            }
예제 #56
0
		void ReadStartType ()
		{
			string name = r.LocalName;
			string ns = r.NamespaceURI;
			string typeArgNames = null;
			var atts = ProcessAttributes ();

			if (!r.IsEmptyElement) {
				r.Read ();
				do {
					r.MoveToContent ();
					switch (r.NodeType) {
					case XmlNodeType.Element:
					// FIXME: parse type arguments etc.
					case XmlNodeType.EndElement:
						break;
					default:
						// this value is for Initialization
						// FIXME: this could also be a WrappedContents
						stored_members.Add (new Pair (XamlLanguage.Initialization, r.Value));
						r.Read ();
						continue;
					}
					break;
				} while (true);
			}
			else
				is_empty_object = true;

			// check TypeArguments to resolve Type, and remove them from the list. They don't appear as a node.
			foreach (var p in stored_members) {
				if (p.Key == XamlLanguage.TypeArguments) {
					typeArgNames = p.Value;
					stored_members.Remove (p);
					break;
				}
			}

			XamlType xt;
			IList<XamlTypeName> typeArgs = typeArgNames == null ? null : XamlTypeName.ParseList (typeArgNames, xaml_namespace_resolver);
			Type rtype = XamlLanguage.ResolveXamlTypeName (ns, name, typeArgs, xaml_namespace_resolver);
			if (rtype == null)
				throw new XamlParseException (String.Format ("Cannot resolve runtime namespace from XML namespace '{0}', local name '{1}' and type argument '{2}'", ns, name, typeArgNames));
			xt = sctx.GetXamlType (rtype);
			if (xt == null)
				// FIXME: .NET just treats the node as empty!
				// we have to sort out what to do here.
				throw new XamlParseException (String.Format ("Failed to create a XAML type for '{0}' in namespace '{1}'", name, ns));
			types.Push (xt);
			current = xt;

			foreach (var p in atts) {
				var xm = xt.GetMember (p.Key);
				if (xm != null)
					stored_members.Add (new Pair (xm, p.Value));
				// ignore unknown attribute
			}

			node_type = XamlNodeType.StartObject;
			inside_object_not_member = true;

			// The next Read() results are likely directives.
			stored_member_enumerator = stored_members.GetEnumerator ();
		}
예제 #57
0
		public XamlXmlNodeInfo (XamlNodeType nodeType, object nodeValue, IXmlLineInfo lineInfo)
		{
			NodeType = nodeType;
			NodeValue = nodeValue;
			if (lineInfo != null && lineInfo.HasLineInfo ()) {
				HasLineInfo = true;
				LineNumber = lineInfo.LineNumber;
				LinePosition = lineInfo.LinePosition;
			} else {
				HasLineInfo = false;
				LineNumber = 0;
				LinePosition = 0;
			}
		}
예제 #58
0
 /// <summary>
 /// Constructor
 /// </summary>
 internal XamlElementEndNode( 
     XamlNodeType tokenType,
     int          lineNumber, 
     int          linePosition, 
     int          depth)
     : base (tokenType,lineNumber,linePosition,depth) 
 {
 }
예제 #59
0
 /// <summary> 
 /// Constructor
 /// </summary> 
 internal XamlAttributeNode(
     XamlNodeType tokenType,
     int          lineNumber,
     int          linePosition, 
     int          depth,
     string       value) 
     : base(tokenType,lineNumber,linePosition,depth) 
 {
     _value = value; 
 }
예제 #60
0
		void ReadValue ()
		{
			// FIXME: (probably) use ValueSerializer to deserialize the value to the expected type.
			current = r.Value;

			r.Read ();

			node_type = XamlNodeType.Value;
		}