Add type constraints for resource managers. Generalize detail panel.

This commit is contained in:
2023-11-29 13:52:34 +08:00
parent a471272c52
commit 111c500f3b
7 changed files with 88 additions and 45 deletions

View File

@@ -5,7 +5,7 @@ namespace Cryville.Crtr.Browsing {
public interface IResourceManager {
int Count { get; }
object this[int index] { get; }
IResourceMeta this[int index] { get; }
Uri GetItemUri(int index);
event Action ItemChanged;
@@ -16,10 +16,10 @@ namespace Cryville.Crtr.Browsing {
void Activate();
void Deactivate();
}
public interface IResourceManager<T> : IResourceManager {
public interface IResourceManager<out T> : IResourceManager where T : IResourceMeta {
new T this[int index] { get; }
}
public interface IPathedResourceManager<T> : IResourceManager<T> {
public interface IPathedResourceManager<out T> : IResourceManager<T> where T : IResourceMeta {
event Action DirectoryChanged;
IList<string> CurrentDirectory { get; }
void ChangeDirectory(IEnumerable<string> dir);