Ejemplo n.º 1
0
        public static void ParseBattlenet(Packet packet)
        {
            try
            {
                var bnetPacket = new BattlenetPacket(packet);
                Action <BattlenetPacket> handler;

                bnetPacket.Stream.WriteLine(bnetPacket.GetHeader());

                if (BattlenetHandlers.TryGetValue(bnetPacket.Header, out handler))
                {
                    handler(bnetPacket);
                    packet.Status = ParsedStatus.Success;
                }
                else
                {
                    packet.AsHex();
                    packet.Status = ParsedStatus.NotParsed;
                }
            }
            catch (Exception ex)
            {
                packet.WriteLine(ex.GetType().ToString());
                packet.WriteLine(ex.Message);
                packet.WriteLine(ex.StackTrace);

                packet.Status = ParsedStatus.WithErrors;
            }
        }
        public static void ParseBattlenet(Packet packet)
        {
            try
            {
                var bnetPacket = new BattlenetPacket(packet);
                Action<BattlenetPacket> handler;

                bnetPacket.Stream.WriteLine(bnetPacket.GetHeader());

                if (BattlenetHandlers.TryGetValue(bnetPacket.Header, out handler))
                {
                    handler(bnetPacket);
                    packet.Status = ParsedStatus.Success;
                }
                else
                {
                    packet.AsHex();
                    packet.Status = ParsedStatus.NotParsed;
                }
            }
            catch (Exception ex)
            {
                packet.WriteLine(ex.GetType().ToString());
                packet.WriteLine(ex.Message);
                packet.WriteLine(ex.StackTrace);

                packet.Status = ParsedStatus.WithErrors;
            }
        }
Ejemplo n.º 3
0
        public static void ParseBattlenet(Packet packet)
        {
            try
            {
                var bnetPacket = new BattlenetPacket(packet);
                Action <BattlenetPacket> handler;

                bnetPacket.Stream.WriteLine(bnetPacket.GetHeader());

                if (BattlenetHandlers.TryGetValue(bnetPacket.Header, out handler))
                {
                    handler(bnetPacket);
                    packet.Status = ParsedStatus.Success;
                }
                else
                {
                    packet.AsHex();
                    packet.Status = ParsedStatus.NotParsed;
                }
            }
            catch (EndOfStreamException)
            {
                // Processes the packet until it has all data to read - packet appears multiple times in the sniff file
                // but only the last copy is complete
                packet.Writer.Clear();
                packet.AsHex();
                packet.Status = ParsedStatus.WithErrors;
            }
            catch (Exception ex)
            {
                packet.WriteLine(ex.GetType().ToString());
                packet.WriteLine(ex.Message);
                packet.WriteLine(ex.StackTrace);

                packet.Status = ParsedStatus.WithErrors;
            }
        }
Ejemplo n.º 4
0
        public static void ParseBattlenet(Packet packet)
        {
            try
            {
                var bnetPacket = new BattlenetPacket(packet);
                Action<BattlenetPacket> handler;

                bnetPacket.Stream.WriteLine(bnetPacket.GetHeader());

                if (BattlenetHandlers.TryGetValue(bnetPacket.Header, out handler))
                {
                    handler(bnetPacket);
                    packet.Status = ParsedStatus.Success;
                }
                else
                {
                    packet.AsHex();
                    packet.Status = ParsedStatus.NotParsed;
                }
            }
            catch (EndOfStreamException)
            {
                // Processes the packet until it has all data to read - packet appears multiple times in the sniff file
                // but only the last copy is complete
                packet.Writer.Clear();
                packet.AsHex();
                packet.Status = ParsedStatus.WithErrors;
            }
            catch (Exception ex)
            {
                packet.WriteLine(ex.GetType().ToString());
                packet.WriteLine(ex.Message);
                packet.WriteLine(ex.StackTrace);

                packet.Status = ParsedStatus.WithErrors;
            }
        }