Ejemplo n.º 1
1
        public int FindRow(int col, VarList.VarData key, int begRow, bool ignoreCase)
        {
            if (col >= GetColcount())
            {
                return(-1);
            }

            if (null == key)
            {
                return(-1);
            }

            int row_num = GetRowCount();

            if (begRow > row_num)
            {
                return(-1);
            }

            int nColType = GetColType(col);

            if (0 == nColType)
            {
                return(-1);
            }

            for (int i = begRow; i < row_num; i++)
            {
                VarList rowValueItem = rowSet[i];
                if (null == rowValueItem || 0 == rowValueItem.GetCount())
                {
                    return(-1);
                }

                switch (nColType)
                {
                case VarType.Bool:
                    if (rowValueItem.GetBool(col) == (bool)key.Data)
                    {
                        return(i);
                    }
                    break;

                case VarType.Int:
                    if (rowValueItem.GetInt(col) == (int)key.Data)
                    {
                        return(i);
                    }
                    break;

                case VarType.Int64:
                    if (rowValueItem.GetInt64(col) == (long)key.Data)
                    {
                        return(i);
                    }
                    break;

                case VarType.Float:
                    if (Tools.FloatEqual(rowValueItem.GetFloat(col), (float)key.Data))
                    {
                        return(i);
                    }
                    break;

                case VarType.Double:
                    if (Tools.DoubleEqual(rowValueItem.GetDouble(col), (double)key.Data))
                    {
                        return(i);
                    }
                    break;

                case VarType.String:
                    if (0 == String.Compare(rowValueItem.GetString(col), key.Data as string, ignoreCase))
                    {
                        return(i);
                    }
                    break;

                case VarType.WideStr:
                    if (0 == String.Compare(rowValueItem.GetWideStr(col), key.Data as string, ignoreCase))
                    {
                        return(i);
                    }
                    break;

                case VarType.Object:
                    if (rowValueItem.GetObject(col).Equals(key.Data as ObjectID))
                    {
                        return(i);
                    }
                    break;

                default:
                    break;
                }
            }
            return(-1);
        }
