コード例 #1
0
        private static void PacketHandler(object sender, CaptureEventArgs e)
        {
            UdpPacket packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>();

            if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056))
            {
                receiver.ReceivePacket(packet.PayloadData);
            }
        }
コード例 #2
0
 private static void PacketHandler(object sender, CaptureEventArgs e)
 {
     try
     {
         var packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>();
         if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056))
         {
             _receiver.ReceivePacket(packet.PayloadData);
         }
     }
     catch (Exception ex)
     {
         Log.Error(nameof(StartDeviceCapture), ex);
         _mainWindowViewModel.SetErrorBar(Visibility.Visible, LanguageController.Translation("PACKET_HANDLER_ERROR_MESSAGE"));
         _mainWindowViewModel.StopTracking();
     }
 }
コード例 #3
0
 private static void PacketHandler(object sender, CaptureEventArgs e)
 {
     try
     {
         var packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data).Extract <UdpPacket>();
         if (packet != null && (packet.SourcePort == 5056 || packet.DestinationPort == 5056))
         {
             _receiver.ReceivePacket(packet.PayloadData);
         }
     }
     catch (OverflowException ex)
     {
         ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, ex);
         Log.Error(nameof(PacketHandler), ex);
     }
     catch (Exception exc)
     {
         ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod().DeclaringType, exc);
         Log.Error(nameof(PacketHandler), exc);
     }
 }
コード例 #4
0
ファイル: GameSource.cs プロジェクト: Kalavarda/GameHelper
 private void Udp_OnData(Datagram datagram)
 {
     _receiver.ReceivePacket(datagram.Data);
 }