Example #1
0
        protected virtual void HandleChangeGroupsOperation(LitePeer peer, ChangeGroups changeGroupsRequest, SendParameters sendParameters)
        {
            // get the actor who send the operation request
            Actor actor = this.GetActorByPeer(peer);

            if (actor == null)
            {
                return;
            }

            actor.RemoveGroups(changeGroupsRequest.Remove);

            if (changeGroupsRequest.Add != null)
            {
                if (changeGroupsRequest.Add.Length > 0)
                {
                    foreach (var groupId in changeGroupsRequest.Add)
                    {
                        ActorGroup group;
                        if (!this.actorGroups.TryGetValue(groupId, out group))
                        {
                            group = new ActorGroup(groupId);
                            this.actorGroups.Add(groupId, group);
                        }
                        actor.AddGroup(group);
                    }
                }
                else
                {
                    foreach (var group in this.actorGroups.Values)
                    {
                        actor.AddGroup(group);
                    }
                }
            }
        }
Example #2
0
        protected virtual void HandleChangeGroupsOperation(LitePeer peer, ChangeGroups changeGroupsRequest, SendParameters sendParameters)
        {
            // get the actor who send the operation request
            Actor actor = this.GetActorByPeer(peer);
            if (actor == null)
            {
                return;
            }

            actor.RemoveGroups(changeGroupsRequest.Remove);

            if (changeGroupsRequest.Add != null)
            {
                if (changeGroupsRequest.Add.Length > 0)
                {
                    foreach (var groupId in changeGroupsRequest.Add)
                    {
                        ActorGroup group;
                        if (!this.actorGroups.TryGetValue(groupId, out group))
                        {
                            group = new ActorGroup(groupId);
                            this.actorGroups.Add(groupId, group);
                        }
                        actor.AddGroup(group);
                    }
                }
                else
                {
                    foreach (var group in this.actorGroups.Values)
                    {
                        actor.AddGroup(group);
                    }
                }
            }
        }
Example #3
0
 public void AddGroup(ActorGroup group)
 {
     this.groups.Add(group);
     group.Add(this);
 }
Example #4
0
 public void AddGroup(ActorGroup group)
 {
     this.groups.Add(group);
     group.Add(this);
 }