AnimatorClient.AnimatorClient.GetAnimationTitles C# (CSharp) Method

GetAnimationTitles() public method

public GetAnimationTitles ( ) : List
return List
        public List<string> GetAnimationTitles()
        {
            TcpClient tcpClient = new TcpClient();

            try
            {
                tcpClient.Connect(this.ServerAddress, this.ServerPort);

                CommandHandler.SendCommand(tcpClient.GetStream(), Command.GetUploadedAnimationTitles);

                BinaryFormatter binaryFormatter = new BinaryFormatter();
                List<string> animationTitles = (List<string>)binaryFormatter.Deserialize(tcpClient.GetStream());

                tcpClient.Close();

                return animationTitles;
            }
            catch (SocketException se)
            {
                tcpClient.Close();
                throw new InvalidOperationException("Could not get animation titles", se);
            }
        }

Usage Example

Example #1
0
        public void TestListAnimations()
        {
            AnimationServer server = new AnimationServer();

            server.Port = 1334;

            AnimatorClient.AnimatorClient client = new AnimatorClient.AnimatorClient();

            client.ServerAddress = "localhost";
            client.ServerPort    = 1334;

            server.IsListening = true;

            var titles = client.GetAnimationTitles();

            Assert.AreEqual(0, titles.Count);

            Animation testAnimation = new Animation(10, 10);

            testAnimation.Name = "Test Animation";

            client.UploadAnimation(testAnimation);

            titles = client.GetAnimationTitles();
            Assert.AreEqual(1, titles.Count);
            Assert.AreEqual("Test Animation", titles[0]);

            server.IsListening = false;
        }
All Usage Examples Of AnimatorClient.AnimatorClient::GetAnimationTitles