public List<Animation> GetAnimations(List<Animation> currentAnimations)
{
TcpClient tcpClient = new TcpClient();
try
{
// Try to connect to the server
tcpClient.Connect(this.ServerAddress, this.ServerPort);
// Send the get uploaded animations command
CommandHandler.SendCommand(tcpClient.GetStream(), Command.GetUploadedAnimations);
// Get the animations from the server
BinaryFormatter binaryFormatter = new BinaryFormatter();
List<Animation> animations = (List<Animation>)binaryFormatter.Deserialize(tcpClient.GetStream());
// Close the connection
tcpClient.Close();
return new List<Animation>(animations);
}
catch (SocketException se)
{
throw new InvalidOperationException("Could not connect to server", se);
}
}