Provides a virtual file system for combining data from multiple directories and archives (useful for modding).
More...
|
static void | LoadArchives () |
| Loads any ArchiveFileExt archives in BaseDir and ModDir or specified by EnvVarNameBaseArchives or EnvVarNamerModArchives. More...
|
|
static void | CloseArchives () |
| Closes the content archives loaded by LoadArchives. More...
|
|
static string | CreateDirPath ([NotNull, Localizable(false)] string type) |
| Creates a path for a content directory (using the ModDir if available). More...
|
|
static string | CreateFilePath ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string id) |
| Creates a path for a content file (using ModDir if available). More...
|
|
static bool | FileExists ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string id, bool searchArchives=true) |
| Checks whether a certain content file exists. More...
|
|
static NamedCollection< FileEntry > | GetFileList ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string extension) |
| Gets a list of all files of a certain type More...
|
|
static string | GetFilePath ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string id) |
| Gets the file path for a content file (does not search in archives) More...
|
|
static Stream | GetFileStream ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string id) |
| Gets a reading stream for a content file (searches in archives) More...
|
|
static void | DeleteModFile ([NotNull, Localizable(false)] string type, [NotNull, Localizable(false)] string id) |
| Deletes a file in ModDir. Will not touch files in archives or in BaseDir. More...
|
|
|
const string | ArchiveFileExt = ".pk5" |
| The file extensions of content archives. More...
|
|
const string | EnvVarNameBaseDir = "CONTENTMANAGER_BASE_DIR" |
| The name of an environment variable that can be used to configure the content manager externally. More...
|
|
|
static DirectoryInfo | BaseDir [get, set] |
| The base directory where all the content files are stored; should not be null . More...
|
|
static DirectoryInfo | ModDir [get, set] |
| A directory overriding the base directory for creating mods; can be null . More...
|
|
Provides a virtual file system for combining data from multiple directories and archives (useful for modding).
◆ CloseArchives()
static void OmegaEngine.Storage.ContentManager.CloseArchives |
( |
| ) |
|
|
inlinestatic |
◆ CreateDirPath()
static string OmegaEngine.Storage.ContentManager.CreateDirPath |
( |
[NotNull, Localizable(false)] string |
type | ) |
|
|
inlinestatic |
Creates a path for a content directory (using the ModDir if available).
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
- Returns
- The absolute path to the requested directory.
- Exceptions
-
DirectoryNotFoundException | The specified directory could not be found. |
◆ CreateFilePath()
static string OmegaEngine.Storage.ContentManager.CreateFilePath |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
id |
|
) |
| |
|
inlinestatic |
Creates a path for a content file (using ModDir if available).
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
id | The file name of the content. |
- Returns
- The absolute path to the requested content file.
◆ DeleteModFile()
static void OmegaEngine.Storage.ContentManager.DeleteModFile |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
id |
|
) |
| |
|
inlinestatic |
Deletes a file in ModDir. Will not touch files in archives or in BaseDir.
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
id | The file name of the content. |
- Exceptions
-
InvalidOperationException | ModDir is not set. |
FileNotFoundException | The specified file could not be found. |
IOException | The specified file could not be deleted. |
UnauthorizedAccessException | You have insufficient rights to delete the file. |
◆ FileExists()
static bool OmegaEngine.Storage.ContentManager.FileExists |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
id, |
|
|
bool |
searchArchives = true |
|
) |
| |
|
inlinestatic |
Checks whether a certain content file exists.
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
id | The file name of the content. |
searchArchives | Whether to search for the file in archives as well. |
- Returns
true
if the requested content file exists.
◆ GetFileList()
static NamedCollection<FileEntry> OmegaEngine.Storage.ContentManager.GetFileList |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
extension |
|
) |
| |
|
inlinestatic |
Gets a list of all files of a certain type
- Parameters
-
type | The type of files you want (e.g. Textures, Sounds, ...) |
extension | The file extension to so search for |
- Returns
- An collection of strings with file IDs
◆ GetFilePath()
static string OmegaEngine.Storage.ContentManager.GetFilePath |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
id |
|
) |
| |
|
inlinestatic |
Gets the file path for a content file (does not search in archives)
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
id | The file name of the content. |
- Returns
- The absolute path to the requested content file
- Exceptions
-
FileNotFoundException | The specified file could not be found. |
◆ GetFileStream()
static Stream OmegaEngine.Storage.ContentManager.GetFileStream |
( |
[NotNull, Localizable(false)] string |
type, |
|
|
[NotNull, Localizable(false)] string |
id |
|
) |
| |
|
inlinestatic |
Gets a reading stream for a content file (searches in archives)
- Parameters
-
type | The type of file (e.g. Textures, Sounds, ...). |
id | The file name of the content. |
- Returns
- The absolute path to the requested content file
- Exceptions
-
FileNotFoundException | The specified file could not be found. |
IOException | There was an error reading the file. |
UnauthorizedAccessException | Read access to the file is not permitted. |
◆ LoadArchives()
static void OmegaEngine.Storage.ContentManager.LoadArchives |
( |
| ) |
|
|
inlinestatic |
◆ ArchiveFileExt
const string OmegaEngine.Storage.ContentManager.ArchiveFileExt = ".pk5" |
The file extensions of content archives.
◆ EnvVarNameBaseDir
const string OmegaEngine.Storage.ContentManager.EnvVarNameBaseDir = "CONTENTMANAGER_BASE_DIR" |
The name of an environment variable that can be used to configure the content manager externally.
◆ BaseDir
DirectoryInfo OmegaEngine.Storage.ContentManager.BaseDir |
|
staticgetset |
The base directory where all the content files are stored; should not be null
.
Can be set externally with EnvVarNameBaseDir.
- Exceptions
-
DirectoryNotFoundException | The specified directory could not be found. |
◆ ModDir
DirectoryInfo OmegaEngine.Storage.ContentManager.ModDir |
|
staticgetset |
A directory overriding the base directory for creating mods; can be null
.
Can be set externally with EnvVarNameModDir.
- Exceptions
-
DirectoryNotFoundException | The specified directory could not be found. |
The documentation for this class was generated from the following file:
- OmegaEngine/Storage/ContentManager.cs