protected void RaiseUnknownProperty(ModelMap model, string propName)
 {
     if (UnknownProperty != null)
     {
         UnknownProperty?.Invoke($"{model.Name}.{propName}");
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Builds a node property model from the lexeme given
        /// </summary>
        /// <param name="property">Property lexeme</param>
        /// <returns>Property model</returns>
        /// <exception cref="IParseError">A runtime error happened</exception>
        private IProperty _BuildProperty(NaiveLexer.Property property)
        {
            if (!this._propertyTypes.ContainsKey(property.label))
            {
                var error = new UnknownProperty();
                error.Identity = property.label;
                error.Values   = property.values;
                this._errors.Add(error);

                return(new Model.Property.Misc.Unknown(property.label, property.values));
            }

            var propType = this._propertyTypes[property.label];
            var propCtor = propType.GetMethod("Parse", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);

            if (propCtor == null || !propCtor.IsStatic)
            {
                var error = new UnconstructableProperty();
                error.Identity = property.label;
                this._errors.Add(error);
                return(null);
            }

            return((IProperty)propCtor.Invoke(null, new object[] { property.values }));
        }
Esempio n. 3
0
        public override XamlProperty GetDirectiveProperty(string name)
        {
            if (_directives == null)
            {
                _directives = LoadDirectives();
            }
            XamlProperty directive = _directives.GetDirectiveProperty(name);

            if (directive == null)
            {
                directive = new UnknownProperty(name,
                                                null, /*declaringType - xml directives don't have one. */
                                                XmlDirectives.Uri);
            }
            return(directive);
        }