Prune code.

This commit is contained in:
2022-09-30 18:19:19 +08:00
parent e8e36b83bd
commit cd4ea557c3
41 changed files with 22 additions and 3592 deletions

View File

@@ -22,9 +22,6 @@ namespace Cryville.Crtr {
[JsonRequired]
public string pdt;
/*[JsonIgnore][Obsolete]
public CompiledSkin c;*/
[JsonIgnore]
public PdtSkin Root { get; private set; }
@@ -32,72 +29,10 @@ namespace Cryville.Crtr {
using (StreamReader pdtreader = new StreamReader(dir.FullName + "/" + pdt + ".pdt", Encoding.UTF8)) {
var src = pdtreader.ReadToEnd();
Root = new SkinInterpreter(src, null).Interpret();
/*#pragma warning disable CS0612
c = PdtReader.Read<CompiledSkin>(src);
#pragma warning restore CS0612*/
// c.PreEval(new EvalImpl());
}
}
}
#region Obsolete
#if false
[Obsolete]
public class CompiledSkin : Element { }
[Obsolete]
[Binder(typeof(ElementBinder))]
public class Element {
[ElementList]
public Dictionary<SkinSelectors, Element> elements
= new Dictionary<SkinSelectors, Element>();
[ComponentList]
public List<string> components
= new List<string>();
[PropertyList]
public Dictionary<string, Expression> properties
= new Dictionary<string, Expression>();
public bool IsDynamic {
get;
private set;
}
public void PreEval(IEvaluator etor, byte depth = 1) {
IsDynamic = false;
foreach (var e in properties.Values) {
e.PreEval(etor, depth);
if (e.IsDynamic)
IsDynamic = true;
}
foreach (var e in elements.Values) {
e.PreEval(etor, depth);
if (e.IsDynamic)
IsDynamic = true;
}
}
}
[Obsolete]
public class ElementBinder : EmptyBinder {
public override object ChangeType(object value, Type type, CultureInfo culture) {
if (value is string) {
if (type == typeof(SkinSelectors)) {
return new SkinSelectors((string)value);
}
}
return base.ChangeType(value, type, culture);
}
}
[Obsolete]
public interface IConstructable {
void Load(object data, IEvaluator etor);
}
#endif
#endregion
public class PdtSkin : SkinElement { }
[Binder(typeof(SkinElementBinder))]