C# Class Glare.Assets.FileManager

A file context allows saving, opening, and creating files.
Mostra file Open project: Burton-Radons/Alexandria Class Usage Examples

Public Properties

Property Type Description
Null FileManager
System FileManager

Public Methods

Method Description
Exists ( string path ) : bool

Get whether the file exists.

GetFiles ( string path, string pattern, SearchOption option = SearchOption.TopDirectoryOnly ) : string[]

List the files within the path.

Load ( AssetManager manager, string path, Asset context = null ) : Asset

Load an Asset using this FileManager.

Open ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream

Open a file.

OpenCreate ( string path, FileShare share = FileShare.ReadWrite ) : Stream

Open a new file for writing; if the file already exists, delete it first. OpenWrite can be used to open the file if it already exists but create it otherwise.

OpenRead ( string path, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : Stream

Open an existing file for reading.

OpenReader ( string name, ByteOrder byteOrder = ByteOrder.LittleEndian, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : BinaryReader

Open an existing file.

OpenWrite ( string path, FileShare share = FileShare.ReadWrite ) : Stream

Open an existing or new file for writing. OpenCreate can be used to only create files.

TryOpen ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream

Attempt to open a file.

TryOpenRead ( string path, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : Stream

Attempt to open a file for reading.

Method Details

Exists() public abstract method

Get whether the file exists.
public abstract Exists ( string path ) : bool
path string The path to the file.
return bool

GetFiles() public method

List the files within the path.
public GetFiles ( string path, string pattern, SearchOption option = SearchOption.TopDirectoryOnly ) : string[]
path string
pattern string
option SearchOption
return string[]

Load() public method

Load an Asset using this FileManager.
public Load ( AssetManager manager, string path, Asset context = null ) : Asset
manager AssetManager
path string
context Asset
return Asset

Open() public abstract method

Open a file.
public abstract Open ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream
path string
mode FileMode
access FileAccess
share FileShare
return Stream

OpenCreate() public method

Open a new file for writing; if the file already exists, delete it first. OpenWrite can be used to open the file if it already exists but create it otherwise.
public OpenCreate ( string path, FileShare share = FileShare.ReadWrite ) : Stream
path string
share FileShare
return Stream

OpenRead() public method

Open an existing file for reading.
public OpenRead ( string path, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : Stream
path string
share FileShare
return Stream

OpenReader() public method

Open an existing file.
public OpenReader ( string name, ByteOrder byteOrder = ByteOrder.LittleEndian, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : BinaryReader
name string
byteOrder ByteOrder
share FileShare
return System.IO.BinaryReader

OpenWrite() public method

Open an existing or new file for writing. OpenCreate can be used to only create files.
public OpenWrite ( string path, FileShare share = FileShare.ReadWrite ) : Stream
path string
share FileShare
return Stream

TryOpen() public method

Attempt to open a file.
public TryOpen ( string path, FileMode mode, FileAccess access, FileShare share ) : Stream
path string
mode FileMode
access FileAccess
share FileShare
return Stream

TryOpenRead() public method

Attempt to open a file for reading.
public TryOpenRead ( string path, FileShare share = FileShare.Delete|FileShare.ReadWrite ) : Stream
path string
share FileShare
return Stream

Property Details

Null public_oe static_oe property

Get a FileManager that does not support any files. This is necessary, as passing null to loading operations normally causes a default selection of System.
public static FileManager,Glare.Assets Null
return FileManager

System public_oe static_oe property

Get the system file manager for opening files using standard IO.
public static FileManager,Glare.Assets System
return FileManager