Ejemplo n.º 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);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 3
0
 private void _transport_PacketDisposed(NetworkEmulatorTransport.PacketMode mode, 
     NetworkEmulatorTransport.PacketEffect effect, TransportPacket packet)
 {
     if(PacketDisposition != null)
     {
         PacketDisposition(mode, effect, packet);
     }
 }