Beispiel #1
0
        private void UpdateNetInfo(P2PSessionState_t session)
        {
            bool endpointChanged = sessionState.m_nRemoteIP != session.m_nRemoteIP || sessionState.m_nRemotePort != session.m_nRemotePort;

            sessionState = session;

            if (endpointChanged)
            {
                // If IP/port changed for whatever reason
                ETWPingMonitor.Unregister(NetId);

                Region = "...";

                byte[] ipBytes = BitConverter.GetBytes(sessionState.m_nRemoteIP).Reverse().ToArray();
                NetId = (ulong)sessionState.m_nRemotePort << 32 | BitConverter.ToUInt32(ipBytes, 0);
                ETWPingMonitor.Register(NetId);

                if (session.m_bUsingRelay == 0)
                {
                    IpLocationAPI.GetLocationAsync(new IPAddress(ipBytes).ToString(), r => Region = r);
                }
                else
                {
                    Region = "[STEAM RELAY]";
                }
            }
        }
        private void UpdateNetInfo(P2PSessionState_t session)
        {
            if (sessionState.m_nRemoteIP == session.m_nRemoteIP)
            {
                return;
            }

            sessionState = session;
            Ip           = null;
            Region       = "...";

            if (session.m_bUsingRelay == 0)
            {
                byte[] ipBytes = BitConverter.GetBytes(sessionState.m_nRemoteIP).Reverse().ToArray();
                Ip = new IPAddress(ipBytes);
                IpLocationAPI.GetLocationAsync(Ip.ToString(), r => Region = r);
            }
        }