Данная библиотека позволяет Вам отправлять запросы на TeamSpeak 3 сервер используя query-порт. Все запросы реализованы безопасно и библиотека написана для работы с NET Framework 3.5 Service Pack 1 и выше, а так же поддерживает Silverlight 3.0 и выше, и Windows Phone 7.1. В настоящий момент проект разрабатывается при помощи Microsoft Visual Studio 2010 Service Pack 1.
Системные требования:
- Visual Studio 2008 SP1 с .Net Framework 3.5 SP1 и выше
- Silverlight 3 Toolkit (только если Вы хотите пользоваться этой библиотекой с Silverlight)
- Windows Phone 7.1 beta tools (только если Вы хотите пользоваться этой библиотекой с WP 7.1)
Как использовать:
- For Windows Phone 7.1 reference the assembly : TS3QueryLib.Core.WP7
- For Silverlight reference the assembly: TS3QueryLib.Core.Silverlight
- For ASP.Net, Winforms, WPF and so on reference the assembly: TS3QueryLib.Core.Framework
Пример кода (Silverlight):
Код:
using System.Windows;
using System.Windows.Controls;
using TS3QueryLib.Core;
using TS3QueryLib.Core.Common;
using TS3QueryLib.Core.Query;
namespace TS3RemoteControl
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
private void ConnectButton_Click(object sender, RoutedEventArgs e)
{
// The QueryRunner is used to send queries. All Queries are implemented type save and return objects with properties
using (QueryRunner queryRunner = new QueryRunner(new SyncTcpDispatcher("127.0.0.1", 10011))) // host and port
{
// connection to the TS3-Server is established with the first query command
// login using the provided username and password and show a dump-output of the response in a textbox
//AppendToOutput(queryRunner.Login("serveradmin", "YourPassword")).GetDumpString();
// select server with id 1 and show a dump-output of the response in a textbox
AppendToOutput(queryRunner.SelectVirtualServerById(1).GetDumpString());
// get information about yourself and show a dump-output of the response in a textbox
AppendToOutput(queryRunner.SendWhoAmI().GetDumpString());
}
}
private void AppendToOutput(string text)
{
OutputTextBox.Text += "\n" + text;
}
}
}