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);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|