Ejemplo n.º 2
1
        public bool GetValue(int row, int col, ref VarList.VarData result)
        {
            if (row < 0 || col < 0 || row >= GetRowCount() || col >= GetColcount())
            {
                //Log.Trace("Error,GameRecord.GetValue row or col out of range:");
                return(false);
            }

            try
            {
                VarList rowItem = rowSet[row];
                if (rowItem == null)
                {
                    return(false);
                }

                if (rowItem.GetCount() != GetColcount())
                {
                    //Log.Trace("Error,GameRecord.GetValue Col Error:");
                    return(false);
                }

                switch (colTypes[col])
                {
                case VarType.Bool:
                {
                    bool value = rowItem.GetBool(col);
                    result.Data = value;
                }

                break;

                case VarType.Int:
                {
                    int value = rowItem.GetInt(col);
                    result.Data = value;
                }
                break;

                case VarType.Int64:
                {
                    long value = rowItem.GetInt64(col);
                    result.Data = value;
                }
                break;

                case VarType.Float:
                {
                    float value = rowItem.GetFloat(col);
                    result.Data = value;
                }
                break;

                case VarType.Double:
                {
                    double value = rowItem.GetDouble(col);
                    result.Data = value;
                }
                break;

                case VarType.String:
                {
                    string value = rowItem.GetString(col);
                    result.Data = value;
                }
                break;

                case VarType.WideStr:
                {
                    string value = rowItem.GetWideStr(col);
                    result.Data = value;
                }
                break;

                case VarType.Object:
                {
                    ObjectID value = rowItem.GetObject(col);
                    if (value.IsNull())
                    {
                        //Log.Trace("Error,GameRecord.GetValue objid is null:");
                        return(false);
                    }
                    result.Data = value;
                }
                break;

                default:
                    //Log.Trace("Error,GameRecord.GetValue type error:");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                //Log.Trace("Error,GameRecord.GetValue Exception:" + ex.ToString());
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        //发送请求移动消息
        //public bool RequestMove(int mode, int arg_num, float[] args, string info)
        public bool RequestMove(ref VarList args, ref VarList ret)
        {
            try
            {
                if (args.GetCount() < 1)
                {
                    ret.AddBool(false);
                    return(false);
                }

                int mode    = args.GetInt(0);
                int arg_num = args.GetCount() - 1;

                StoreArchive ar = StoreArchive.Load(m_buffer, m_buffer.Length);
                ar.WriteInt8(GlobalClineMsgId.CLIENT_REQUEST_MOVE);//消息ID
                ar.WriteInt8(mode);
                ar.WriteInt16(arg_num);

                for (int i = 0; i < arg_num; i++)
                {
                    float value = args.GetFloat(1 + i);
                    ar.WriteFloat(value);
                }

                return(m_sender.Send(ar.GetData(), ar.GetLength()));
            }
            catch (System.Exception ex)
            {
                LogSystem.LogError(ex);
                return(false);
            }
        }
Ejemplo n.º 4
0
        //发送请求移动消息
        //public bool RequestMove(int mode, int arg_num, float[] args, string info)
        public bool RequestMove(ref VarList args, ref VarList ret)
        {
            try
            {
                if (args.GetCount() < 3)
                {
                    //Log.Trace(" arguments count must be > 3");
                    ret.AddBool(false);
                    return(false);
                }

                int mode    = args.GetInt(0);
                int arg_num = args.GetInt(1);
                if (arg_num > 256)
                {
                    //Log.Trace("more arguments");
                    ret.AddBool(false);
                    return(false);
                }

                if (args.GetCount() < (arg_num + 2))
                {
                    //Log.Trace("too few arguments");
                    ret.AddBool(false);
                    return(false);
                }

                StoreArchive ar = new StoreArchive(m_buffer, m_buffer.Length);
                ar.WriteInt8(GlobalClineMsgId.CLIENT_REQUEST_MOVE);//消息ID
                ar.WriteInt8(mode);
                ar.WriteInt16(arg_num);

                for (int i = 0; i < arg_num; i++)
                {
                    float value = args.GetFloat(2 + i);
                    ar.WriteFloat(value);
                }

                string info = "";
                if (args.GetCount() > (arg_num + 2))
                {
                    info = args.GetString(arg_num + 2);
                }

                ar.WriteStringNoLen(info);
                return(m_sender.Send(ar.GetData(), ar.GetLength()));
            }
            catch (System.Exception ex)
            {
                Log.TraceExcep(ref ex);
                return(false);
            }
        }
Ejemplo n.º 5
0
        public bool SetInt64(int row, int col, Int64 result)
        {
            if (row >= GetRowCount() || col >= GetColcount() || row < 0 || col < 0)
            {
                return(false);
            }

            VarList rowItem = rowSet[row];

            if (rowItem == null)
            {
                return(false);
            }

            if (col < rowItem.GetCount())
            {
                rowItem.SetInt64(col, result);
            }
            else
            {
                rowItem.AddInt64(result);
            }

            return(true);
        }
Ejemplo n.º 6
0
        public bool Custom(ref VarList args)
        {
            StoreArchive ar = StoreArchive.Load(m_buffer, m_buffer.Length);


            int iCount = args.GetCount();

            if (!AddMsgVarList(ref ar, ref args, 0, iCount))
            {
                return(false);
            }
            Array.Clear(varifyCustom, 0, varifyCustom.Length);
            fxVerify.GetCustomVerify(mCustomIndex, iCount, ar.GetData(), ar.GetLength(), ref varifyCustom);

            ar = StoreArchive.Load(m_buffer, m_buffer.Length);

            ar.WriteInt8(GlobalClineMsgId.CLIENT_CUSTOM); //消息ID
            ar.WriteUserDataNoLen(varifyCustom);          //校验码

            ar.WriteInt32(mCustomIndex++);
            ar.WriteInt16(iCount);

            if (!AddMsgVarList(ref ar, ref args, 0, iCount))
            {
                LogSystem.Log("add para error");
                return(false);
            }
            return(m_sender.Send(ar.GetData(), ar.GetLength()));
        }
Ejemplo n.º 7
0
    /* @brief: 分发表格删除指定内容消息
     *   @param:回调参数列表
     *   @return void
     */
    public static void onTableDelete(VarList args)
    {
        int    index     = 2;
        string tableName = args.GetString(index++);
        int    row       = args.GetInt(index++);

        List <ITable> iTabel;

        if (mRecords.TryGetValue(tableName, out iTabel) &&
            iTabel != null &&
            mRecordCols.ContainsKey(tableName))
        {
            int iCols = mRecordCols[tableName];
            for (int i = 0; i < iTabel.Count; i++)
            {
                if (iTabel[i] != null)
                {
                    try
                    {
                        iTabel[i].on_table_delete(tableName, args, row, (args.GetCount() - index) / iCols, iCols, index);
                    }
                    catch (System.Exception e)
                    {
                        LogSystem.LogError(e.ToString());
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
        // wstring
        //public bool SetValue(int row, int col, string result)
        //{
        //    if (row >= GetRowCount() || col >= GetColcount() || row < 0 || col < 0)
        //    {
        //        return false;
        //    }

        //    VarList rowItem = rowSet[row];
        //    if (rowItem == null)
        //    {
        //        return false;
        //    }

        //    if (col < rowItem.GetCount())
        //    {
        //        rowItem.SetString(col, result);
        //    }
        //    else
        //    {
        //        rowItem.AddString(result);
        //    }

        //    return true;
        //}

        // OBJECITID
        public bool SetValue(int row, int col, ObjectID result)
        {
            if (row >= GetRowCount() || col >= GetColcount() || row < 0 || col < 0)
            {
                return(false);
            }

            VarList rowItem = rowSet[row];

            if (rowItem == null)
            {
                return(false);
            }

            if (col < rowItem.GetCount())
            {
                rowItem.SetObject(col, result);
            }
            else
            {
                rowItem.AddObject(result);
            }

            return(true);
        }
Ejemplo n.º 9
0
        //加密消息,获得校验码
        public byte[] Encode(ref VarList args, int size)
        {
            if (!Ready)
            {
                return(new byte[size]);
            }
            byte[] data  = new byte[256];
            int    index = 0;

            //服务器序号
            WriteInt32(ref data, ref index, nSerial);
            //客户端序号
            WriteInt16(ref data, ref index, nMsgSerial);
            //参数数目
            WriteInt16(ref data, ref index, (uint)args.GetCount());

            int requireLen = MsgVarListLen(ref args, 0, args.GetCount());

            byte[] info = new byte[requireLen + 1];

            int arg_len = 0;

            if (!AddMsgVarList(ref info, ref arg_len, ref args, 0, args.GetCount()))
            {
                Log.Trace("add para error");
                return(null);
            }

            if (arg_len <= 8)
            {
                //小于等于8个字节,全部参与计算
                Array.Copy(info, 0, data, index, arg_len);
                index += arg_len;
            }
            else
            {
                //用前4个和后4个字节
                Array.Copy(info, 0, data, index, 4);
                index += 4;
                Array.Copy(info, arg_len - 4, data, index, 4);
                index += 4;
            }

            return(Encode(data, index, size));
        }
Ejemplo n.º 10
0
        public bool QueryRowValue(int row, ref VarList rowValue)
        {
            if (row >= GetRows())
            {
                return(false);
            }

            rowValue = (VarList)rowSet[row].CloneList();

            return(rowValue.GetCount() > 0);
        }
Ejemplo n.º 11
0
        public bool CreateRole(ref VarList args)
        {
            try
            {
                if ((args.GetCount() < 2) || (args.GetType(1) != VarType.WideStr))
                {
                    LogSystem.Log("arguments error");
                    return(false);
                }

                string roleName = args.GetWideStr(1);
                //role name
                byte[] name = new byte[ServerInfo.ROLENAME_MAX_LENGTH * 2 + 1];

                Array.Copy(System.Text.Encoding.Default.GetBytes(roleName), name, roleName.Length);

                //verify
                // byte[] verify = new byte[16];

                StoreArchive ar = StoreArchive.Load(m_buffer, m_buffer.Length);

                ar.WriteInt8(GlobalClineMsgId.CLIENT_CREATE_ROLE);
                ar.WriteInt32(args.GetInt(0));
                ar.WriteUnicodeLen(roleName, (ServerInfo.ROLENAME_MAX_LENGTH + 1) * 2);
                ///ar.WriteUserDataNoLen(verify);
                ar.WriteUInt16((uint)(args.GetCount() - 2));
                ///ar.WriteInt32();

                if (!AddMsgVarList(ar, args, 2, args.GetCount()))
                {
                    return(false);
                }

                return(m_sender.Send(ar.GetData(), ar.GetLength()));
            }
            catch (System.Exception ex)
            {
                LogSystem.LogError(ex);
                return(false);
            }
        }
Ejemplo n.º 12
0
        public bool Custom(ref VarList args)
        {
            StoreArchive ar = new StoreArchive(m_buffer, m_buffer.Length);

            ar.WriteInt8(GlobalClineMsgId.CLIENT_CUSTOM);//消息ID

            //校验码4个字节,对消息加密获取验证码
            byte[] varify = MsgEncode.Instance.Encode(ref args, 4);
            ar.WriteUserDataNoLen(varify);
            ar.WriteInt16(MsgEncode.Instance.MsgSerial);
            ar.WriteInt16(args.GetCount());
            Log.Trace("Custom");
            if (!AddMsgVarList(ref ar, ref args, 0, args.GetCount()))
            {
                Log.Trace("add para error");
                return(false);
            }
            Log.Trace("Send");

            MsgEncode.Instance.MsgSerial++;

            return(m_sender.Send(ar.GetData(), ar.GetLength()));
        }
Ejemplo n.º 13
0
    public static void PrintVarlist(string strTitle, VarList args, bool flag = false)
    {
        if (!flag)
        {
            return;
        }
        string str = UtilTools.StringBuilder("[", strTitle, " ", DateTime.Now.ToLongTimeString(), "]");

        for (int i = 0; i < args.GetCount(); ++i)
        {
            switch (args.GetType(i))
            {
            case VarType.Bool:
                str += (args.GetBool(i) ? "true" : "false");
                break;

            case VarType.Int:
                str += args.GetInt(i);
                break;

            case VarType.String:
                str += args.GetString(i);
                break;

            case VarType.WideStr:
                str += args.GetWideStr(i);
                break;

            case VarType.Object:
                str += args.GetObject(i);
                break;

            case VarType.Int64:
                str += args.GetInt64(i);
                break;

            case VarType.Float:
                str += args.GetFloat(i);
                break;

            default:
                str += "unknown";
                break;
            }

            str += " | ";
        }
        LogSystem.Log(str);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 赋值VarList
    /// </summary>
    /// <param name="args"></param>
    /// <param name="index"></param>
    /// <param name="newList"></param>
    public static void CopyVarList(ref VarList args, ref VarList newList, int start, int count)
    {
        int index = start;

        for (; index < args.GetCount() && count > 0; index++, count--)
        {
            int type = args.GetType(index);

            switch (type)
            {
            case VarType.Bool:
                newList.AddBool(args.GetBool(index));
                break;

            case VarType.Int:
                newList.AddInt(args.GetInt(index));
                break;

            case VarType.String:
                newList.AddString(args.GetString(index));
                break;

            case VarType.WideStr:
                newList.AddWideStr(args.GetWideStr(index));
                break;

            case VarType.Object:
                newList.AddObject(args.GetObject(index));
                break;

            case VarType.Float:
                newList.AddFloat(args.GetFloat(index));
                break;

            case VarType.Double:
                newList.AddDouble(args.GetDouble(index));
                break;

            case VarType.Int64:
                newList.AddInt64(args.GetInt64(index));
                break;
            }
        }
    }
Ejemplo n.º 15
0
    /// <summary>
    /// 文本协议Socket消息接受,只用于获取服务器列表数据
    /// </summary>
    /// <param name="textSock"></param>
    /// <param name="args"></param>
    static void OnTextSockRecieveData(TextSock textSock, ref VarList args)
    {
        LogSystem.Log("OnTextSockRecieveData");
        int count = args.GetCount();

        if (count <= 0)
        {
            LogSystem.Log("OnTextSockRecieveData param null");
            return;
        }
        ///消息头
        string strHeader = args.GetString(0);

        LogSystem.Log("OnTextSockRecieveData", strHeader);
        if (strHeader.Equals("svrlist"))
        {
            ///服务器列表
            string strServerName = args.GetString(1);
            string strMemberAddr = args.GetString(2);
            int    nMemberPort   = args.GetInt(3);
            int    iLoad         = args.GetInt(4);
            LogSystem.Log(strServerName, "|", strMemberAddr, "|", nMemberPort, "|", iLoad);
            textSock.Disconnect();
            if (string.IsNullOrEmpty(strServerName))
            {
                mstrMemberAddress   = strMemberAddr;
                mstrMemberPort      = nMemberPort;
                miRecieveMemberType = -2;
            }
            else
            {
                mstrMemberAddress   = strMemberAddr;
                mstrMemberPort      = nMemberPort;
                miRecieveMemberType = 1;
            }
        }
        else if (strHeader.Equals("version_error"))
        {
            miRecieveMemberType = 2;
        }
    }
Ejemplo n.º 16
0
    public static void on_msg_tracert(VarList args)
    {
        long fTimes = args.GetInt64(0);

        Game.Instance.mfDisplayTime_Ping = fTimes;
#if DEV
        int    iCount    = args.GetCount() - 1;
        string strInfo   = string.Empty;
        int    hoptypen  = 0;
        long   hopstampn = 0;
        for (int i = 1; i < iCount; i += 2)
        {
            hoptypen  = args.GetInt(i);
            hopstampn = args.GetInt64(i + 1);
            strInfo  += UtilTools.StringBuilder(hoptypen, "=", hopstampn, "\n");
        }
        Game.Instance.mstrServerNetInfo = strInfo;
#endif
        ///设置类型 + 时间戳为
        //LogSystem.Log("on_msg_tracert:",strInfo);
    }
Ejemplo n.º 17
0
        public bool CreateRole(ref VarList args)
        {
            try
            {
                if ((args.GetCount() < 2) || (args.GetType(1) != VarType.WideStr))
                {
                    //Log.Trace("arguments error");
                    return(false);
                }

                string roleName = args.GetWideStr(1);
                //role name
                //byte[] name = new byte[ServerInfo.ROLENAME_MAX_LENGTH * 2 + 1];
                //Array.Copy(System.Text.Encoding.Default.GetBytes(roleName), name, roleName.Length);

                //verify
                byte[] verify = new byte[4];

                //校验码4个字节,对消息加密获取验证码
                byte[] varify = MsgEncode.Instance.Encode(ref args, 4);

                StoreArchive ar = new StoreArchive(m_buffer, m_buffer.Length);
                ar.WriteInt8(GlobalClineMsgId.CLIENT_CREATE_ROLE);
                ar.WriteInt32(args.GetInt(0));
                ar.WriteUnicodeLen(roleName, (ServerInfo.ROLENAME_MAX_LENGTH + 1) * 2);
                ar.WriteInt16(1);
                ar.WriteInt8(2);
                ar.WriteInt32(args.GetInt(2));
                //ar.WriteUserDataNoLen(verify);
                ar.WriteUserDataNoLen(varify);
                ar.WriteInt8(0);
                return(m_sender.Send(ar.GetData(), ar.GetLength()));
            }
            catch (System.Exception ex)
            {
                Log.TraceExcep(ref ex);
                return(false);
            }
        }
Ejemplo n.º 18
0
        public void CloneObj(ref IGameObj obj, ref IGameObj cloneObj)
        {
            Dictionary <string, GameProperty> mPropSet = cloneObj.PropSets();

            foreach (KeyValuePair <string, GameProperty> kvp in mPropSet)
            {
                string key = kvp.Key;
                obj.UpdateProperty(ref key, kvp.Value.propValue.Clone());
            }


            VarList recordList = new VarList();

            cloneObj.GetRecordList(ref recordList);
            int count = recordList.GetCount();

            for (int i = 0; i < count; i++)
            {
                string     recordName = recordList.GetString(i);
                GameRecord record     = cloneObj.GetGameRecordByName(recordName).Clone();
                obj.AddRecord2Set(recordName, ref record);
            }
        }
Ejemplo n.º 19
0
        public int FindObject(int col, ObjectID key, int begRow = 0, bool ignoreCase = true)
        {
            if (col >= GetColcount())
            {
                return(-1);
            }

            int row_num = GetRowCount();

            if (begRow > row_num)
            {
                return(-1);
            }

            int nColType = GetColType(col);

            if (VarType.Object != nColType)
            {
                return(-1);
            }

            for (int i = begRow; i < row_num; i++)
            {
                VarList rowValueItem = rowSet[i];
                if (null == rowValueItem || 0 == rowValueItem.GetCount())
                {
                    return(-1);
                }
                if (rowValueItem.GetObject(col) == key)
                {
                    return(i);
                }
            }

            return(-1);
        }
Ejemplo n.º 20
0
        public void GetRoleInfo(ref VarList args, ref VarList ret)
        {
            try
            {
                if (mRoles == null || mRoles.Count == 0)
                {
                    return;
                }

                if (args == null || ret == null)
                {
                    return;
                }

                if (args.GetCount() == 0)
                {
                    return;
                }

                if (args.GetType(0) != VarType.Int)
                {
                    return;
                }

                int nIndex = args.GetInt(0);
                if (nIndex >= mRoles.Count)
                {
                    return;
                }

                VarList paraList = mRoles[nIndex].paraList;
                for (int i = 0; i < paraList.GetCount(); i++)
                {
                    switch (paraList.GetType(i))
                    {
                    case VarType.Bool:
                    {
                        ret.AddBool(paraList.GetBool(i));
                    }
                    break;

                    case VarType.Int:
                    {
                        ret.AddInt(paraList.GetInt(i));
                    }
                    break;

                    case VarType.Int64:
                    {
                        ret.AddInt64(paraList.GetInt64(i));
                    }
                    break;

                    case VarType.Float:
                    {
                        ret.AddFloat(paraList.GetFloat(i));
                    }
                    break;

                    case VarType.Double:
                    {
                        ret.AddDouble(paraList.GetDouble(i));
                    }
                    break;

                    case VarType.String:
                    {
                        ret.AddString(paraList.GetString(i));
                    }
                    break;

                    case VarType.WideStr:
                    {
                        ret.AddWideStr(paraList.GetWideStr(i));
                    }
                    break;

                    case VarType.Object:
                    {
                        ret.AddObject(paraList.GetObject(i));
                    }
                    break;

                    default:
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                //Log.Trace("GameReceiver.GetRoleInfo Exception:" + ex.ToString());
            }
            return;
        }
Ejemplo n.º 21
0
        public bool GetValue(int row, int col, ref Var result)
        {
            if (row < 0 || col < 0 || row >= GetRowCount() || col >= GetColcount())
            {
                return(false);
            }

            try
            {
                VarList rowItem = rowSet[row];


                if (rowItem.GetCount() != GetColcount())
                {
                    LogSystem.Log("Error,GameRecord.GetValue Col Error:");
                    return(false);
                }

                switch (colTypes[col])
                {
                case VarType.Bool:
                {
                    bool value = rowItem.GetBool(col);
                    result.SetBool(value);
                }

                break;

                case VarType.Int:
                {
                    int value = rowItem.GetInt(col);
                    result.SetInt(value);
                }
                break;

                case VarType.Int64:
                {
                    long value = rowItem.GetInt64(col);
                    result.SetInt64(value);
                }
                break;

                case VarType.Float:
                {
                    float value = rowItem.GetFloat(col);
                    result.SetFloat(value);
                }
                break;

                case VarType.Double:
                {
                    double value = rowItem.GetDouble(col);
                    result.SetDouble(value);
                }
                break;

                case VarType.String:
                {
                    string value = rowItem.GetString(col);
                    result.SetString(value);
                }
                break;

                case VarType.WideStr:
                {
                    string value = rowItem.GetWideStr(col);
                    result.SetWideStr(value);
                }
                break;

                case VarType.Object:
                {
                    ObjectID objId = rowItem.GetObject(col);
                    if (objId == null || objId.IsNull())
                    {
                        LogSystem.Log("Error,GameRecord.GetValue objid is null:");
                        return(false);
                    }
                    result.SetObject(objId);
                }
                break;

                default:
                    LogSystem.Log("Error,GameRecord.GetValue type error:");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Log("Error,GameRecord.GetValue Exception:", ex.ToString());
                return(false);
            }

            return(true);
        }
Ejemplo n.º 22
0
        public bool SetValue(int row, int col, Var result)
        {
            try
            {
                if (row >= GetRowCount() || col >= GetColcount() ||
                    row < 0 || col < 0)
                {
                    return(false);
                }

                if (null == result)
                {
                    return(false);
                }

                VarList rowItem = rowSet[row];
                if (rowItem == null)
                {
                    return(false);
                }

                if (col > rowItem.GetCount())
                {
                    //Log.Trace("col error col=" + col.ToString());
                    return(false);
                }

                switch (result.Type)
                {
                case VarType.Int:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetInt(col, result.GetInt());
                    }
                    else
                    {
                        rowItem.AddInt(result.GetInt());
                    }
                }
                break;

                case VarType.Int64:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetInt64(col, result.GetInt64());
                    }
                    else
                    {
                        rowItem.AddInt64(result.GetInt64());
                    }
                }
                break;

                case VarType.Float:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetFloat(col, result.GetFloat());
                    }
                    else
                    {
                        rowItem.AddFloat(result.GetFloat());
                    }
                }
                break;

                case VarType.Double:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetDouble(col, result.GetDouble());
                    }
                    else
                    {
                        rowItem.AddDouble(result.GetDouble());
                    }
                }
                break;

                case VarType.String:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetString(col, result.GetString());
                    }
                    else
                    {
                        rowItem.AddString(result.GetString());
                    }
                }
                break;

                case VarType.WideStr:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetWideStr(col, result.GetWideStr());
                    }
                    else
                    {
                        rowItem.AddWideStr(result.GetWideStr());
                    }
                }
                break;

                case VarType.Object:
                {
                    if (col < rowItem.GetCount())
                    {
                        rowItem.SetObject(col, result.GetObject());
                    }
                    else
                    {
                        rowItem.AddObject(result.GetObject());
                    }
                }
                break;

                default:
                    //Log.Trace("typer error type=" + result.Type.ToString());
                    return(false);
                }//end switch

                //rowSet[row] = rowItem;
                //int nCount = rowItem.GetCount();
                return(true);
            }
            catch (Exception ex)
            {
                Log.TraceExcep(ref ex);
                return(false);
            }
        }