28 lines
920 B
C#
28 lines
920 B
C#
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 { OverrideName = dir.Name };
|
|
}
|
|
}
|
|
}
|