internal ConfigurationElementSchema FindSchema(string path)
{
var remove = string.Format("{0}/{1}", Path, RemoveElementName);
var clear = string.Format("{0}/{1}", Path, ClearElementName);
if (path == remove)
{
return RemoveSchema;
}
if (path == clear)
{
return ClearSchema;
}
foreach (string name in _addNames)
{
string add = string.Format("{0}/{1}", Path, name);
if (path == add)
{
return GetAddElementSchema(name);
}
}
foreach (var name in _addNames)
{
var addRoot = GetAddElementSchema(name);
var addSchema = addRoot.FindSchema(path);
if (addSchema != null)
{
return addSchema;
}
}
// TODO: do we need clear and remove check?
if (ClearSchema != null)
{
var root = ClearSchema;
var result = root.FindSchema(path);
if (result != null)
{
return result;
}
}
if (RemoveSchema != null)
{
var root = RemoveSchema;
var result = root.FindSchema(path);
return result;
}
return null;
}