Beispiel #1
0
        /// <summary>
        /// 获取对象基本信息
        /// </summary>
        /// <param name="buf">序列化数据</param>
        /// <param name="obj">数据标识</param>
        public static void GetNetObjBase(byte[] buf, out NetObject obj)
        {
            obj = new NetObject();

            ArrayHelper arr = new ArrayHelper(NetBase.CommonEncoding, buf);

            try
            {
                obj.Mark = arr.DequeueInt32();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("解析对象标识异常: {0}", ex.ToString()), ex);
            }
            try
            {
                obj.Name = arr.DequeueStringWithoutEndChar(NetBase.CommonEncoding);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("解析对象名称异常,标识为: {0}, 详细异常: {1}", obj.Mark, ex.ToString()), ex);
            }
            try
            {
                obj.Version = arr.DequeueInt32();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("解析对象版本异常,标识为: {0}, 名称为: {1}, 详细异常: {2}", obj.Mark, obj.Name, ex.ToString()), ex);
            }
            try
            {
                obj.TaskID = arr.DequeueInt32();
            }
            catch
            {
            }
            obj.Datas = buf;
        }
Beispiel #2
0
 public static bool IsSame(this NetObject source, NetObjectAttribute dest)
 {
     return(source.Name.Equals(dest.Name) && source.Version.Equals(dest.Version));
 }