src/Foundation/Net/Gimela.Net.Http/Resources/FileResources.cs
/// <summary>
/// Find all views in a folder/path.
/// </summary>
/// <param name="path">Absolute Uri path to files that should be found, can end with wild card.</param>
/// <param name="viewNames">Collection to add all view names to.</param>
/// <exception cref="ForbiddenException">Uri contains forbidden characters.</exception>
/// <example>
/// Find("
/// </example>
Find all views in a folder/path.
Find all views in a folder / path .
public void Find(string path, List<string> viewNames)
    {
      if (path.EndsWith("*"))
      {
        FindByWildCard(path, viewNames);
        return;
      }
      if (!path.EndsWith("/"))
        path += "/";
      if (Contains(path, ForbiddenCharacters))
        throw new ForbiddenException("Uri contains forbidden characters.");
      string diskPath = path.Replace('/', Path.PathSeparator).Remove(0, 1);
      foreach (Mapping mapping in _mappings)
      {
        if (mapping.UriPath == path)
        {
          FindFiles(mapping.AbsolutePath, "*.*", viewNames);
          return;
        }
        if (!path.StartsWith(mapping.UriPath))
          continue;
        if (Directory.Exists(mapping.AbsolutePath + diskPath))
        {
          FindFiles(mapping.AbsolutePath + diskPath, "*.*", viewNames);
          return;
        }
      }
    }
public void Find ( string path , List < string > viewNames ) { if ( path . EndsWith ( " " ) ) { FindByWildCard ( path , viewNames ) ; return ; } if ( ! path . EndsWith ( " " ) ) path += " " ; if ( Contains ( path , ForbiddenCharacters ) ) throw new ForbiddenException ( " " ) ; string diskPath = path . Replace ( ' ' , Path . PathSeparator ) . Remove ( 0 , 1 ) ; foreach ( Mapping mapping in _mappings ) { if ( mapping . UriPath == path ) { FindFiles ( mapping . AbsolutePath , " " , viewNames ) ; return ; } if ( ! path . StartsWith ( mapping . UriPath ) ) continue ; if ( Directory . Exists ( mapping . AbsolutePath + diskPath ) ) { FindFiles ( mapping . AbsolutePath + diskPath , " " , viewNames ) ; return ; } } }
Find all views in a folder/path.
Find all views in a folder / path .
// same directory // sub diretory?
Uri contains forbidden characters.
Uri contains forbidden characters .
path
string
Absolute Uri path to files that should be found, can end with wild card.
Absolute Uri path to files that should be found can end with wild card .
viewNames
List<string>
Collection to add all view names to.
Collection to add all view names to .
example
None