Created
March 15, 2017 12:20
-
-
Save Ganeshcse/ee88204bbccba9779960c45a4e1c51d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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