示例#1
0
 private IEnumerable <string> FilterSessions(string fromId, SyncPlayBroadcastType type)
 {
     return(type switch
     {
         SyncPlayBroadcastType.CurrentSession => new string[] { fromId },
         SyncPlayBroadcastType.AllGroup => _participants
         .Values
         .Select(member => member.SessionId),
         SyncPlayBroadcastType.AllExceptCurrentSession => _participants
         .Values
         .Select(member => member.SessionId)
         .Where(sessionId => !sessionId.Equals(fromId, StringComparison.OrdinalIgnoreCase)),
         SyncPlayBroadcastType.AllReady => _participants
         .Values
         .Where(member => !member.IsBuffering)
         .Select(member => member.SessionId),
         _ => Enumerable.Empty <string>()
     });
示例#2
0
 /// <summary>
 /// Filters sessions of this group.
 /// </summary>
 /// <param name="from">The current session.</param>
 /// <param name="type">The filtering type.</param>
 /// <returns>The list of sessions matching the filter.</returns>
 private IEnumerable <SessionInfo> FilterSessions(SessionInfo from, SyncPlayBroadcastType type)
 {
     return(type switch
     {
         SyncPlayBroadcastType.CurrentSession => new SessionInfo[] { from },
         SyncPlayBroadcastType.AllGroup => _participants
         .Values
         .Select(session => session.Session),
         SyncPlayBroadcastType.AllExceptCurrentSession => _participants
         .Values
         .Select(session => session.Session)
         .Where(session => !session.Id.Equals(from.Id, StringComparison.OrdinalIgnoreCase)),
         SyncPlayBroadcastType.AllReady => _participants
         .Values
         .Where(session => !session.IsBuffering)
         .Select(session => session.Session),
         _ => Enumerable.Empty <SessionInfo>()
     });