-
Notifications
You must be signed in to change notification settings - Fork 0
Classes
ContentPipe has a couple classes, and they are as follows(with descriptions)
The Content class is the core of the interface, it is what is used to load content globally and more!
public static void LoadDirectory(string path);
LoadDirectory is the function used to load a packed directory(.cpkg) file into the content pipeline. It takes in a relative or absolute path without extension, so loading Content/Text.cpg
would be done via Content.LoadDirectory("Content/Text");
public static void UnloadDirectory(string path);
UnloadDirectory is much like LoadDirectory, it is used to unload a packed directory(.cpkg) file and it, just like LoadDirectory, should not be given an extension. Please note that as of right now, it compares path strings, not the actual path loaded, and so it might not unload the file if a different string is given.
public static void UnloadAll();
Unloads all mounted/loaded content
public static void LoadPhysicalDirectory(string path);
LoadPhysicalDirectory loads a "physical" directory(a directory on disk), or an unpacked directory if you will. It doesn't accept a file extension, since there is no file to load, it simply mounts a directory.
public static void UnloadPhysicalDirectory(string path);
UnloadPhysicalDirectory detaches/unloads a so-called physical directory, and much like UnloadDirectory
it ignores the actual path, and only compares the path string given.
public static ContentLump? Load(string resource);
Load a file/ContentLump from the mounted/loaded directories or physical directories. Newer loaded directories are fetched from before other directories.
Physical directories will always be loaded from before packed directories
public static byte[] LoadBytes(string resource);
Load binary data from a resource name, this is simply a wrapper for Content.Load(resource).Data
, and it returns an empty byte array if the resource is not found
public static string LoadString(string resource);
Load a string from a resource, this simple converts the content from LoadBytes
to a string via UTF-8, and thus returns an empty string if the resource doesn't exist.
public static Stream LoadStream(string resource);
Loads a stream from a resource. This simply makes a new MemoryStream with the data from LoadBytes
as a buffer, and thus has a length of 0 if the resource is not found.