private AVIMEventArgs ProcessAVSession(IDictionary<string, object> data) { AVIMEventArgs avimEventArgs = new AVIMEventArgs(); AVSessionOp avSessionOp = new AVSessionOp(); string str = AVRMProtocolUtils.CaptureValueFromDictionary<string>(data, "op"); avSessionOp.id = AVRMProtocolUtils.CaptureValueFromDictionary<string>(data, "i"); avSessionOp.op = str; avSessionOp.data = data; avimEventArgs.SessionOp = avSessionOp; return avimEventArgs; }
public void UnWatchPeers(AVSession session, IList<string> peerIds) { string key = Guid.NewGuid().ToString(); IDictionary<string, object> cmdBody = (IDictionary<string, object>) new Dictionary<string, object>(); cmdBody.Add("cmd", (object) "session"); cmdBody.Add("op", (object) "remove"); cmdBody.Add("peerId", (object) session.SelfId); cmdBody.Add("appId", (object) AVClient.ApplicationId); cmdBody.Add("i", (object) key); cmdBody.Add("sessionPeerIds", (object) peerIds); this.SendCMD(cmdBody); AVSessionOp avSessionOp = new AVSessionOp() { id = key, op = "removed" }; avSessionOp.data = (IDictionary<string, object>) new Dictionary<string, object>(); avSessionOp.data.Add("ToRemovePeerIds", (object) peerIds); session.pendingSessionChanged.Add(key, avSessionOp); }
private void SessionOp_Removed(AVSessionOp op) { lock (this.mutex) { if (this.AVSessionListener == null) return; AVSessionOp local_0 = this.pendingSessionChanged[op.id]; if (local_0 == null) return; IList<string> local_1 = local_0.data["ToRemovePeerIds"] as IList<string>; if (local_1 != null) { foreach (string item_0 in (IEnumerable<string>)local_1) { if (this.AllPeerIds.Contains(item_0)) this.AllPeerIds.Remove(item_0); } } if (this.AVSessionListener.OnPeersUnwatched == null) return; this.AVSessionListener.OnPeersUnwatched(this, local_1); } }
private void SessionOp_Closed(AVSessionOp op) { this.Status = SessionStatus.Closed; if (this.AVSessionListener == null) return; this.AVSessionListener.OnSessionClosed(this); }
private void SessionOp_Open(AVSessionOp op) { if (this.Status == SessionStatus.Paused) { this.Status = SessionStatus.Opend; if (this.m_OnSessionResumed != null) this.m_OnSessionResumed((object)this, EventArgs.Empty); } this.Status = SessionStatus.Opend; if (this.m_OnSessionOpen != null) this.m_OnSessionOpen((object)this, EventArgs.Empty); this.OnlinePeerIds = op.data["onlineSessionPeerIds"] as List<string>; this.AllPeerIds = this.OnlinePeerIds; if (this.OnlinePeerIds == null) { this.OnlinePeerIds = new List<string>(); this.AllPeerIds = new List<string>(); } if (this.AVSessionListener == null || this.AVSessionListener.OnSessionOpen == null) return; this.AVSessionListener.OnSessionOpen(this); }