1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-28 15:29:10 +02:00
MLEM/MLEM/Content/RawContentReader.cs

28 lines
832 B
C#
Raw Normal View History

2020-04-22 00:30:55 +02:00
using System;
using System.IO;
namespace MLEM.Content {
public abstract class RawContentReader {
public abstract bool CanRead(Type t);
2020-04-22 00:47:09 +02:00
public abstract object Read(RawContentManager manager, string assetPath, Stream stream, Type t, object existing);
2020-04-22 00:30:55 +02:00
public abstract string[] GetFileExtensions();
}
public abstract class RawContentReader<T> : RawContentReader {
public override bool CanRead(Type t) {
return typeof(T).IsAssignableFrom(t);
}
2020-04-22 00:47:09 +02:00
public override object Read(RawContentManager manager, string assetPath, Stream stream, Type t, object existing) {
2020-04-22 00:30:55 +02:00
return this.Read(manager, assetPath, stream, (T) existing);
}
protected abstract T Read(RawContentManager manager, string assetPath, Stream stream, T existing);
}
}