Пример #1
0
        internal static CefV8Value Invoke(CefV8Context context, XrayObject target, CefListValue args)
        {
            CefV8Value func    = target.Value;
            CefV8Value thisArg = CastCefValueToCefV8Value(context, args.GetValue(3), out bool isNewThisArg);

            int size     = (int)(args.GetSize() - 4);
            var xraylist = new List <int>(size);
            var fnArgs   = new CefV8Value[size];

            try
            {
                for (int i = 0; i < fnArgs.Length; i++)
                {
                    int index = (i + 4);
                    fnArgs[i] = CastCefValueToCefV8Value(context, args.GetValue(index), out bool isNew);
                    if (!isNew)
                    {
                        xraylist.Add(index);
                    }
                }
                return(func.ExecuteFunction(thisArg, fnArgs));
            }
            finally
            {
                for (int i = 0; i < fnArgs.Length; i++)
                {
                    if (!xraylist.Contains(i))
                    {
                        fnArgs[i].Dispose();
                    }
                }
            }
        }
Пример #2
0
        public static void Set(CefV8Context context, XrayObject target, CefListValue args)
        {
            CefV8Value thisArg = GetSafeThisArg(context, target);
            CefV8Value value   = CastCefValueToCefV8Value(context, args.GetValue(4), out bool isNotXray);

            thisArg.SetValueByKey(args.GetString(3), value, CefV8PropertyAttribute.None);
            if (isNotXray)
            {
                value.Dispose();
            }
        }
Пример #3
0
        public static long Get(CefV8Context context, XrayObject target, CefListValue args, out CefV8Value value)
        {
            CefV8Value   thisArg   = GetSafeThisArg(context, target);
            CefValue     arg3      = args.GetValue(3);
            CefValueType valueType = arg3.Type;

            if (valueType == CefValueType.Int)
            {
                value = thisArg.GetValueByIndex(arg3.GetInt());
                return(0);
            }

            string name = arg3.GetString();

            value = thisArg.GetValue(name);
            return(0);
        }
Пример #4
0
        internal static CefV8Value InvokeMember(CefV8Context context, XrayObject target, CefListValue args)
        {
            CefV8Value thisArg = GetSafeThisArg(context, target);
            CefV8Value func    = thisArg.GetValue(args.GetString(3));

            if (!func.IsFunction)
            {
                func.Dispose();
                throw new MissingMethodException();
            }

            int size     = (int)(args.GetSize() - 4);
            var xraylist = new List <int>(size);
            var fnArgs   = new CefV8Value[size];

            try
            {
                for (int i = 0; i < fnArgs.Length; i++)
                {
                    int index = (i + 4);
                    fnArgs[i] = CastCefValueToCefV8Value(context, args.GetValue(index), out bool isNew);
                    if (!isNew)
                    {
                        xraylist.Add(index);
                    }
                }
                return(func.ExecuteFunction(thisArg, fnArgs));
            }
            finally
            {
                func.Dispose();
                for (int i = 0; i < fnArgs.Length; i++)
                {
                    if (!xraylist.Contains(i))
                    {
                        fnArgs[i].Dispose();
                    }
                }
            }
        }
Пример #5
0
 public static long GetInt64(this CefListValue @this, int index)
 {
     return(GetInt64(() => @this.GetValue(index)));
 }
Пример #6
0
 public static DateTime GetTime(this CefListValue @this, int index)
 {
     return(GetTime(() => @this.GetValue(index)));
 }
Пример #7
0
 public static bool IsType(this CefListValue @this, int index, CefTypes type)
 {
     return(IsType(() => @this.GetValue(index), type));
 }