Skip to content

Instantly share code, notes, and snippets.

@Ganeshcse
Created March 15, 2017 12:20
Show Gist options
  • Save Ganeshcse/ee88204bbccba9779960c45a4e1c51d9 to your computer and use it in GitHub Desktop.
Save Ganeshcse/ee88204bbccba9779960c45a4e1c51d9 to your computer and use it in GitHub Desktop.
/// <summary>
///
/// </summary>
/// <param name="destinationPath"></param>
/// <param name="sourcePath"></param>
/// <returns></returns>
public static bool CheckDestinationPathCorrectness(this string destinationPath, string sourcePath)
{
var isValidPath = default(bool);
// Condition 1
if (destinationPath.Contains(sourcePath))
{
isValidPath = false;
}
else
{
isValidPath = true;
}
// Condition 2
if (sourcePath == destinationPath)
{
isValidPath = false;
}
else
{
isValidPath = true;
}
// Condition 3
var parentUri = new Uri(sourcePath);
var childUri = new Uri(destinationPath);
if (parentUri.IsBaseOf(childUri))
{
isValidPath = false;
}
else
{
isValidPath = true;
}
return isValidPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment