src/Foundation/Net/Gimela.Net.Http/Resources/FileResources.cs
/// <summary>
/// Checks if a resource exists in the specified directory
/// </summary>
/// <param name="uriPath">Uri path to resource</param>
/// <returns><c>true</c> if resource was found; otherwise <c>false</c>.</returns>
/// <example>
/// <code>
/// if (resources.Exists("/files/user/user.png"))
///   Debug.WriteLine("Resource exists.");
/// </code>
/// </example>
Checks if a resource exists in the specified directory
Checks if a resource exists in the specified directory
public bool Exists(string uriPath)
    {
      if (Contains(uriPath, ForbiddenCharacters))
        return false;
      string filePath = GetFullFilePath(uriPath);
      return filePath != null
             && File.Exists(filePath)
             && (File.GetAttributes(filePath) & FileAttributes.ReparsePoint) == 0; 
    }
public bool Exists ( string uriPath ) { if ( Contains ( uriPath , ForbiddenCharacters ) ) return false ; string filePath = GetFullFilePath ( uriPath ) ; return filePath != null && File . Exists ( filePath ) && ( File . GetAttributes ( filePath ) & FileAttributes . ReparsePoint ) == 0 ; }
Checks if a resource exists in the specified directory
Checks if a resource exists in the specified directory
// not a symlink
None
uriPath
string
Uri path to resource
Uri path to resource
example
if (resources.Exists("/files/user/user.png"))
Debug.WriteLine("Resource exists.").
if ( resources . Exists ( " / files / user / user . png " )) Debug . WriteLine ( " Resource exists . " ) .