Example #1
0
        /// <summary>
        /// 获取应答包内的字段和值的信息
        /// </summary>
        /// <param name="fastmsg">应答数据包</param>
        /// <param name="filedType">字段类型</param>
        /// <param name="filedIndex">字段索引</param>
        /// <returns></returns>
        public static string GetFastMsgValue(LDFastMessageAdapter fastmsg, int filedType, int filedIndex)
        {
            string filedValue = "";

            switch (filedType)
            {
            case LDSdkTag.TypeInt16:
            case LDSdkTag.TypeuInt16:
            case LDSdkTag.TypeInt32:
            case LDSdkTag.TypeuInt32:
                Int32 intValue = 0;

                intValue   = (int)fastmsg.GetInt32byIndex(filedIndex);
                filedValue = intValue.ToString();
                break;

            case LDSdkTag.TypeInt64:
            case LDSdkTag.TypeuInt64:
                Int64 longValue = 0;
                longValue  = (Int64)fastmsg.GetInt64byIndex(filedIndex);
                filedValue = longValue.ToString();
                break;

            case LDSdkTag.TypeDouble:
                double doubleValue = 0;
                doubleValue = fastmsg.GetDoublebyIndex(filedIndex);
                filedValue  = doubleValue.ToString();
                break;

            case LDSdkTag.TypeString:
            case LDSdkTag.TypeVector:

                filedValue = fastmsg.GetStringbyIndex(filedIndex);
                break;

            default:
                break;
            }
            return(filedValue);
        }