Example #1
0
 /// <summary>
 /// 缓存输出包
 ///     <remark>abu 2008-03-07 </remark>
 /// </summary>
 /// <param name="outPacket">The out packet.</param>
 public void PutSent(OutPacket outPacket)
 {
     if (parsers[outPacket.GetFamily()] != null)
     {
         PacketHistory history = parsers[outPacket.GetFamily()].GetHistory();
         if (history != null)
         {
             history.PutSent(outPacket);
         }
     }
 }
Example #2
0
 /// <summary>
 /// 通过回复包获得请求包
 /// 通过重载Packet的Equals方法,本判断两个不同类型的对象相等。
 ///     <remark>abu 2008-03-07 </remark>
 /// </summary>
 /// <param name="inPacket">The in packet.</param>
 /// <returns>OutPacket对象,如果没有找到,返回null</returns>
 public OutPacket RetriveSent(InPacket inPacket)
 {
     if (parsers[inPacket.GetFamily()] != null)
     {
         PacketHistory history = parsers[inPacket.GetFamily()].GetHistory();
         if (history != null)
         {
             return(history.RetrieveSent(inPacket));
         }
     }
     return(null);
 }
Example #3
0
 /// <summary>
 /// 这个方法检查包是否已收到,要注意的是检查是针对这个包的hash值进行的,
 /// * 并不是对packet这个对象,hash值的计算是在packet的hashCode中完成的,
 /// * 如果两个packet的序号或者命令有不同,则hash值肯定不同。
 ///     <remark>abu 2008-03-07 </remark>
 /// </summary>
 /// <param name="packet">The packet.</param>
 /// <param name="add">if set to <c>true</c> [add].如果为true,则当这个包不存在时,添加这个包的hash,否则不添加</param>
 /// <returns>true如果这个包已经收到,否则false</returns>
 public bool IsReplied(OutPacket packet, bool add)
 {
     if (parsers[packet.GetFamily()] != null)
     {
         PacketHistory history = parsers[packet.GetFamily()].GetHistory();
         if (history != null)
         {
             return(history.Check(packet, add));
         }
         else
         {
             return(false);
         }
     }
     return(false);
 }
Example #4
0
 public BasicFamilyParser()
 {
     history = new PacketHistory();
 }