123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace HPSocketCS.Extended
- {
- /// <summary>
- ///请求数据处理类
- /// </summary>
- [Serializable]
- public class RequestData
- {
- public RequestData() {
-
- }
- public RequestData(int rCommand)
- {
- this._RequestCommand = rCommand;
- }
- private Int32 _RequestCommand;
- /// <summary>
- /// 请求命令
- /// </summary>
- public Int32 RequestCommand
- {
- get { return _RequestCommand; }
- set { _RequestCommand = value; }
- }
- byte[] _AttachedData = null;
- /// <summary>
- /// 附加数据
- /// </summary>
- public byte[] AttachedData
- {
- get { return _AttachedData; }
- set { _AttachedData = value; }
- }
- string _AttachedMessage = "";
- /// <summary>
- /// 附加消息
- /// </summary>
- public string AttachedMessage
- {
- get { return _AttachedMessage; }
- set { _AttachedMessage = value; }
- }
- /// <summary>
- /// 将附加数据字节娄组转为对象
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- public T AttachedDataToObject<T>()
- {
- try
- {
- return (T)HPSocketCS.Extended.DataSetSerializerDeserialize.ObjectDeserialize(this._AttachedData);
- }
- catch
- {
- return default(T);
- }
- }
- }
- }
|