Ejemplo n.º 1
0
        public override void OnEnd()
        {
            object     obj2   = Digester.Peek();
            object     root   = Digester.Root;
            MethodInfo method = root.GetType().GetMethod(_methodName, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            if (method != null)
            {
                method.Invoke(root, new object[] { obj2 });
            }
        }
Ejemplo n.º 2
0
        public override void OnEnd()
        {
            object obj2   = Digester.Pop();
            object obj3   = Digester.Peek();
            var    method = obj3.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            if (method != null)
            {
                method.Invoke(obj3, new object[] { obj2 });
            }
            Digester.Push(obj2);
        }
Ejemplo n.º 3
0
 public override void OnBegin()
 {
     if (paramCount > 0)
     {
         string[] strArray = new string[paramCount];
         for (int i = 0; i < strArray.Length; i++)
         {
             strArray[i] = null;
         }
         Digester.PushParameters(strArray);
     }
 }
Ejemplo n.º 4
0
        public override void OnBegin()
        {
            if (attribute != null)
            {
                string typeName = Digester.Attributes[attribute];
                if (typeName != null)
                {
                    Type.GetType(typeName, true, true);
                }
            }
            object obj2 = Activator.CreateInstance(type);

            Digester.Push(obj2);
        }
Ejemplo n.º 5
0
        public void Configure(XmlReader reader)
        {
            Digester digester = new Digester();

            digester.AddRule("*/pattern", new PatternRule("value"));
            digester.AddRule("*/object-create-rule", new RuleFactoryRule(this, typeof(ObjectCreateRule), new object[] { "typeName", typeof(string), "attribute", typeof(string) }));
            digester.AddRule("*/call-method-rule", new RuleFactoryRule(this, typeof(CallMethodRule), new object[] { "methodName", typeof(string), "paramCount", typeof(int) }));
            digester.AddRule("*/call-param-rule", new RuleFactoryRule(this, typeof(CallParamRule), new object[] { "paramIndex", typeof(int), "attribute", typeof(string) }));
            digester.AddRule("*/set-properties-rule", new RuleFactoryRule(this, typeof(SetPropertiesRule), new object[0]));
            digester.AddRule("*/set-property-rule", new RuleFactoryRule(this, typeof(SetPropertyRule), new object[] { "name", typeof(string), "value", typeof(string) }));
            digester.AddRule("*/set-top-rule", new RuleFactoryRule(this, typeof(SetTopRule), new object[] { "methodName", typeof(string) }));
            digester.AddRule("*/set-next-rule", new RuleFactoryRule(this, typeof(SetNextRule), new object[] { "methodName", typeof(string) }));
            digester.AddRule("*/property-setter-rule", new RuleFactoryRule(this, typeof(PropertySetterRule), new object[] { "propertyName", typeof(string) }));
            digester.Parse(reader);
        }
Ejemplo n.º 6
0
        public override void OnEnd()
        {
            string propertyName = this.propertyName;

            if (propertyName == null)
            {
                propertyName = Digester.ElementName;
            }
            object       obj2     = Digester.Peek();
            PropertyInfo property = obj2.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);

            if (property != null)
            {
                property.SetValue(obj2, TypeConverterUtility.ConvertTo(body, property.PropertyType), null);
            }
        }
Ejemplo n.º 7
0
        public override void OnEnd()
        {
            string[] strArray = null;
            if (paramCount < 0)
            {
                strArray = new string[0];
            }
            else if (paramCount == 0)
            {
                strArray = new string[] { body };
                if (body == null)
                {
                    return;
                }
            }
            else if (paramCount > 0)
            {
                strArray = Digester.PopParameters();
                if ((paramCount == 1) && (strArray[0] == null))
                {
                    return;
                }
            }
            object     obj2   = Digester.Peek();
            MethodInfo method = null;

            if (paramTypes != null)
            {
                method = obj2.GetType().GetMethod(methodName, paramTypes);
            }
            else
            {
                method = obj2.GetType().GetMethod(methodName, new Type[0]);
            }
            if (method != null)
            {
                ParameterInfo[] parameters = method.GetParameters();
                object[]        objArray   = new object[strArray.Length];
                for (int i = 0; i < objArray.Length; i++)
                {
                    objArray[i] = TypeConverterUtility.ConvertTo(strArray[i], parameters[i].ParameterType);
                }
                method.Invoke(obj2, objArray);
                body = null;
            }
        }
Ejemplo n.º 8
0
        public override void OnBegin()
        {
            string name = null;
            string str2 = null;

            for (int i = 0; i < Digester.Attributes.Count; i++)
            {
                string key  = Digester.Attributes.GetKey(i);
                string str3 = Digester.Attributes[i];
                if (key == _name)
                {
                    name = str3;
                }
                else if (key == _value)
                {
                    str2 = str3;
                }
            }
            object       obj2     = Digester.Peek();
            PropertyInfo property = obj2.GetType().GetProperty(name, BindingFlags.Public | BindingFlags.Instance);

            property.SetValue(obj2, TypeConverterUtility.ConvertTo(str2, property.PropertyType), null);
        }
Ejemplo n.º 9
0
 public override void OnEnd()
 {
     Digester.Pop();
 }
Ejemplo n.º 10
0
 public override void OnEnd()
 {
     Digester.PeekParameters()[_paramIndex] = _body;
 }
Ejemplo n.º 11
0
 public RuleFactoryRule(Digester configDigester, Type ruleType, params object[] prms)
 {
     this.configDigester = configDigester;
     this.ruleType       = ruleType;
     this.prms           = prms;
 }