/* * private void ResolvePropertyName(string longName) * { * XamlPropertyName propName = XamlPropertyName.Parse(longName); * if (propName == null) * { * throw new ArgumentException(SR.Get(SRID.MalformedPropertyName)); * } * * XamlMember prop = null; * XamlType declaringType; * XamlType tagType = _context.CurrentType; * string tagNamespace = _context.CurrentTypeNamespace; * * if (propName.IsDotted) * { * prop = _context.GetDottedProperty(tagType, tagNamespace, propName, false); * } * // Regular property p * else * { * string ns = _context.GetAttributeNamespace(propName, Namespace); * declaringType = _context.CurrentType; * prop = _context.GetNoDotAttributeProperty(declaringType, propName, Namespace, ns, false); * } * _tokenProperty = prop; * }*/ void ResolvePropertyName(string longName) => _tokenProperty = _context.ResolvePropertyName(longName);
public void Read() { bool isQuotedMarkupExtension = false; bool readString = false; _tokenText = string.Empty; _tokenXamlType = null; _tokenProperty = null; _tokenNamespace = null; Advance(); AdvanceOverWhitespace(); if (IsAtEndOfInput) { _token = MeTokenType.None; return; } switch (CurrentChar) { case OpenCurlie: if (NextChar == CloseCurlie) // the {} escapes the ME. return the string. { _token = MeTokenType.String; _state = StringState.Value; readString = true; // ReadString() will strip the leading {} } else { _token = MeTokenType.Open; _state = StringState.Type; // types follow '{' } break; case Quote1: case Quote2: if (NextChar == OpenCurlie) { Advance(); // read ahead one character if (NextChar != CloseCurlie) // check for the '}' of a {} { isQuotedMarkupExtension = true; } PushBack(); // put back the read-ahead. } readString = true; // read substring" break; case CloseCurlie: _token = MeTokenType.Close; _state = StringState.Value; break; case EqualSign: _token = MeTokenType.EqualSign; _state = StringState.Value; _context.CurrentBracketModeParseParameters.IsConstructorParsingMode = false; break; case Comma: _token = MeTokenType.Comma; _state = StringState.Value; if (_context.CurrentBracketModeParseParameters.IsConstructorParsingMode) { _context.CurrentBracketModeParseParameters.IsConstructorParsingMode = ++_context.CurrentBracketModeParseParameters.CurrentConstructorParam < _context.CurrentBracketModeParseParameters.MaxConstructorParams; } break; default: readString = true; break; } if (readString) { if (_context.CurrentType.IsMarkupExtension && _context.CurrentBracketModeParseParameters != null && _context.CurrentBracketModeParseParameters.IsConstructorParsingMode) { int currentCtrParam = _context.CurrentBracketModeParseParameters.CurrentConstructorParam; //_currentParameterName = _context.CurrentLongestConstructorOfMarkupExtension[currentCtrParam].Name; _currentSpecialBracketCharacters = GetBracketCharacterForProperty(_currentParameterName); } string str = ReadString(); _token = (isQuotedMarkupExtension) ? MeTokenType.QuotedMarkupExtension : MeTokenType.String; switch (_state) { case StringState.Value: break; case StringState.Type: _token = MeTokenType.TypeName; ResolveTypeName(str); break; case StringState.Property: _token = MeTokenType.PropertyName; ResolvePropertyName(str); break; } _state = StringState.Value; _tokenText = RemoveEscapes(str); } }