IsValidLocalPath() private méthode

private IsValidLocalPath ( string path ) : bool
path string
Résultat bool
Exemple #1
0
 public static string GetCanonicalPath(string path)
 {
     if (PathValidator.IsValidLocalPath(path) || (PathValidator.IsValidUncPath(path)))
     {
         return(Path.GetFullPath(EnsureTrailingSlash(path)));
     }
     if (PathValidator.IsValidUrl(path))
     {
         var url = new Uri(path);
         // return canonical representation of Uri
         return(url.AbsoluteUri);
     }
     return(path);
 }
Exemple #2
0
 /// <summary>
 /// Validates that a source is a valid path or url.
 /// </summary>
 /// <param name="source">The path to validate.</param>
 /// <returns>True if valid, False if invalid.</returns>
 public static bool IsValidSource(string source)
 {
     return(PathValidator.IsValidLocalPath(source) || PathValidator.IsValidUncPath(source) || PathValidator.IsValidUrl(source));
 }
Exemple #3
0
 public static string GetCanonicalPath(string path) =>
 ((PathValidator.IsValidLocalPath(path) || PathValidator.IsValidUncPath(path)) ? Path.GetFullPath(EnsureTrailingSlash(path)) : (!PathValidator.IsValidUrl(path) ? path : new Uri(path).AbsoluteUri));