Files
crtr/Assets/Cryville/Crtr/Browsing/Legacy/LegacySkinResourceManager.cs

28 lines
912 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 { Name = dir.Name };
}
}
}