public override void OnBegin() { ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); if (prms != null) { for (int i = 0; i < prms.Length; i += 2) { string str2 = (string)prms[i]; Type type = (Type)prms[i + 1]; string str3 = Digester.Attributes[str2]; if (str3 != null) { list2.Add(type); list.Add(TypeConverterUtility.ConvertTo(str3, type)); } } } Type[] types = (Type[])list2.ToArray(typeof(Type)); object[] parameters = list.ToArray(); Rule rule = (Rule)ruleType.GetConstructor(types).Invoke(parameters); string pattern = PatternRule.Pattern; if (Digester.Attributes["pattern"] != null) { if (pattern.Length > 0) { pattern = pattern + "/"; } pattern = pattern + Digester.Attributes["pattern"]; } configDigester.AddRule(pattern, rule); }
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); }