Пример #1
0
        public async Task Execute_MoveClientExecutableSuccessful_SendsCommands()
        {
            // arrange
            var server = SetupServer(out var executor, out var session);
            var exec   = new MoveClient {
                Nickname = "User 1", ChannelName = "Test Channel 12"
            };

            server.Response = ""
                              + "TS3\r\n"
                              + "Welcome to the TeamSpeak 3 ServerQuery interface.\r\n"
                              + "clid=93 cid=1 client_database_id=1 client_nickname=serveradmin client_type=1|"
                              + "clid=90 cid=6 client_database_id=247 client_nickname=User\\s1 client_type=0|"
                              + "clid=88 cid=6 client_database_id=2 client_nickname=User\\s2 client_type=0\r\n"
                              + "error id=0 msg=ok\r\n"
                              + "cid=16 channel_name=Test\\sChannel\\s12|"
                              + "cid=17 channel_name=Test\\sChannel\\s123\r\n"
                              + "error id=0 msg=ok\r\n"
                              + "error id=0 msg=ok\r\n";

            // act
            executor.Schedule(exec);
            executor.Stop();
            await session;

            // assert
            Assert.Equal(""
                         + "clientlist\n"
                         + "channelfind pattern=Test\\sChannel\\s12\n"
                         + "clientmove clid=90 cid=16\n"
                         + "", server.Receive);
        }
Пример #2
0
        private IMoveClient GetCommonClient()
        {
            var client = new MoveClient() as IMoveClient;

            client.Bind(Device, UserName, Password);

            return(client);
        }
Пример #3
0
        public void SerializeAndDeSerializeMoveClientMessages()
        {
            MoveClient move = new MoveClient(Move.MoveRight);

            byte[]     bytes   = Serializer.Serialize(move, playerIntegerSize);
            MoveClient message = (MoveClient)Serializer.DeSerializeServer(bytes, playerIntegerSize);

            Assert.AreEqual(move, message, "Should be able to serialize and deserialize the move client message.");
        }
Пример #4
0
        public void ClientBindNotCalled()
        {
            // Initialize
            var client = new MoveClient();

            // Call
            try
            {
                StateRec rec;
                var      errCode = client.GetState(out rec);
            }
            catch (Exception ex)
            {
                Trace.TraceInformation("\nReceived expected exception => {0}", ex);
                return;
            }

            Assert.Fail("Test expected to raise an exception.  No exception raised.");
        }
Пример #5
0
        private void SendMoveItem(ListViewItem item)
        {
            MoveServer failure = item.Tag as MoveServer;

            using (ProgressDialog progress = new ProgressDialog())
            {
                string status = string.Empty;

                progress.Title         = "Retrying";
                progress.CancelMessage = "Please wait...";
                progress.Line1         = string.Format("Sending {0} move request to server.", failure.Info.MoveType);
                progress.ShowDialog(this, DialogFlags.Modal | DialogFlags.NoMinimize | DialogFlags.AutoTime | DialogFlags.NoProgressBar);
                progress.Line2          = "Server AE: " + failure.Scp.AETitle;
                failure.Scp.PeerAddress = IPAddress.Parse(failure.IPAddress);
                if (!MoveClient.Move(failure.Scp, failure.Info, failure.DestinationAE, ProcessorConfiguration.Settings.TemporaryDirectory, ref status))
                {
                    UpdateMoveStatus(failure, status);
                }
                else
                {
                    RemoveMoveItem(item);
                }
            }
        }
Пример #6
0
        public void OnPlayerJoined(IGamePlayerJoinedEvent evt)
        {
            var code    = evt.Game.Code;
            var players = evt.Game.Players;

            logger.LogInformation($"[{code}] Player joined, moving clients into voice channel.");

            foreach (var player in players)
            {
                // must use p.Client here since p.Character is not available yet
                var name = player.Client.Name;
                logger.LogInformation($"Moving client: {name}");

                var move = new MoveClient {
                    ChannelName = $"Impostor {code}", Nickname = name
                };
                executor.Schedule(move);

                var unmute = new UnmuteClient {
                    Nickname = name
                };
                executor.Schedule(unmute);
            }
        }