Exemplo n.º 1
0
 public override ulong GetStat(Connection connection, NetworkPeer.StatTypeLong type)
 {
     if (this.peer == null)
     {
         return((ulong)0);
     }
     return(this.peer.GetStat(connection, type));
 }
Exemplo n.º 2
0
 public override ulong GetStat(Connection connection, NetworkPeer.StatTypeLong type)
 {
     return((ulong)1);
 }
Exemplo n.º 3
0
        public virtual ulong GetStat(Connection connection, NetworkPeer.StatTypeLong type)
        {
            unsafe
            {
                this.Check();
                Native.RaknetStats raknetStat = (connection == null ? this.GetStatistics((ulong)0) : this.GetStatistics(connection.guid));
                switch (type)
                {
                case NetworkPeer.StatTypeLong.BytesSent:
                {
                    return((ulong)(*(&raknetStat.runningTotal.FixedElementField + 5 * 8)));
                }

                case NetworkPeer.StatTypeLong.BytesSent_LastSecond:
                {
                    return((ulong)(*(&raknetStat.valueOverLastSecond.FixedElementField + 5 * 8)));
                }

                case NetworkPeer.StatTypeLong.BytesReceived:
                {
                    return((ulong)(*(&raknetStat.runningTotal.FixedElementField + 6 * 8)));
                }

                case NetworkPeer.StatTypeLong.BytesReceived_LastSecond:
                {
                    return((ulong)(*(&raknetStat.valueOverLastSecond.FixedElementField + 6 * 8)));
                }

                case NetworkPeer.StatTypeLong.MessagesInSendBuffer:
                case NetworkPeer.StatTypeLong.MessagesInResendBuffer:
                {
                    return((ulong)0);
                }

                case NetworkPeer.StatTypeLong.BytesInSendBuffer:
                {
                    return((ulong)(&raknetStat.bytesInSendBuffer.FixedElementField));
                }

                case NetworkPeer.StatTypeLong.BytesInResendBuffer:
                {
                    return(raknetStat.bytesInResendBuffer);
                }

                case NetworkPeer.StatTypeLong.PacketLossAverage:
                {
                    return((ulong)raknetStat.packetlossTotal * (long)10000);
                }

                case NetworkPeer.StatTypeLong.PacketLossLastSecond:
                {
                    return((ulong)raknetStat.packetlossLastSecond * (long)10000);
                }

                case NetworkPeer.StatTypeLong.ThrottleBytes:
                {
                    if (raknetStat.isLimitedByCongestionControl == 0)
                    {
                        return((ulong)0);
                    }
                    return(raknetStat.BPSLimitByCongestionControl);
                }

                default:
                {
                    return((ulong)0);
                }
                }
            }
        }
Exemplo n.º 4
0
 public abstract ulong GetStat(Connection connection, NetworkPeer.StatTypeLong type);