Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FileSystemContentSource.cs
Go to the documentation of this file.
1using System;
3using System.IO;
4
6
8{
9 private readonly string _basePath;
10
12
14
25
26 public override Stream OpenStream(string assetName)
27 {
29 {
31 }
32 if (!File.Exists(value))
33 {
35 }
36 try
37 {
38 return File.OpenRead(value);
39 }
41 {
43 }
44 }
45
47 {
49 {
50 string[] files = Directory.GetFiles(_basePath, "*", SearchOption.AllDirectories);
51 for (int i = 0; i < files.Length; i++)
52 {
53 string fullPath = Path.GetFullPath(files[i]);
54 string path = fullPath.Substring(_basePath.Length);
57 }
58 }
59 }
60}
static AssetLoadException FromMissingAsset(string assetName, Exception innerException=null)
static string CleanPath(string path)
void SetAssetNames(IEnumerable< string > paths)
override Stream OpenStream(string assetName)
Must be threadsafe!
readonly Dictionary< string, string > _nameToAbsolutePath
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static string[] GetFiles(string path)
Definition Directory.cs:136
static bool Exists([NotNullWhen(true)] string? path)
Definition Directory.cs:43
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static FileStream OpenRead(string path)
Definition File.cs:236
static string GetFullPath(string path)
Definition Path.cs:881
static readonly char DirectorySeparatorChar
Definition Path.cs:71