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); }
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))); }
public StatisticsHandler(HandleStatistics callback) { this._callback = callback; }
public void GetTopByGainTest() { Assert.IsTrue(HandleStatistics.GetTop("Highest gain", 20, data).Count == 3); }
public void GetTopByGamesTest() { Assert.IsTrue(HandleStatistics.GetTop("Number of games", 20, data).Count == 3); }
public void GetTopByGrossTest() { Assert.IsTrue(HandleStatistics.GetTop("Gross profit", 20, data).Count == 3); }