/// <summary>
 ///     �ӵ������ͻ�����ת��ΪԪ����
 /// </summary>
 /// <param name="proxy">�ڴ�Ƭ�δ�����</param>
 /// <param name="attribute">�ֶ�����</param>
 /// <param name="analyseResult">�������</param>
 /// <param name="target">Ŀ�����ʵ��</param>
 /// <param name="isArrayElement">��ǰд���ֵ�Ƿ�Ϊ����Ԫ�ر�ʾ</param>
 public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
 {
     int value = analyseResult.GetValue<int>(target);
     proxy.WriteSByte((sbyte)attribute.PropertyType);
     proxy.WriteInt16(((short)attribute.Id).ToBigEndian());
     proxy.WriteInt32(value.ToBigEndian());
 }
 /// <summary>
 ///     �ӵ������ͻ�����ת��ΪԪ����
 /// </summary>
 /// <param name="proxy">�ڴ�Ƭ�δ�����</param>
 /// <param name="attribute">�ֶ�����</param>
 /// <param name="analyseResult">�������</param>
 /// <param name="target">Ŀ�����ʵ��</param>
 /// <param name="isArrayElement">��ǰд���ֵ�Ƿ�Ϊ����Ԫ�ر�ʾ</param>
 public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
 {
     string value = analyseResult.GetValue<string>(target);
     proxy.WriteSByte((sbyte)attribute.PropertyType);
     proxy.WriteInt16(((short)attribute.Id).ToBigEndian());
     byte[] data = Encoding.UTF8.GetBytes(value);
     proxy.WriteInt32(data.Length.ToBigEndian());
     proxy.WriteMemory(data, 0, (uint) data.Length);
 }
 /// <summary>
 ///     �ӵ������ͻ�����ת��ΪԪ����
 /// </summary>
 /// <param name="proxy">�ڴ�Ƭ�δ�����</param>
 /// <param name="attribute">�ֶ�����</param>
 /// <param name="analyseResult">�������</param>
 /// <param name="target">Ŀ�����ʵ��</param>
 /// <param name="isArrayElement">��ǰд���ֵ�Ƿ�Ϊ����Ԫ�ر�ʾ</param>
 public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
 {
     MessageIdentity value = analyseResult.GetValue<MessageIdentity>(target);
     byte[] data = Encoding.UTF8.GetBytes(value.Command);
     proxy.WriteInt32(value.Version.ToBigEndian());
     proxy.WriteInt32(((int)value.CommandLength).ToBigEndian());
     proxy.WriteMemory(data, 0, (uint)data.Length);
     proxy.WriteInt32(((int)value.SequenceId).ToBigEndian());
 }
        /// <summary>
        ///     从第三方客户数据转换为元数据
        /// </summary>
        /// <param name="proxy">内存片段代理器</param>
        /// <param name="attribute">字段属性</param>
        /// <param name="analyseResult">分析结果</param>
        /// <param name="target">目标对象实例</param>
        /// <param name="isArrayElement">当前写入的值是否为数组元素标示</param>
        public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
        {
            byte[] value = analyseResult.GetValue<byte[]>(target);
            proxy.WriteSByte((sbyte)attribute.PropertyType);
            proxy.WriteInt16(attribute.Id.ToBigEndian());

            //proxy.WriteByte((byte)PropertyTypes.String);
            proxy.WriteInt32(value.Length.ToBigEndian());
            proxy.WriteMemory(value, 0, (uint) value.Length);
        }
        /// <summary>
        ///     从第三方客户数据转换为元数据
        /// </summary>
        /// <param name="proxy">内存片段代理器</param>
        /// <param name="attribute">字段属性</param>
        /// <param name="analyseResult">分析结果</param>
        /// <param name="target">目标对象实例</param>
        /// <param name="isArrayElement">当前写入的值是否为数组元素标示</param>
        public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
        {
            string[] value = analyseResult.GetValue<string[]>(target);
            proxy.WriteSByte((sbyte)attribute.PropertyType);
            proxy.WriteInt16(attribute.Id.ToBigEndian());

            proxy.WriteByte((byte)PropertyTypes.String);
            proxy.WriteInt32(value.Length.ToBigEndian());
            foreach (string data in value)
            {
                byte[] bytes = Encoding.UTF8.GetBytes(data);
                proxy.WriteInt32(bytes.Length.ToBigEndian());
                proxy.WriteMemory(bytes, 0, (uint)data.Length);
            }
        }
        /// <summary>
        ///     从第三方客户数据转换为元数据
        /// </summary>
        /// <param name="proxy">内存片段代理器</param>
        /// <param name="attribute">字段属性</param>
        /// <param name="analyseResult">分析结果</param>
        /// <param name="target">目标对象实例</param>
        /// <param name="isArrayElement">当前写入的值是否为数组元素标示</param>
        /// <param name="isNullable">是否为可空字段标示</param>
        public override void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false)
        {
            Dictionary<string, Cell> value = analyseResult.GetValue<Dictionary<string, Cell>>(target);
            if (value == null) return;
            proxy.WriteSByte((sbyte)attribute.PropertyType);
            proxy.WriteInt16(attribute.Id.ToBigEndian());
            proxy.WriteByte((byte)PropertyTypes.String);
            proxy.WriteByte((byte)PropertyTypes.Struct);
            proxy.WriteInt32((value.Count).ToBigEndian());
            foreach (KeyValuePair<string, Cell> pair in value)
            {
                byte[] data = Encoding.UTF8.GetBytes(pair.Key);
                proxy.WriteInt32(data.Length.ToBigEndian());
                proxy.WriteMemory(data, 0, (uint)data.Length);

                pair.Value.Bind();
                data = pair.Value.Body;
                proxy.WriteMemory(data, 0, (uint)data.Length);
            }
        }
 /// <summary>
 ///     �ӵ������ͻ�����ת��ΪԪ����
 /// </summary>
 /// <param name="proxy">�ڴ�Ƭ�δ�����</param>
 /// <param name="attribute">�ֶ�����</param>
 /// <param name="analyseResult">�������</param>
 /// <param name="target">Ŀ�����ʵ��</param>
 /// <param name="isArrayElement">��ǰд���ֵ�Ƿ�Ϊ����Ԫ�ر�ʾ</param>
 /// <param name="isNullable">�Ƿ�Ϊ�ɿ��ֶα�ʾ</param>
 public abstract void Process(IMemorySegmentProxy proxy, ThriftPropertyAttribute attribute, ToBytesAnalyseResult analyseResult, object target, bool isArrayElement = false, bool isNullable = false);