Exemplo n.º 1
0
 public CoreBase()
 {
     MainWindow.NetworkManager.PacketReceiveCallback += (b) => { OnPacketReceive?.Invoke(b); };
     MainWindow.AccountCreatedCallback += (a) =>
     {
         OnAccountCreated?.Invoke(GetAccountByModel(a));
     };
 }
Exemplo n.º 2
0
        private async Task MessageFraming_DataReceivedEvent(byte[] receivedData)
        {
            IPacket packet;

            using (var ms = new MemoryStream(await CryptEngine.DecompressAsync(receivedData)))
                packet = (IPacket)await LightRATUtils.Instance.packetSerializer.DeserializeAsync(ms);

            OnPacketReceive?.Invoke(this, new ReceivePacketArgs(packet));
        }
Exemplo n.º 3
0
        public virtual void PacketReceive(ref PacketSpinel97 packet)
        {
            Debug.Print("Receive packet {0}", packet.INST);
            OnPacketReceive?.Invoke(packet);

            if (packet.INST < 0x10)
            {
                foreach (SpinelStackRec ssr in packets_to_receive)
                {
                    if (ssr.CheckReceivePacket(ref packet))
                    {
                        packets_to_receive.Remove(ssr);
                        return;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void OnPacketArrival(object sender, CaptureEventArgs e)
        {
            var packet = Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data);

            OnPacketReceive?.Invoke(packet, e.Packet.Timeval);
        }