Gorgon
Show / Hide Table of Contents

Interface IContentFileManager

Provides access to the file system for reading, writing, creating and deleting content files and directories.

Namespace: Gorgon.Editor.Content
Assembly: Gorgon.Editor.API.dll
Syntax
public interface IContentFileManager

Properties

| Edit this page View Source

CurrentDirectory

Property to return the current directory.

Declaration
string CurrentDirectory { get; }
Property Value
Type Description
string

Methods

| Edit this page View Source

CreateDirectory(string)

Function to create a new directory

Declaration
bool CreateDirectory(string directory)
Parameters
Type Name Description
string directory

The path to the new directory.

Returns
Type Description
bool

true if the directory was created, false if it already existed.

| Edit this page View Source

DeleteDirectory(string)

Function to delete a directory.

Declaration
bool DeleteDirectory(string path)
Parameters
Type Name Description
string path

The path to the directory.

Returns
Type Description
bool

true if the directory was deleted, false if it wasn't found.

| Edit this page View Source

DeleteFile(string)

Function to delete a file.

Declaration
void DeleteFile(string path)
Parameters
Type Name Description
string path

The path to the file to delete.

| Edit this page View Source

DirectoryExists(string)

Function to determine if a directory exists or not.

Declaration
bool DirectoryExists(string path)
Parameters
Type Name Description
string path

The path to the directory.

Returns
Type Description
bool

true if the directory exists, false if not.

| Edit this page View Source

EnumerateContentFiles(string, string, bool)

Function to retrieve the content files for a given directory path.

Declaration
IEnumerable<IContentFile> EnumerateContentFiles(string directoryPath, string searchMask, bool recursive = false)
Parameters
Type Name Description
string directoryPath

The directory path to search under.

string searchMask

The search mask to use.

bool recursive

[Optional] true to retrieve all files under the path, including those in sub directories, or false to retrieve files in the immediate path.

Returns
Type Description
IEnumerable<IContentFile>

An IEnumerable containing the content files found on the path.

Remarks

This will search on the specified directoryPath for all content files that match the searchMask.

The searchMask parameter can be a full file name, or can contain a wildcard character (*) to filter the search. If the searchMask is set to *, then all content files under the directory will be returned.

| Edit this page View Source

EnumerateDirectories(string, string, bool)

Function to retrieve the content sub directories for a given directory path.

Declaration
IEnumerable<string> EnumerateDirectories(string directoryPath, string searchMask, bool recursive = false)
Parameters
Type Name Description
string directoryPath

The directory path to search under.

string searchMask

The search mask to use.

bool recursive

[Optional] true to retrieve all files under the path, including those in sub directories, or false to retrieve files in the immediate path.

Returns
Type Description
IEnumerable<string>

An IEnumerable containing the directory paths found on the path.

Remarks

This will search on the specified directoryPath for directories that match the searchMask.

The searchMask parameter can be a full directory name, or can contain a wildcard character (*) to filter the search. If the searchMask is set to *, then all sub directories under the directory will be returned.

| Edit this page View Source

EnumeratePaths(string, string, bool)

Function to retrieve the paths under a given directory.

Declaration
IEnumerable<string> EnumeratePaths(string directoryPath, string searchMask, bool recursive = false)
Parameters
Type Name Description
string directoryPath

The directory path to search under.

string searchMask

The search mask to use.

bool recursive

[Optional] true to retrieve all paths under the directory, including those in sub directories, or false to retrieve paths in the immediate directory path.

Returns
Type Description
IEnumerable<string>

An IEnumerable containing the paths found on the directory.

Remarks

This will search on the specified directoryPath for all paths (i.e. both directories and files) that match the searchMask.

The searchMask parameter can be a full path part, or can contain a wildcard character (*) to filter the search. If the searchMask is set to *, then all paths under the directory will be returned.

| Edit this page View Source

FileExists(string)

Function to determine if a file exists or not.

Declaration
bool FileExists(string path)
Parameters
Type Name Description
string path

The path to the file.

Returns
Type Description
bool

true if the file exists, false if not.

| Edit this page View Source

FlushMetadata()

Function to notify the application that the metadata for the file system should be flushed back to the disk.

Declaration
void FlushMetadata()
| Edit this page View Source

GetContentLoader(GorgonTextureCache<GorgonTexture2D>)

Function to create a content loader for loading in content information.

Declaration
IGorgonContentLoader GetContentLoader(GorgonTextureCache<GorgonTexture2D> textureCache)
Parameters
Type Name Description
GorgonTextureCache<GorgonTexture2D> textureCache

The cache used to hold texture data.

Returns
Type Description
IGorgonContentLoader

A new content loader interface.

| Edit this page View Source

GetFile(string)

Function to retrieve a file based on the path specified.

Declaration
IContentFile GetFile(string path)
Parameters
Type Name Description
string path

The path to the file.

Returns
Type Description
IContentFile

A IContentFile if found, null if not.

| Edit this page View Source

GetSelectedFiles()

Function to retrieve a list of the file paths that are selected on the file system.

Declaration
IReadOnlyList<string> GetSelectedFiles()
Returns
Type Description
IReadOnlyList<string>

The list of selected file paths.

| Edit this page View Source

IsDirectoryExcluded(string)

Function to determine if a directory is excluded from a packed file.

Declaration
bool IsDirectoryExcluded(string directory)
Parameters
Type Name Description
string directory

Path to the directory to evaluate.

Returns
Type Description
bool

true if excluded, false if not.

| Edit this page View Source

OpenStream(string, FileMode)

Function to open a file stream for the specified virtual file.

Declaration
Stream OpenStream(string path, FileMode mode)
Parameters
Type Name Description
string path

The path to the virtual file to open.

FileMode mode

The operating mode for the file stream.

Returns
Type Description
Stream

A file stream for the virtual file.

| Edit this page View Source

ToGorgonFileSystem()

Function to convert the content file manager to a standard read-only Gorgon virtual file system.

Declaration
IGorgonFileSystem ToGorgonFileSystem()
Returns
Type Description
IGorgonFileSystem

The IGorgonFileSystem for this content manager.

Events

| Edit this page View Source

SelectedFilesChanged

Event triggered when the selected files change.

Declaration
event EventHandler SelectedFilesChanged
Event Type
Type Description
EventHandler

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author