FileUtility Class
Namespace: Stride.Core.AssetsAssembly: Stride.Core.Assets.dll
File Utilities methods.
public class FileUtility
Name | Description | |
---|---|---|
Methods | ||
EnumerateDirectories(String, SearchDirection) | ||
GetAbsolutePath(String) | Converts a relative path to an absolute path using the current working directoy. |
|
GetFileExtensions(String) | Gets the file extensions normalized separated by ',' ';'. |
|
GetFileExtensionsAsSet(String) | Gets the file extensions normalized separated by ',' ';'. |
|
IsFileLocked(FileInfo) | Determines whether the specified file is locked. |
|
IsFileLocked(String) | Determines whether the specified file is locked. |
|
NormalizeFileExtension(String) | Normalizes the file extension by adding a '.' prefix and making it lowercase. |
Methods
EnumerateDirectories(String, SearchDirection)
public static IEnumerable<DirectoryInfo> EnumerateDirectories(string rootDirectory, SearchDirection direction)
Parameters
Type | Name | Description |
---|---|---|
System.String | rootDirectory | |
SearchDirection | direction |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.IO.DirectoryInfo> |
GetAbsolutePath(String)
Converts a relative path to an absolute path using the current working directoy.
public static string GetAbsolutePath(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path. |
Returns
Type | Description |
---|---|
System.String | An absolute path. |
GetFileExtensions(String)
Gets the file extensions normalized separated by ',' ';'.
public static string[] GetFileExtensions(string fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileExtensions | The file extensions separated by ',' ';'. |
Returns
Type | Description |
---|---|
System.String[] | An array of file extensions. |
GetFileExtensionsAsSet(String)
Gets the file extensions normalized separated by ',' ';'.
public static HashSet<string> GetFileExtensionsAsSet(string fileExtensions)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileExtensions | The file extensions separated by ',' ';'. |
Returns
Type | Description |
---|---|
System.Collections.Generic.HashSet<System.String> | An array of file extensions. |
IsFileLocked(FileInfo)
Determines whether the specified file is locked.
public static bool IsFileLocked(FileInfo file)
Parameters
Type | Name | Description |
---|---|---|
System.IO.FileInfo | file | The file. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
IsFileLocked(String)
Determines whether the specified file is locked.
public static bool IsFileLocked(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
NormalizeFileExtension(String)
Normalizes the file extension by adding a '.' prefix and making it lowercase.
public static string NormalizeFileExtension(string fileExtension)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileExtension | The file extension. |
Returns
Type | Description |
---|---|
System.String | A normalized file extension. |