Add backward compatibility for skin.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Cryville.Crtr {
|
||||
public void LoadPdt(DirectoryInfo dir) {
|
||||
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + data + ".pdt", Encoding.UTF8)) {
|
||||
var src = pdtreader.ReadToEnd();
|
||||
Root = (PdtRuleset)new RulesetInterpreter(src, null).Interpret();
|
||||
Root = (PdtRuleset)new RulesetInterpreter(src, null).Interpret(typeof(PdtRuleset));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ using System.Reflection;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
internal class RulesetInterpreter : PdtInterpreter {
|
||||
public RulesetInterpreter(string src, Binder binder) : base(src, typeof(PdtRuleset), binder) { }
|
||||
public RulesetInterpreter(string src, Binder binder) : base(src, binder) { }
|
||||
|
||||
readonly List<RulesetSelector> s = new List<RulesetSelector>();
|
||||
readonly List<string> a = new List<string>();
|
||||
|
@@ -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>();
|
||||
|
@@ -7,7 +7,7 @@ using System.Reflection;
|
||||
|
||||
namespace Cryville.Crtr {
|
||||
public class SkinInterpreter : PdtInterpreter {
|
||||
public SkinInterpreter(string src, Binder binder) : base(src, typeof(PdtSkin), binder) { }
|
||||
public SkinInterpreter(string src, Binder binder) : base(src, binder) { }
|
||||
|
||||
readonly List<SkinSelector> s = new List<SkinSelector>();
|
||||
readonly HashSet<string> a = new HashSet<string>();
|
||||
|
Reference in New Issue
Block a user