Exemple #1
0
        /// <summary>
        /// 写入字节流
        /// </summary>
        /// <param name="aValue"></param>
        /// <param name="response"></param>
        protected static void WriteString(IGameResponse response, string aValue)
        {
            byte[] outputStream = System.Text.Encoding.UTF8.GetBytes(aValue);
            int    iLen         = outputStream.Length;

            byte[] outputStreamForLen = BitConverter.GetBytes(iLen);
            response.BinaryWrite(outputStreamForLen);
            if (outputStream.Length > 0)
            {
                response.BinaryWrite(outputStream);
            }
        }
Exemple #2
0
        /// <summary>
        /// 出错处理
        /// </summary>
        /// <param name="response"></param>
        /// <param name="actionID"></param>
        /// <param name="errorCode"></param>
        /// <param name="errorInfo"></param>
        public static void RequestError(IGameResponse response, int actionID, int errorCode, string errorInfo)
        {
            MessageHead      head = new MessageHead(actionID, errorCode, errorInfo);
            MessageStructure sb   = new MessageStructure();

            sb.WriteBuffer(head);
            response.BinaryWrite(sb.PopBuffer());
        }
Exemple #3
0
 /// <summary>
 /// 写入字节流
 /// </summary>
 /// <param name="aValue"></param>
 /// <param name="response"></param>
 protected static void WriteString(IGameResponse response, string aValue)
 {
     byte[] outputStream = System.Text.Encoding.UTF8.GetBytes(aValue);
     int iLen = outputStream.Length;
     byte[] outputStreamForLen = BitConverter.GetBytes(iLen);
     response.BinaryWrite(outputStreamForLen);
     if (outputStream.Length > 0)
     {
         response.BinaryWrite(outputStream);
     }
 }
Exemple #4
0
 /// <summary>
 /// 出错处理
 /// </summary>
 /// <param name="response"></param>
 /// <param name="actionID"></param>
 /// <param name="errorCode"></param>
 /// <param name="errorInfo"></param>
 public static void RequestError(IGameResponse response, int actionID, int errorCode, string errorInfo)
 {
     MessageHead head = new MessageHead(actionID, errorCode, errorInfo);
     MessageStructure sb = new MessageStructure();
     sb.WriteBuffer(head);
     response.BinaryWrite(sb.ReadBuffer());
 }