示例#1
0
        bool FastArrayGet(IntPtr isolate, IntPtr info, IntPtr self, object obj, uint index)
        {
            bool hited = true;
            var  type  = obj.GetType();

            if (type == typeof(int[]))
            {
                int[] array = obj as int[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(float[]))
            {
                float[] array = obj as float[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(double[]))
            {
                double[] array = obj as double[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(bool[]))
            {
                bool[] array = obj as bool[];
                PuertsDLL.ReturnBoolean(isolate, info, array[index]);
            }
            else if (type == typeof(long[]))
            {
                long[] array = obj as long[];
                PuertsDLL.ReturnBigInt(isolate, info, array[index]);
            }
            else if (type == typeof(ulong[]))
            {
                ulong[] array = obj as ulong[];
                PuertsDLL.ReturnBigInt(isolate, info, (long)array[index]);
            }
            else if (type == typeof(sbyte[]))
            {
                sbyte[] array = obj as sbyte[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(short[]))
            {
                short[] array = obj as short[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(ushort[]))
            {
                ushort[] array = obj as ushort[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(char[]))
            {
                char[] array = obj as char[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(uint[]))
            {
                uint[] array = obj as uint[];
                PuertsDLL.ReturnNumber(isolate, info, array[index]);
            }
            else if (type == typeof(string[]))
            {
                string[] array = obj as string[];
                string   str   = array[index];
                if (str == null)
                {
                    PuertsDLL.ReturnNull(isolate, info);
                }
                else
                {
                    PuertsDLL.ReturnString(isolate, info, str);
                }
            }
            else
            {
                hited = false;
            }
            return(hited);
        }
 public void SetString(IntPtr isolate, IntPtr holder, string str)
 {
     PuertsDLL.ReturnString(isolate, holder, str);
 }