/// <exception cref="Kirikiri.Tjs2.VariantException"></exception>
/// <exception cref="Kirikiri.Tjs2.TJSException"></exception>
private static Dispatch2 GetResultArray(bool matched, RegExpNI _this, Matcher m)
{
Dispatch2 array = TJS.CreateArrayObject();
if (matched)
{
if (_this.RegEx == null)
{
Variant val = new Variant(string.Empty);
array.PropSetByNum(Interface.MEMBERENSURE | Interface.IGNOREPROP, 0, val, array);
}
else
{
if (m != null)
{
bool isMatch = m.Matches();
Variant val;
if (isMatch)
{
val = new Variant(m.Group(0));
array.PropSetByNum(Interface.MEMBERENSURE | Interface.IGNOREPROP, 0, val, array);
}
int size = m.GroupCount();
for (int i = 0; i < size; i++)
{
val = new Variant(m.Group(i + 1));
array.PropSetByNum(Interface.MEMBERENSURE | Interface.IGNOREPROP, i + 1, val, array
);
}
}
}
}
return array;
}