private static IEnumerable<string> GetPaths(Type t)
{
string name = t.Name;
string fullName = t.FullName;
int i = fullName.LastIndexOf('.');
string ns = i > -1 ? fullName.Substring(0, i).Replace('.', '/') + '/' : null;
int l = fullName.Length - i - name.Length - 2;
string controllerName = l > 0 ? fullName.Substring(i + 1, l).Replace('+', '/') + '/' : null;
string simpleName = name.Length > 4 && name.EndsWith("View", StringComparison.InvariantCultureIgnoreCase) ? name.Substring(0, name.Length - 4) : null;
string simpleControllerName;
if (controllerName != null && controllerName.Contains("Controller"))
{
string[] cn = controllerName.Split('/');
for (int ii = 0; ii < cn.Length; ii++)
{
string c = cn[ii];
if (c.Length > 10 && c.EndsWith("Controller", StringComparison.InvariantCultureIgnoreCase))
cn[ii] = c.Substring(0, c.Length - 10);
}
simpleControllerName = string.Join("/", cn);
}
else
simpleControllerName = null;
string assemblyName = t.Assembly.GetName().Name + '/';
// Warning: The following is stoopid - Fix?
yield return assemblyName + ns + controllerName + name;
if (simpleName != null) yield return assemblyName + ns + controllerName + simpleName;
if (simpleControllerName != null) yield return assemblyName + ns + simpleControllerName + name;
if (simpleControllerName != null && simpleName != null) yield return assemblyName + ns + simpleControllerName + simpleName;
if (ns != null)
{
yield return ns + controllerName + name;
if (simpleName != null) yield return ns + controllerName + simpleName;
if (simpleControllerName != null) yield return ns + simpleControllerName + name;
if (simpleControllerName != null && simpleName != null) yield return ns + simpleControllerName + simpleName;
}
if (controllerName != null)
{
yield return controllerName + name;
if (simpleName != null) yield return controllerName + simpleName;
if (simpleControllerName != null) yield return simpleControllerName + name;
if (simpleControllerName != null && simpleName != null) yield return simpleControllerName + simpleName;
}
yield return name;
if (simpleName != null) yield return simpleName;
}