示例#1
0
        /// <exception cref="VariantException"></exception>
        /// <exception cref="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);
        }
 /// <exception cref="TjsException"></exception>
 /// <exception cref="VariantException"></exception>
 public virtual int PropSetByNum(int flag, int num, Variant param, Dispatch2 objThis
                                 )
 {
     if (mObject == null)
     {
         throw new TjsException(Error.NullAccess);
     }
     return(mObject.PropSetByNum(flag, num, param, mObjThis != null ? mObjThis : (objThis
                                                                                  != null ? objThis : mObject)));
 }
        /// <exception cref="VariantException"></exception>
        /// <exception cref="TjsException"></exception>
        public virtual int PropSetByNum(int flag, int num, Variant param, Dispatch2 objthis
                                        )
        {
            Dispatch2 OBJ1 = ((objthis != null) ? (objthis) : (mDispatch1));
            int       hr   = mDispatch1.PropSetByNum(flag, num, param, OBJ1);

            if (hr == Error.E_MEMBERNOTFOUND && mDispatch1 != mDispatch2)
            {
                Dispatch2 OBJ2 = ((objthis != null) ? (objthis) : (mDispatch2));
                return(mDispatch2.PropSetByNum(flag, num, param, OBJ2));
            }
            return(hr);
        }