Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ContentSource.cs
Go to the documentation of this file.
1using System;
3using System.IO;
4using System.Linq;
5
7
8public abstract class ContentSource : IContentSource
9{
10 protected string[] assetPaths;
11
13
15
17
18
20 {
21 assetPaths = paths.ToArray();
23 string[] array = assetPaths;
24 foreach (string obj in array)
25 {
26 string ext = Path.GetExtension(obj);
27 string text = obj;
28 int length = ext.Length;
29 string name = AssetPathHelper.CleanPath(text.Substring(0, text.Length - length));
31 {
32 throw new Exception($"Multiple extensions for asset {name}, ({ext}, {ext2})");
33 }
34 assetExtensions[name] = ext;
35 }
36 }
37
39 {
40 return assetPaths;
41 }
42
43 public string GetExtension(string assetName)
44 {
46 {
47 return null;
48 }
49 return ext;
50 }
51
52 public abstract Stream OpenStream(string fullAssetName);
53}
static string CleanPath(string path)
Stream OpenStream(string fullAssetName)
Must be threadsafe!
string GetExtension(string assetName)
Must be threadsafe!
IEnumerable< string > EnumerateAssets()
RejectedAssetCollection Rejections
void SetAssetNames(IEnumerable< string > paths)
Dictionary< string, string > assetExtensions
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static ? string GetExtension(string? path)
Definition Path.cs:168