private static int FindMostSpecific(ParameterInfo[] p1, int[] paramOrder1, Type paramArrayType1, ParameterInfo[] p2, int[] paramOrder2, Type paramArrayType2, Type[] types, object[] args)
{
if (paramArrayType1 != (Type)null && paramArrayType2 == (Type)null)
{
return(2);
}
if (paramArrayType2 != (Type)null && paramArrayType1 == (Type)null)
{
return(1);
}
bool flag1 = false;
bool flag2 = false;
for (int index = 0; index < types.Length; ++index)
{
if (args == null || args[index] != Type.Missing)
{
Type c1 = !(paramArrayType1 != (Type)null) || paramOrder1[index] < p1.Length - 1 ? p1[paramOrder1[index]].ParameterType : paramArrayType1;
Type c2 = !(paramArrayType2 != (Type)null) || paramOrder2[index] < p2.Length - 1 ? p2[paramOrder2[index]].ParameterType : paramArrayType2;
if (!(c1 == c2))
{
switch (DefaultBinder.FindMostSpecificType(c1, c2, types[index]))
{
case 0:
return(0);
case 1:
flag1 = true;
continue;
case 2:
flag2 = true;
continue;
default:
continue;
}
}
}
}
if (flag1 == flag2)
{
if (!flag1 && args != null)
{
if (p1.Length > p2.Length)
{
return(1);
}
if (p2.Length > p1.Length)
{
return(2);
}
}
return(0);
}
return(!flag1 ? 2 : 1);
}