/// <summary>
        ///     从元数据转换为第三方客户数据
        /// </summary>
        /// <param name="instance">目标对象</param>
        /// <param name="result">分析结果</param>
        /// <param name="container">网络数据容器</param>
        public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
        {
            byte keyType, valueType;
            int count;
            if (!container.TryReadByte(out keyType)) return GetObjectResultTypes.NotEnoughData;
            if (!container.TryReadByte(out valueType)) return GetObjectResultTypes.NotEnoughData;
            if (!container.TryReadInt32(out count)) return GetObjectResultTypes.NotEnoughData;
            count = count.ToLittleEndian();
            Dictionary<string, string> value = new Dictionary<string, string>(count);
            for (int i = 0; i < count; i++)
            {
                int stringCount;
                if (!container.TryReadInt32(out stringCount)) return GetObjectResultTypes.NotEnoughData;
                stringCount = stringCount.ToLittleEndian();
                string keyContent;
                if (!container.TryReadString(Encoding.UTF8, stringCount, out keyContent)) return GetObjectResultTypes.NotEnoughData;

                if (!container.TryReadInt32(out stringCount)) return GetObjectResultTypes.NotEnoughData;
                stringCount = stringCount.ToLittleEndian();
                string valueContent;
                if (!container.TryReadString(Encoding.UTF8, stringCount, out valueContent)) return GetObjectResultTypes.NotEnoughData;
                value.Add(keyContent, valueContent);
            }
            result.SetValue(instance, value);
            return GetObjectResultTypes.Succeed;
        }
Exemplo n.º 2
0
        /// <summary>
        ///     从元数据转换为第三方客户数据
        /// </summary>
        /// <param name="instance">目标对象</param>
        /// <param name="result">分析结果</param>
        /// <param name="container">网络数据容器</param>
        public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
        {
            byte keyType, valueType;
            int  count;

            if (!container.TryReadByte(out keyType))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            if (!container.TryReadByte(out valueType))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            if (!container.TryReadInt32(out count))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            count = count.ToLittleEndian();
            Dictionary <string, string> value = new Dictionary <string, string>(count);

            for (int i = 0; i < count; i++)
            {
                int stringCount;
                if (!container.TryReadInt32(out stringCount))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }
                stringCount = stringCount.ToLittleEndian();
                string keyContent;
                if (!container.TryReadString(Encoding.UTF8, stringCount, out keyContent))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }

                if (!container.TryReadInt32(out stringCount))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }
                stringCount = stringCount.ToLittleEndian();
                string valueContent;
                if (!container.TryReadString(Encoding.UTF8, stringCount, out valueContent))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }
                value.Add(keyContent, valueContent);
            }
            result.SetValue(instance, value);
            return(GetObjectResultTypes.Succeed);
        }
        /// <summary>
        ///     从元数据转换为第三方客户数据
        /// </summary>
        /// <param name="instance">目标对象</param>
        /// <param name="result">分析结果</param>
        /// <param name="container">网络数据容器</param>
        public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
        {
            byte type;
            int  count;

            if (!container.TryReadByte(out type))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            if (!container.TryReadInt32(out count))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            count = count.ToLittleEndian();
            string[] value = new string[count];
            for (int i = 0; i < count; i++)
            {
                int length;
                if (!container.TryReadInt32(out length))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }
                length = length.ToLittleEndian();
                string content;
                if (!container.TryReadString(Encoding.UTF8, length, out content))
                {
                    return(GetObjectResultTypes.NotEnoughData);
                }
                value[i] = content;
            }
            result.SetValue(instance, value);
            return(GetObjectResultTypes.Succeed);
        }
 /// <summary>
 ///     ��Ԫ����ת��Ϊ�������ͻ�����
 /// </summary>
 /// <param name="instance">Ŀ�����</param>
 /// <param name="result">�������</param>
 /// <param name="container">������������</param>
 public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
 {
     int value;
     if(!container.TryReadInt32(out value)) return GetObjectResultTypes.NotEnoughData;
     value = value.ToLittleEndian();
     string content;
     if (!container.TryReadString(Encoding.UTF8, value, out content)) return GetObjectResultTypes.NotEnoughData;
     result.SetValue(instance, content);
     return GetObjectResultTypes.Succeed;
 }
        /// <summary>
        ///     从元数据转换为第三方客户数据
        /// </summary>
        /// <param name="instance">目标对象</param>
        /// <param name="result">分析结果</param>
        /// <param name="container">网络数据容器</param>
        public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
        {
            int value;

            if (!container.TryReadInt32(out value))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            value = value.ToLittleEndian();
            string content;

            if (!container.TryReadString(Encoding.UTF8, value, out content))
            {
                return(GetObjectResultTypes.NotEnoughData);
            }
            result.SetValue(instance, content);
            return(GetObjectResultTypes.Succeed);
        }
 /// <summary>
 ///     从元数据转换为第三方客户数据
 /// </summary>
 /// <param name="instance">目标对象</param>
 /// <param name="result">分析结果</param>
 /// <param name="container">网络数据容器</param>
 public override GetObjectResultTypes Process(object instance, GetObjectAnalyseResult result, INetworkDataContainer container)
 {
     byte type;
     int count;
     if (!container.TryReadByte(out type)) return GetObjectResultTypes.NotEnoughData;
     if (!container.TryReadInt32(out count)) return GetObjectResultTypes.NotEnoughData;
     count = count.ToLittleEndian();
     string[] value = new string[count];
     for (int i = 0; i < count; i++)
     {
         int length;
         if (!container.TryReadInt32(out length)) return GetObjectResultTypes.NotEnoughData;
         length = length.ToLittleEndian();
         string content;
         if (!container.TryReadString(Encoding.UTF8, length, out content)) return GetObjectResultTypes.NotEnoughData;
         value[i] = content;
     }
     result.SetValue(instance, value);
     return GetObjectResultTypes.Succeed;
 }