예제 #1
0
 public void SetUp()
 {
     wrapped = new NullTransport(Reliability.Unreliable, Ordering.Unordered, 0, 1024);
     wrappedPacketsSent = 0;
     wrapped.PacketSent += delegate { wrappedPacketsSent++; };
     transport = new NetworkEmulatorTransport(wrapped);
     effects = new Bag<NetworkEmulatorTransport.PacketEffect>();
     transport.PacketDisposition += (mode, effect, packet) => effects.Add(effect);
 }
예제 #2
0
 public void ReportDisposition(NetworkEmulatorTransport.PacketMode mode, 
     NetworkEmulatorTransport.PacketEffect effect, TransportPacket packet)
 {
     StringBuilder report = new StringBuilder(60);
     switch(effect)
     {
         case NetworkEmulatorTransport.PacketEffect.Delayed:
             report.Append("D");
             break;
         case NetworkEmulatorTransport.PacketEffect.Reordered:
             report.Append("R");
             break;
         case NetworkEmulatorTransport.PacketEffect.Dropped:
             report.Append("_");
             break;
         case NetworkEmulatorTransport.PacketEffect.None:
             report.Append(" ");
             break;
     }
     report.Append(Text.Length > 60 ? Text.Substring(0, 58) : Text);
     Text = report.ToString();
 }
예제 #3
0
파일: Client.cs 프로젝트: briandealwis/gt
 private void _transport_PacketDisposed(NetworkEmulatorTransport.PacketMode mode, 
     NetworkEmulatorTransport.PacketEffect effect, TransportPacket packet)
 {
     if(PacketDisposition != null)
     {
         PacketDisposition(mode, effect, packet);
     }
 }