forked from LukeZurg22/SKSSL
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGameContentDirectory.cs
More file actions
47 lines (36 loc) · 1.45 KB
/
GameContentDirectory.cs
File metadata and controls
47 lines (36 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
namespace SKSSL;
/// <summary>
/// Wrapper for a game's main content folder. Used for getting game prototype, texture, and localization directories.
/// </summary>
public record GameContentDirectory
{
/// Name of the overall directory represented.. Used for sorting and classification.
public readonly string DirectoryTitle;
/// Directory that which game content shall be read.
public readonly string ContentDirectory;
#region Internal Folder Access Fields
/// <returns>Path to localization folder, or null if not found.</returns>
public string? LocalizationFolder => GetFolder("localization");
/// <returns>Path to internal textures, or null if not found.</returns>
public string? TexturesFolder => GetFolder("textures");
/// <returns>Get folder in this content directory.</returns>
public string? GetFolder(string folder)
{
string dir = Path.Combine(ContentDirectory, folder);
return !Directory.Exists(dir) ? null : dir;
}
#endregion
/// TODO: Implement load order.
private static int loadOrderCounter = 0;
///
public int LoadOrder;
/// Creates instance of Game Directory Wrapper.
public GameContentDirectory(string contentDirectory)
{
ContentDirectory = contentDirectory;
DirectoryTitle = Path.GetFileName(contentDirectory);
LoadOrder = loadOrderCounter++;
}
/// <inheritdoc />
public override string ToString() => ContentDirectory;
}