using DotNetty.Buffers; using DotNetty.Transport.Channels; using System; using System.Text; using System.Threading.Tasks; namespace Team.Communicate { public abstract class AbstractTcpConnector { protected IByteBuffer ByteBuffers; private Encoding _encoding; public virtual Encoding Encoding { get => _encoding ?? Encoding.UTF8; set => _encoding = value; } public virtual void SetEnd(string endWith) { var bytes = Encoding.GetBytes(endWith); var sendBytes = Unpooled.Buffer(); sendBytes.WriteBytes(bytes); ByteBuffers = sendBytes; } public abstract void UseUnRegisterMessage(string key); public abstract void Register(string id, Func> func); public abstract void UnRegister(string id); } }