public static Session FromOSD(OSDMap map)
        {
            Session session;

            switch (map["SessionType"].AsString())
            {
            case "SessionCaps":
                session = new SessionCaps();
                break;

            case "SessionEvent":
                session = new SessionEvent();
                break;

            case "SessionLogin":
                session = new SessionLogin();
                break;

            case "SessionPacket":
                session = new SessionPacket();
                break;

            default:
                return(null);
            }

            session.Deserialize(map);
            return(session);
        }
    void ProxyManager_OnPacketLog(Packet packet, GridProxy.Direction direction, System.Net.IPEndPoint endpoint)
    {
        Application.Invoke((xsender, xe) =>
        {
            PacketCounter++;

            if (direction == GridProxy.Direction.Incoming)
            {
                PacketsInCounter++;
                PacketsInBytes += packet.Length;
            }
            else
            {
                PacketsOutCounter++;
                PacketsOutBytes += packet.Length;
            }

            SessionPacket sessionPacket = new SessionPacket(packet, direction, endpoint,
                PacketDecoder.InterpretOptions(packet.Header) + " Seq: " + packet.Header.Sequence.ToString() + " Freq:" + packet.Header.Frequency.ToString());

            sessionPacket.Columns = new string[] { PacketCounter.ToString(), sessionPacket.TimeStamp.ToString("HH:mm:ss.fff"), sessionPacket.Protocol, sessionPacket.Name, sessionPacket.Length.ToString(), sessionPacket.Host, sessionPacket.ContentType };
            messages.AddSession(sessionPacket);
        });
    }
        public static Session FromOSD(OSDMap map)
        {
            Session session;

            switch (map["SessionType"].AsString())
            {
                case "SessionCaps":
                    session = new SessionCaps();
                    break;
                case "SessionEvent":
                    session = new SessionEvent();
                    break;
                case "SessionLogin":
                    session = new SessionLogin();
                    break;
                case "SessionPacket":
                    session = new SessionPacket();
                    break;
                default:
                    return null;
            }

            session.Deserialize(map);
            return session;
        }