public void ReadConfiguration(XPathNavigator nav)
        {
            name   = Helpers.GetRequiredNonEmptyAttribute(nav, "name");
            target = Helpers.ConvertEnum <FeatureTarget> (Helpers.GetRequiredNonEmptyAttribute(nav, "target"), "target");

            XPathNodeIterator iter = nav.Select("blocks/block[string-length (@name) > 0]");

            while (iter.MoveNext())
            {
                blocks.Add(new FeatureBlock(iter.Current, target));
            }

            iter = nav.Select("description/text()");
            string val;

            while (iter.MoveNext())
            {
                val = iter.Current.Value;
                if (String.IsNullOrEmpty(val))
                {
                    continue;
                }
                description.Append(val);
            }

            FeatureAction action;

            iter = nav.Select("actions/action[string-length (@type) > 0 and string-length (@when) > 0]");
            while (iter.MoveNext())
            {
                action = new FeatureAction(iter.Current);
                switch (action.When)
                {
                case ActionWhen.Before:
                    actionsBefore.Add(action);
                    break;

                case ActionWhen.After:
                    actionsAfter.Add(action);
                    break;

                default:
                    throw new ApplicationException(
                              String.Format("Unknown 'when' attribute: {0}", action.When));
                }
            }
        }
示例#2
0
		public void ReadConfiguration (XPathNavigator nav)
		{
			name = Helpers.GetRequiredNonEmptyAttribute (nav, "name");
			target = Helpers.ConvertEnum <FeatureTarget> (Helpers.GetRequiredNonEmptyAttribute (nav, "target"), "target");

			XPathNodeIterator iter = nav.Select ("blocks/block[string-length (@name) > 0]");
			while (iter.MoveNext ())
				blocks.Add (new FeatureBlock (iter.Current, target));

			iter = nav.Select ("description/text()");
			string val;
			while (iter.MoveNext ()) {
				val = iter.Current.Value;
				if (String.IsNullOrEmpty (val))
					continue;
				description.Append (val);
			}
			
			FeatureAction action;
			iter = nav.Select ("actions/action[string-length (@type) > 0 and string-length (@when) > 0]");
			while (iter.MoveNext ()) {
				action = new FeatureAction (iter.Current);
				switch (action.When) {
					case ActionWhen.Before:
						actionsBefore.Add (action);
						break;

					case ActionWhen.After:
						actionsAfter.Add (action);
						break;

					default:
						throw new ApplicationException (
							String.Format ("Unknown 'when' attribute: {0}", action.When));
				}
			}
		}