Implement legacy skin resource browser.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Cryville.Crtr.Skin;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Crtr.Browsing.Legacy {
|
||||
internal class LegacySkinResourceManager : LegacyResourceManager<LegacySkinDetail> {
|
||||
protected override string Extension { get { return ".umgs"; } }
|
||||
|
||||
public LegacySkinResourceManager(string rootPath) : base(rootPath) { }
|
||||
|
||||
protected override string GetSubRootPath(string rootPath) {
|
||||
return Path.Combine(rootPath, "skins");
|
||||
}
|
||||
protected override LegacySkinDetail GetMeta(DirectoryInfo dir) {
|
||||
SkinDefinition meta = null;
|
||||
var metaFile = new FileInfo(Path.Combine(dir.FullName, Extension));
|
||||
if (metaFile.Exists) {
|
||||
using (var reader = new StreamReader(metaFile.FullName)) {
|
||||
meta = JsonConvert.DeserializeObject<SkinDefinition>(reader.ReadToEnd());
|
||||
}
|
||||
return new LegacySkinDetail { Meta = meta };
|
||||
}
|
||||
else
|
||||
return new LegacySkinDetail { Name = dir.Name };
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user