public static void Main(string[] args) { // Try - Catch erlaubt uns ein besseres Fehlermanagement, also nutzen wir das. try { // Lade die Konfiguration settings = SettingsParser <BotSettings> .Load(); connection = SettingsParser <ConnectionSettings> .Load(); // Logging starten Logging.InitLogging(); // Exit-Methode registrieren AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnConsoleExit); // Log Console.Title = "TS³ Management Bot - " + Utility.Version.GetVersion(); Logging.LogSpecial("Hallo, ich bin ein TeamSpeak³-Bot."); // Verbindung zum Server herstellen worker = TS3Worker.CreateWorker(connection); worker.OpenConnection(); // Status isRunning = true; // Kommandos cmdThread = new Thread(CommandHandler.CheckCommands); cmdThread.Start(); // BotLogic botThread = new Thread(TS3Worker.CheckLogic); botThread.Start(); // Den Prozess nicht hier beenden while (true) { continue; } } catch (Exception e) { // Logge die Exception Logging.LogException(e); } }
public static void Connect(string[] args) { // Wenn eine spezielle Verbindung angegeben wird if (args.Length == 5) { ConnectionSettings connection = new ConnectionSettings() { host = args[0], queryPort = ushort.Parse(args[1]), serverPort = ushort.Parse(args[2]), username = args[3], password = args[4] }; TS3Worker.CreateWorker(connection).OpenConnection(); } else if (args.Length == 1 && args[0] == "default") { TS3Worker.CreateWorker(TeamSpeakBot.connection).OpenConnection(); } else { TS3Worker.fetch.OpenConnection(); } }