예제 #1
0
        public unsafe PacketCommunicatorReceiveResult ReceiveStatistics(int count, HandleStatistics callback)
        {
            this.AssertMode(PacketCommunicatorMode.Statistics);
            PacketCommunicator.HandlerDelegate handlerDelegate = new PacketCommunicator.HandlerDelegate(new PacketCommunicator.StatisticsHandler(callback).Handle);
            // ISSUE: cast to a function pointer type
            __FnPtr <void (byte *, pcap_pkthdr *, byte *)> local = (__FnPtr <void (byte *, pcap_pkthdr *, byte *)>)(IntPtr) Marshal.GetFunctionPointerForDelegate((Delegate)handlerDelegate).ToPointer();
            int num = \u003CModule\u003E.pcap_loop(this._pcapDescriptor, count, local, (byte *)0);

            GC.KeepAlive((object)handlerDelegate);
            if (num == -1)
            {
                throw PcapError.BuildInvalidOperation("Failed reading from device", this._pcapDescriptor);
            }
            return(num != -2 ? PacketCommunicatorReceiveResult.Ok : PacketCommunicatorReceiveResult.BreakLoop);
        }
예제 #2
0
        public string LoginWeb(string username, string password)
        {
            if (username == null || password == null)
            {
                return("Error");
            }
            Player player = PlayerAction.Login(username, password, PlayersData);

            if (player == null)
            {
                return("Error");
            }
            Log.InfoLog("new login from ClientWeb, username: " + username);
            var ans = HandleStatistics.GetTopForPrint(player, playersData);

            return(CreateJson(HandleStatistics.GetTopForPrint(player, playersData)));
        }
예제 #3
0
 public StatisticsHandler(HandleStatistics callback)
 {
     this._callback = callback;
 }
예제 #4
0
 public void GetTopByGainTest()
 {
     Assert.IsTrue(HandleStatistics.GetTop("Highest gain", 20, data).Count == 3);
 }
예제 #5
0
 public void GetTopByGamesTest()
 {
     Assert.IsTrue(HandleStatistics.GetTop("Number of games", 20, data).Count == 3);
 }
예제 #6
0
 public void GetTopByGrossTest()
 {
     Assert.IsTrue(HandleStatistics.GetTop("Gross profit", 20, data).Count == 3);
 }