|
I am not an expert on Jint (yet). I wish I was. I am having a few issues of my own.
I'd look at other classes in Jint's native namespace. JsRegExpConstructor is a constructor that supports multiple arguments:
It overrides Execute instead of Construct and calls a constructor method depending on the number of args. Perhaps you can do something similar?
In JsPacketConstructor class:
public override JsInstance Execute(IJintVisitor visitor, JsDictionaryObject that, JsInstance[] parameters) {
if (parameters.Length == 0) {
return visitor.Return(New());
}
return visitor.Return(New(Convert.ToInt16(parameters[0].ToString()), Convert.ToBoolean(parameters[1].ToString())));
}
...
public JsObject New() { return New(0, false); }
public JsObject New(short p, bool f) { Global.WrapClr(new packet(p, f)); }
Anyway... not sure this works but I would look at the other constructor types in Jint's Native namespace if not.
|