protected static bool StringSubsetStringPathDiscovery( String left, String right, bool ignoreCase )
{
StringComparison strComp = (ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
if (right == null || left == null || right.Length == 0 || left.Length == 0)
{
return false;
}
else if (right.Length == left.Length)
{
// if they are equal in length, just do a normal compare
return String.Compare( right, left, strComp) == 0;
}
else
{
String shortString, longString;
if (right.Length < left.Length)
{
shortString = right;
longString = left;
}
else
{
shortString = left;
longString = right;
}
if (String.Compare( shortString, 0, longString, 0, shortString.Length, strComp) != 0)
{
return false;
}
#if !PLATFORM_UNIX
if (shortString.Length == 3 &&
shortString.EndsWith( ":\\", StringComparison.Ordinal ) &&
((shortString[0] >= 'A' && shortString[0] <= 'Z') ||
(shortString[0] >= 'a' && shortString[0] <= 'z')))
#else
if (shortString.Length == 1 && shortString[0]== m_directorySeparator)
#endif // !PLATFORM_UNIX
return true;
return longString[shortString.Length] == m_directorySeparator;
}
}