Ejemplo n.º 1
0
        private void OnPong(object sender, PongEvent @event)
        {
            var pendingPing = m_PendingPings.FirstOrDefault(d => d.PingId == @event.PongPacket.PingId && d.NetworkPeer.Id == @event.Peer.Id);

            if (pendingPing.PingId == 0)
            {
                return;
            }

            m_PendingPings.Remove(pendingPing);

            TimeSpan ping = DateTime.UtcNow - pendingPing.SendTime;

            @event.Peer.Ping = ping;

#if LOG_NETWORK
            m_Logger.LogDebug($"{@event.Peer} ping: {ping.TotalMilliseconds}ms");
#endif
        }
Ejemplo n.º 2
0
        public static bool updateDate(PongEvent paramPongEvent, Session paramSession)
        {
            EncryptedStringUserType.Key = CryptUtil.Instance.encryptHexString("oasj419][f'ar;;34").ToCharArray();
            System.Collections.IList list     = paramSession.createQuery("from ConcLicenseTable").list();
            XStream          xStream          = new XStream();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyyMMddHHmmssZ");
            bool             @bool            = false;

            foreach (ConcLicenseTable concLicenseTable in list)
            {
                LicenseRowItem licenseRowItem = (LicenseRowItem)xStream.fromXML(concLicenseTable.HashKey);
                if (licenseRowItem.CheckedIn && licenseRowItem.Serial.Equals(paramPongEvent.Serial) && licenseRowItem.Userid.Equals(paramPongEvent.UserId, StringComparison.OrdinalIgnoreCase))
                {
                    @bool = true;
                    string str1 = simpleDateFormat.format(DateTime.Now);
                    licenseRowItem.CheckedInDate = str1;
                    string str2 = xStream.toXML(licenseRowItem);
                    concLicenseTable.HashKey = str2;
                    paramSession.update(concLicenseTable);
                }
            }
            return(@bool);
        }
Ejemplo n.º 3
0
 public void OnPongEvent(int count)
 {
     PongEvent?.Invoke(count);
 }