private static void OnPeersOnlineStatusChangedCallback(int id, string peersStatusStr, int peerCount) { if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnPeersOnlineStatusChanged != null) { if (AgoraCallbackObject.GetInstance()._CallbackQueue != null) { AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => { if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnPeersOnlineStatusChanged != null) { int j = 1; string[] sArray = peersStatusStr.Split('\t'); PeerOnlineStatus [] channelAttributes = new PeerOnlineStatus[peerCount]; for (int i = 0; i < peerCount; i++) { PeerOnlineStatus peerOnlineStatus = new PeerOnlineStatus(); peerOnlineStatus.peerId = sArray[j++]; peerOnlineStatus.isOnline = bool.Parse(sArray[j++]); peerOnlineStatus.onlineState = (PEER_ONLINE_STATE)int.Parse(sArray[j++]); channelAttributes[i] = peerOnlineStatus; } clientEventHandlerHandlerDic[id].OnPeersOnlineStatusChanged(id, channelAttributes, peerCount); } }); } } }
private static void OnQueryPeersOnlineStatusResultCallback(int id, Int64 requestId, string peersStatus, int peerCount, QUERY_PEERS_ONLINE_STATUS_ERR errorCode) { if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnQueryPeersOnlineStatusResult != null) { if (AgoraCallbackObject.GetInstance()._CallbackQueue != null) { AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => { if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnQueryPeersOnlineStatusResult != null) { int j = 1; string[] sArray = peersStatus.Split('\t'); PeerOnlineStatus [] channelAttributes = new PeerOnlineStatus[peerCount]; for (int i = 0; i < peerCount; i++) { PeerOnlineStatus peerOnlineStatus = new PeerOnlineStatus(); peerOnlineStatus.peerId = sArray[j++]; peerOnlineStatus.isOnline = bool.Parse(sArray[j++]); peerOnlineStatus.onlineState = (PEER_ONLINE_STATE)int.Parse(sArray[j++]); channelAttributes[i] = peerOnlineStatus; } clientEventHandlerHandlerDic[id].OnQueryPeersOnlineStatusResult(id, requestId, channelAttributes, peerCount, errorCode); } }); } } }