private static Tuple<Type, string> GetTypeAndMethodNameForConfigurationString(string configuration)
{
foreach (var hit in HuntForAssemblies(configuration))
{
var longestPossibleName = hit.Item1; // method or type name
var assembly = hit.Item2;
// try the longest 2 possibilities at most (because you can't have a dot in the method name)
// so, typeName could specify a method or a type. we're looking for a type.
foreach (var typeName in DotByDot(longestPossibleName).Take(2))
{
var type = assembly.GetType(typeName, false);
if (type == null)
{
// must have been a method name (or doesn't exist), next!
continue;
}
var methodName = typeName == longestPossibleName
? null
: longestPossibleName.Substring(typeName.Length + 1);
return new Tuple<Type, string>(type, methodName);
}
}
return null;
}