You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
/*
|
|
Sog 游戏基础库
|
|
2016 by zouwei
|
|
*/
|
|
|
|
using System;
|
|
using System.Net;
|
|
using System.Text;
|
|
|
|
|
|
namespace SogClient
|
|
{
|
|
/// <summary>
|
|
/// 消息打包解包
|
|
/// </summary>
|
|
public interface IProtoPacker
|
|
{
|
|
// 消息附加头长度
|
|
int GetHeaderLength();
|
|
int GetFullHeaderLength();
|
|
|
|
|
|
/// <summary>
|
|
/// 打包头
|
|
/// </summary>
|
|
/// <param name="header"></param>
|
|
/// <param name="headerBytes"></param>
|
|
/// <returns>包头长度</returns>
|
|
int PackHeader(MessageHeader header, byte[] headerBytes);
|
|
|
|
/// <summary>
|
|
/// 返回包头长度,返回0表示失败
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <param name="offset"></param>
|
|
/// <param name="lenght"></param>
|
|
/// <param name="header"></param>
|
|
/// <returns></returns>
|
|
int UnPackHeader(byte[] data, int offset, int length, ref MessageHeader header);
|
|
|
|
//解包消息
|
|
bool UnpackMessage(MessageData message, out RequestPacket packet);
|
|
// 打包消息
|
|
bool PackMessage(RequestPacket packet, ref MessageData message);
|
|
|
|
//注册类型
|
|
void RegisterProtoType(int iMsgID, object obj);
|
|
}
|
|
}
|
|
|