public string AddDirective(string name, IDictionary values)
{
if ((0 == String.Compare (name, "Page", true, CultureInfo.InvariantCulture) && directives["Page"] != null)
|| (0 == String.Compare (name, "Control", true, CultureInfo.InvariantCulture) && directives["Control"] != null))
throw new Exception ("Only one Page or Control directive is allowed in a document");
DocumentDirective directive = new DocumentDirective (name, values, directivePlaceholderKey);
directivePlaceholderKey++;
if (directives[name] == null)
directives[name] = new ArrayList ();
((ArrayList)directives[name]).Add(directive);
return String.Format(DirectivePlaceholderStructure, directive.Key.ToString ());
}