Add backward compatibility for skin.
This commit is contained in:
@@ -26,12 +26,21 @@ namespace Cryville.Crtr {
|
||||
public void LoadPdt(DirectoryInfo dir) {
|
||||
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
||||
var src = pdtreader.ReadToEnd();
|
||||
Root = (PdtSkin)new SkinInterpreter(src, null).Interpret();
|
||||
var interpreter = new SkinInterpreter(src, null);
|
||||
var format = interpreter.GetFormatVersion();
|
||||
if (format.Length == 1) {
|
||||
Root = new PdtSkin();
|
||||
Root.elements = (SkinElement)new SkinInterpreter(src, new PdtBinder()).Interpret(typeof(SkinElement));
|
||||
}
|
||||
else {
|
||||
if (format[1] == 1) {
|
||||
Root = (PdtSkin)new SkinInterpreter(src, new PdtBinder()).Interpret(typeof(PdtSkin));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Binder(typeof(PdtBinder))]
|
||||
public class PdtSkin {
|
||||
public Dictionary<Identifier, AnimationSpan> animations
|
||||
= new Dictionary<Identifier, AnimationSpan>();
|
||||
|
Reference in New Issue
Block a user