Class FileIOSystem
Simple implementation of an IOSystem that searches for files on the disk. This implementation can be given a number of search directories that it will attempt to locate the file in first, before using the file path given by Assimp. That way, you can load models that have files distributed in a number of other directories besides the root model's.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public class FileIOSystem : IOSystem, IDisposable
Constructors
| Edit this page View SourceFileIOSystem()
Constructs a new FileIOSystem that does not have any search directories.
Declaration
public FileIOSystem()
FileIOSystem(params string[]?)
Constructs a new FileIOSystem that uses the specified search directories.
Declaration
public FileIOSystem(params string[]? searchPaths)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | searchPaths | Search directories to search for files in |
Methods
| Edit this page View SourceFindFile(string, out string?)
Finds the first file that matches the file name (name + extension) in the search paths.
Declaration
public bool FindFile(string fileName, out string? pathToFile)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | File name (+ extension) to search for |
| string | pathToFile | Found file path |
Returns
| Type | Description |
|---|---|
| bool | True if the file was found, false otherwise |
GetSearchDirectories()
Gets the search directories the FileIOSystem is using.
Declaration
public IEnumerable<string> GetSearchDirectories()
Returns
| Type | Description |
|---|---|
| IEnumerable<string> | Directory paths |
OpenFile(string, FileIOMode)
Opens a stream to a file.
Declaration
public override IOStream OpenFile(string pathToFile, FileIOMode fileMode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pathToFile | Path to the file |
| FileIOMode | fileMode | Desired file access mode |
Returns
| Type | Description |
|---|---|
| IOStream | The IO stream |
Overrides
| Edit this page View SourceSetSearchDirectories(params string[]?)
Sets the search directories the FileIOSystem will use when searching for files.
Declaration
public void SetSearchDirectories(params string[]? searchPaths)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | searchPaths | Directory paths |