예제 #1
0
        static int _m_CopyTo(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <string> gen_to_be_invoked = (System.Collections.Generic.List <string>)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <string[]>(L, 2))
                {
                    string[] _array = (string[])translator.GetObject(L, 2, typeof(string[]));

                    gen_to_be_invoked.CopyTo(
                        _array);



                    return(0);
                }
                if (gen_param_count == 3 && translator.Assignable <string[]>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    string[] _array      = (string[])translator.GetObject(L, 2, typeof(string[]));
                    int      _arrayIndex = LuaAPI.xlua_tointeger(L, 3);

                    gen_to_be_invoked.CopyTo(
                        _array,
                        _arrayIndex);



                    return(0);
                }
                if (gen_param_count == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <string[]>(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    int      _index      = LuaAPI.xlua_tointeger(L, 2);
                    string[] _array      = (string[])translator.GetObject(L, 3, typeof(string[]));
                    int      _arrayIndex = LuaAPI.xlua_tointeger(L, 4);
                    int      _count      = LuaAPI.xlua_tointeger(L, 5);

                    gen_to_be_invoked.CopyTo(
                        _index,
                        _array,
                        _arrayIndex,
                        _count);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<string>.CopyTo!"));
        }
예제 #2
0
        static int _m_CopyTo(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <object> __cl_gen_to_be_invoked = (System.Collections.Generic.List <object>)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 2 && translator.Assignable <object[]>(L, 2))
                {
                    object[] array = (object[])translator.GetObject(L, 2, typeof(object[]));

                    __cl_gen_to_be_invoked.CopyTo(array);



                    return(0);
                }
                if (__gen_param_count == 3 && translator.Assignable <object[]>(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3))
                {
                    object[] array      = (object[])translator.GetObject(L, 2, typeof(object[]));
                    int      arrayIndex = LuaAPI.xlua_tointeger(L, 3);

                    __cl_gen_to_be_invoked.CopyTo(array, arrayIndex);



                    return(0);
                }
                if (__gen_param_count == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <object[]>(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    int      index      = LuaAPI.xlua_tointeger(L, 2);
                    object[] array      = (object[])translator.GetObject(L, 3, typeof(object[]));
                    int      arrayIndex = LuaAPI.xlua_tointeger(L, 4);
                    int      count      = LuaAPI.xlua_tointeger(L, 5);

                    __cl_gen_to_be_invoked.CopyTo(index, array, arrayIndex, count);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.List<object>.CopyTo!"));
        }
예제 #3
0
        public void TestIList()
        {
            int i = 0;

            // Leseoperationen
            Reise r = (Reise)dieReisen[i];

            foreach (Reise r2 in dieReisen)
            {
                Console.WriteLine(r2.Zweck);
            }
            Reise[] arr = new Reise[] {};
            dieReisen.CopyTo(arr, 0);
            IEnumerator ie = dieReisen.GetEnumerator();


            // Schreiboperationen
            dieReisen.Add(r);
            dieReisen.Clear();
            dieReisen.Insert(0, r);
            dieReisen.Remove(r);
            dieReisen.RemoveAt(0);

            // Kann mit der bloöen Oid implementiert werden.
            bool b = dieReisen.Contains(r);

            dieReisen.IndexOf(r);
        }
예제 #4
0
 /// <summary>
 /// Convert a list of one type to an array of another type
 /// </summary>
 /// <typeparam name="L"></typeparam>
 /// <typeparam name="A"></typeparam>
 /// <param name="Items"></param>
 /// <param name="Conversion"></param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static A[] ConvertListToArray <L, A>(System.Collections.Generic.List <L> Items, Converter <L, A> Conversion)
 {
     //Use converter delegate to convert list into another list
     System.Collections.Generic.List <A> ConvertedList = Items.ConvertAll(Conversion);
     //Create an array to hold the data
     A[] ReturnArray = new A[ConvertedList.Count];
     //Copy the list to the array
     ConvertedList.CopyTo(ReturnArray);
     //All done
     return(ReturnArray);
 }
예제 #5
0
 public static object CreateClassInstance(string classPath, System.Collections.Generic.List <object> args)
 {
     string[] aPath = classPath.Split('.');
     for (int i = 0; i < aPath.Length; i++)
     {
         aPath[i] = aPath[i].Substring(0, 1).ToUpper() + aPath[i].Substring(1);
     }
     classPath = string.Join(".", aPath);
     //Console.WriteLine("[CreateClassInstance] " + classPath + " " + EncodeJson(args));
     object[] a = new object[args.Count];
     args.CopyTo(a);
     return(Activator.CreateInstance(Type.GetType(classPath), a));
 }
        // ===============================================================================
        //                                                                         Execute
        //                                                                         =======
        public override object Execute(object[] args)
        {
            // - - - - - - - - - - - -
            // This is top execution.
            // - - - - - - - - - - - -

            if (!ConditionBeanContext.IsExistConditionBeanOnThread())
            {
                // - - - - - - - - - -
                // Execute outsideSql.
                // - - - - - - - - - -
                if (OutsideSqlContext.IsExistOutsideSqlContextOnThread())
                {
                    OutsideSqlContext outsideSqlContext = OutsideSqlContext.GetOutsideSqlContextOnThread();
                    if (outsideSqlContext.IsDynamicBinding)
                    {
                        return(ExecuteOutsideSqlAsDynamic(args, outsideSqlContext));
                    }
                    else
                    {
                        return(ExecuteOutsideSqlAsStatic(args, outsideSqlContext));
                    }
                }

                // - - - - - - - - -
                // Execute default.
                // - - - - - - - - -
                return(ExecuteDefault(args));
            }

            // - - - - - - - - - - - -
            // Execute conditionBean.
            // - - - - - - - - - - - -
            IList <Object> bindVariableList     = new System.Collections.Generic.List <Object>();
            IList <Type>   bindVariableTypeList = new System.Collections.Generic.List <Type>();
            IList <String> bindVariableNameList = new System.Collections.Generic.List <String>();

            ConditionBean cb          = ConditionBeanContext.GetConditionBeanOnThread();
            String        finalClause = SetupRealClause(args, bindVariableList, bindVariableTypeList, bindVariableNameList);

            InternalBasicSelectHandler selectHandler = CreateBasicSelectHandler(finalClause, this.dataReaderHandler);

            Object[] bindVariableArray = new Object[bindVariableList.Count];
            bindVariableList.CopyTo(bindVariableArray, 0);
            Type[] bindVariableTypeArray = new Type[bindVariableTypeList.Count];
            bindVariableTypeList.CopyTo(bindVariableTypeArray, 0);
            String[] bindVariableNameArray = new String[bindVariableNameList.Count];
            bindVariableNameList.CopyTo(bindVariableNameArray, 0);
            selectHandler.LoggingMessageSqlArgs = bindVariableArray;
            return(selectHandler.Execute(bindVariableArray, bindVariableTypeArray, bindVariableNameArray));
        }
예제 #7
0
 public static PropInfo[] GetProps(object obj)
 {
     System.Reflection.BindingFlags bindingAttr = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public;
     System.Type type = obj.GetType();
     System.Collections.Generic.List <PropInfo> list       = new System.Collections.Generic.List <PropInfo>();
     System.Reflection.PropertyInfo[]           properties = type.GetProperties(bindingAttr);
     for (int i = 0; i < properties.Length; i++)
     {
         System.Reflection.PropertyInfo prop = properties[i];
         list.Add(new PropInfo(obj, prop));
     }
     System.Reflection.FieldInfo[] fields = type.GetFields(bindingAttr);
     for (int i = 0; i < fields.Length; i++)
     {
         System.Reflection.FieldInfo field = fields[i];
         list.Add(new PropInfo(obj, field));
     }
     PropInfo[] array = new PropInfo[list.Count];
     list.CopyTo(array);
     return(array);
 }
 public void CopyTo(ListViewGroupEx[] array, int arrayIndex)
 {
     list.CopyTo(array, arrayIndex);
 }
        protected Object ExecuteOutsideSqlAsDynamic(Object[] args, OutsideSqlContext outsideSqlContext)
        {
            Object firstArg = args[0];

            PropertyInfo[] properties  = firstArg.GetType().GetProperties();
            String         filteredSql = this.Sql;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            // Resolve embedded comment for parsing bind variable comment in embedded comment.
            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            for (int i = 0; i < properties.Length; i++)
            {
                PropertyInfo propertyInfo = properties[i];
                Type         propertyType = propertyInfo.PropertyType;
                if (!propertyType.Equals(typeof(String)))
                {
                    continue;
                }
                String outsideSqlPiece = (String)propertyInfo.GetValue(firstArg, null);
                if (outsideSqlPiece == null)
                {
                    continue;
                }
                String embeddedComment = "/*$pmb." + propertyInfo.Name + "*/";
                filteredSql = filteredSql.Replace(embeddedComment, outsideSqlPiece);
            }

            S2DaoSelectDynamicCommand outsideSqlCommand = CreateMySelectDynamicCommand();

            outsideSqlCommand.ArgNames = ArgNames;
            outsideSqlCommand.ArgTypes = ArgTypes;
            outsideSqlCommand.Sql      = filteredSql;

            // - - - - - - - - - - - - - - - - -
            // Find specified resultSetHandler.
            // - - - - - - - - - - - - - - - - -
            IDataReaderHandler specifiedDataReaderHandler = FindSpecifiedDataReaderHandler(args);

            // - - - - - - - - -
            // Filter arguments.
            // - - - - - - - - -
            Object[] filteredArgs;
            if (outsideSqlContext.IsSpecifiedOutsideSql)
            {
                Object parameterBean = outsideSqlContext.ParameterBean;
                filteredArgs = new Object[] { parameterBean };
            }
            else
            {
                filteredArgs = FilterArgumentsForDataReaderHandler(args);
            }

            ICommandContext ctx = outsideSqlCommand.DoApply(filteredArgs);
            IList <Object>  bindVariableList     = new System.Collections.Generic.List <Object>();
            IList <Type>    bindVariableTypeList = new System.Collections.Generic.List <Type>();
            IList <String>  bindVariableNameList = new System.Collections.Generic.List <String>();

            AddBindVariableInfo(ctx, bindVariableList, bindVariableTypeList, bindVariableNameList);
            InternalBasicSelectHandler selectHandler = CreateBasicSelectHandler(ctx.Sql, specifiedDataReaderHandler);

            Object[] bindVariableArray = new Object[bindVariableList.Count];
            bindVariableList.CopyTo(bindVariableArray, 0);
            Type[] bindVariableTypeArray = new Type[bindVariableTypeList.Count];
            bindVariableTypeList.CopyTo(bindVariableTypeArray, 0);
            String[] bindVariableNameArray = new String[bindVariableNameList.Count];
            bindVariableNameList.CopyTo(bindVariableNameArray, 0);
            selectHandler.LoggingMessageSqlArgs = bindVariableArray;
            return(selectHandler.Execute(bindVariableArray, bindVariableTypeArray, bindVariableNameArray));
        }
예제 #10
0
 public void CopyTo(T[] array, int arrayIndex)
 {
     list.CopyTo(array, arrayIndex);
 }
예제 #11
0
파일: List.cs 프로젝트: sasiit23/smah1
 public void CopyTo(T[] array)
 {
     list.CopyTo(array);
 }
예제 #12
0
 /// <summary>
 /// 将列表复制到一维数组。
 /// </summary>
 /// <param name="array">目标数组。</param>
 /// <param name="arrayIndex">目标数组起始位置。</param>
 public void CopyTo(IParameterInfo[] array, int arrayIndex)
 {
     _list.CopyTo(array, arrayIndex);
 }
예제 #13
0
 /// <summary>
 /// 将整个[元素]集合复制到兼容的一维数组中,从目标数组的指定索引位置开始放置。
 /// </summary>
 /// <param name="array"></param>
 /// <param name="arrayIndex"></param>
 public void CopyTo(T[] array, int arrayIndex)
 {
     Items.CopyTo(array, arrayIndex);
 }
예제 #14
0
 /// <summary>
 /// 将整个后台所连接的通道服务成员集合复制到兼容的一维数组中,从目标数组的指定索引位置开始放置。
 /// </summary>
 /// <param name="array"></param>
 /// <param name="arrayIndex"></param>
 public void CopyTo(ChannelDriveConnectMember[] array, int arrayIndex)
 {
     Items.CopyTo(array, arrayIndex);
 }