Exemple #1
0
            public void Apply()
            {
                if (string.IsNullOrWhiteSpace(this.Name))
                {
                    throw new PluginException();
                }

                var type = this.Target == null?PluginUtility.GetType(this.Type) : this.Target.GetType();

                var member = type.GetMember(this.Name, BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField | BindingFlags.SetProperty).FirstOrDefault();

                if (member == null)
                {
                    throw new PluginException();
                }

                if (member.IsField())
                {
                    ((FieldInfo)member).SetValue(this.Target, this.Value);
                }
                else if (member.IsProperty())
                {
                    ((PropertyInfo)member).SetValue(this.Target, this.Value);
                }
            }
Exemple #2
0
 public override object Parse(ParserContext context)
 {
     return(PluginUtility.GetType(context.Text));
 }