View Source
  Class FileSystemExtensions
  
  
  
  
    Inheritance
      System.Object
      
   
  
  Assembly: Umbraco.Core.dll
  Syntax
  
    public static class FileSystemExtensions
   
  Methods
  
  
    View Source
  
  CopyFile(IFileSystem, String, String)
  
  
  Declaration
  
    public static void CopyFile(this IFileSystem fs, string path, string newPath)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IFileSystem | fs |  | 
      
        | System.String | path |  | 
      
        | System.String | newPath |  | 
    
  
  
    View Source
  
  CreateFolder(IFileSystem, String)
  
  
  Declaration
  
    public static void CreateFolder(this IFileSystem fs, string folderPath)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IFileSystem | fs |  | 
      
        | System.String | folderPath |  | 
    
  
  
    View Source
  
  GetExtension(IFileSystem, String)
  
  
  Declaration
  
    public static string GetExtension(this IFileSystem fs, string path)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IFileSystem | fs |  | 
      
        | System.String | path |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    View Source
  
  GetFileName(IFileSystem, String)
  
  
  Declaration
  
    public static string GetFileName(this IFileSystem fs, string path)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IFileSystem | fs |  | 
      
        | System.String | path |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    View Source
  
  GetStreamHash(Stream)
  
  
  Declaration
  
    public static string GetStreamHash(this Stream fileStream)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | Stream | fileStream |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.String |  | 
    
  
  
    View Source
  
  OpenReadWithRetry(FileInfo, Int32, Int32)
  Attempts to open the file at 
filePath
 up to 
maxRetries
 times,
with a thread sleep time of 
sleepPerRetryInMilliseconds
 between retries.
Declaration
  
    public static FileStream OpenReadWithRetry(this FileInfo file, int maxRetries = 5, int sleepPerRetryInMilliseconds = 50)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | FileInfo | file |  | 
      
        | System.Int32 | maxRetries |  | 
      
        | System.Int32 | sleepPerRetryInMilliseconds |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | FileStream |  | 
    
  
  
    View Source
  
  TryCreateFileProvider(IFileSystem, out IFileProvider)
  Creates a new  from the file system.
Declaration
  
    public static bool TryCreateFileProvider(this IFileSystem fileSystem, out IFileProvider fileProvider)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | IFileSystem | fileSystem | The file system. | 
      
        | IFileProvider | fileProvider | When this method returns, contains an  created from the file
system. | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean | trueif the  was successfully created; otherwise,false.
 |