static void Main(string[] args) { ReadArguments(args); var authConnection = DB.CreateConnection(AuthConfig.AuthDBHost, AuthConfig.AuthDBUser, AuthConfig.AuthDBPassword, AuthConfig.AuthDBDataBase, AuthConfig.AuthDBPort, AuthConfig.MySqlPooling, AuthConfig.MySqlMinPoolSize, AuthConfig.MySqlMaxPoolSize); DB.Initialize(out DB.Auth, authConnection); Log.Message(LogType.Init, "_____________World of Warcraft_____________"); Log.Message(LogType.Init, " __ "); Log.Message(LogType.Init, " / | , "); Log.Message(LogType.Init, "---/__|---)__----__--_/_--------------_--_-"); Log.Message(LogType.Init, " / | / ) / ' / / / / / / )"); Log.Message(LogType.Init, "_/____|_/_____(___ _(_ __/___(___(__/_/__/_"); Log.Message(LogType.Init, "________________AuthServer_________________"); Log.Message(); Log.Message(LogType.Normal, "Starting Arctium WoW AuthServer..."); using (var server = new Server(AuthConfig.BindIP, AuthConfig.BindPort)) { PacketManager.DefineMessageHandler(); Manager.Initialize(); ConsoleCommandManager.InitCommands(); } }
static void Main(string[] args) { ReadArguments(args); DB.Auth.CreateConnection(AuthConfig.AuthDBHost, AuthConfig.AuthDBUser, AuthConfig.AuthDBPassword, AuthConfig.AuthDBDataBase, AuthConfig.AuthDBPort, AuthConfig.MySqlPooling, AuthConfig.MySqlMinPoolSize, AuthConfig.MySqlMaxPoolSize); Log.Message(LogType.Init, "_____________World of Warcraft_____________"); Log.Message(LogType.Init, " __ "); Log.Message(LogType.Init, " / | , "); Log.Message(LogType.Init, "---/__|---)__----__--_/_--------------_--_-"); Log.Message(LogType.Init, " / | / ) / ' / / / / / / )"); Log.Message(LogType.Init, "_/____|_/_____(___ _(_ __/___(___(__/_/__/_"); Log.Message(LogType.Init, "________________AuthServer_________________"); Log.Message(); Log.Message(LogType.Normal, "Starting Arctium WoW AuthServer..."); using (var server = new Server(AuthConfig.BindIP, AuthConfig.BindPort)) { PacketManager.DefineMessageHandler(); // Set all game accounts offline /*foreach (var ga in DB.Auth.GameAccounts) * ga.IsOnline = false; * * DB.Auth.Update();*/ Manager.Initialize(); ConsoleCommandManager.InitCommands(); } }
static void Main(string[] args) { ReadArguments(args); var connString = DB.CreateConnectionString(AuthConfig.AuthDBHost, AuthConfig.AuthDBUser, AuthConfig.AuthDBPassword, AuthConfig.AuthDBDataBase, AuthConfig.AuthDBPort, AuthConfig.AuthDBMinPoolSize, AuthConfig.AuthDBMaxPoolSize, AuthConfig.AuthDBType); if (DB.Auth.Initialize(connString, AuthConfig.AuthDBType)) { Helper.PrintHeader(serverName); using (var server = new Server(AuthConfig.BindIP, AuthConfig.BindPort)) { PacketManager.DefineMessageHandler(); Manager.Initialize(); ConsoleCommandManager.InitCommands(); } } else { Log.Error("Not all database connections successfully opened."); } }
/// <summary> /// This contains the console commands /// </summary> public void ReadConsoleCommands(string[] args) { Wait = false; ConsoleCommandManager.InitHandlers(); Program.ConsoleCoroutine = ConsoleCommandManager.IRSECommandSystem .Logic((object)null, Game.Configuration.Globals.NoConsoleAutoComplete || args.Contains("-noConsoleAutoComplete")); while (true) { if (PendingServerStart) { PendingServerStart = false; StartServer(); } if (!Wait) { ConsoleCoroutine.MoveNext(); } Thread.Sleep(50); } }
static void Main(string[] args) { ProcessCommandLine(args); // Start console logging. Log.Start(ManagerConfig.LogLevel, new LogFile(ManagerConfig.LogDirectory, ManagerConfig.LogConsoleFile)); Helper.PrintHeader(serverName); using (var consolePipeServer = new IPCServer(ManagerConfig.ServiceConsoleName)) { consolePipeServer.Listen(); // Register pipe message handlers. IPCPacketManager.DefineMessageHandler(); // Register console commands. ConsoleCommandManager.InitializeCommands(); Log.Message(LogTypes.Info, $"{serverName} successfully started."); // Listen for console commands. ConsoleCommandManager.StartCommandHandler(); } }
public static void Main() { var commandManager = new ConsoleCommandManager(); commandManager.LoadCommands(typeof(Program), null); commandManager.AddHelpCommand(); s_shouldRun = true; while (s_shouldRun) { try { s_logger.Write($"{Environment.CurrentDirectory}> "); commandManager.Execute(s_logger.ReadLine()); } catch (NonExistentCommandException ex) { s_logger.LogError("Unexistent command '{0}'. Use the 'help' command to list all commands.", ex.Command); } catch (CommandInvocationException ex) { s_logger.LogError("Error while executing '{0}': {1}\n{2}", ex.Command, ex.Message, ex.StackTrace !); } } }
private static void CreateConsoleCommands(ConsoleCommandManager manager) { manager.AddCommand <HelpCommand>(); manager.AddCommand <KickAllCommand>(); manager.AddCommand <ListPlayersCommand>(); manager.AddCommand <ListCommand>(); manager.AddCommand <ReloadConfigsCommand>(); manager.AddCommand <UuidOfCommand>(); manager.AddCommand <BroadcastCommand>(); manager.AddCommand <WarpToWorldCommand>(); manager.AddCommand <BanHammerCommand>(); manager.AddCommand <MakeAdminCommand>(); }
private StarMain() { PluginManagers = new List <IPluginManager>(); DefaultPacketTypes = new List <Type>(); ConsoleCommandManager = new ConsoleCommandManager(); ConnectionManager = new StarProxyManager(); Configurations = new List <IConfiguration>(); Scheduler = new StarScheduler(); _jsonSettings = new JsonSerializerSettings(); ReadStarConfigs(); Initialized = false; }
/// <summary> /// Entry point for the application /// </summary> /// <param name="args"></param> static void Main(string[] args) { Logging.Alias("Alias Emulator is starting up...", Emulator.Alias.Version); Logging.LoadFiles(); Logging.Info("Alias Server is starting"); if (Logging.IsDebugEnabled) { Logging.Warn("Debugging - Log files will become large very quickly."); Logging.Warn("Press any key to continue..."); Console.ReadKey(); } Stopwatch sw = new Stopwatch(); sw.Start(); bool Running64Bit = (IntPtr.Size == 8); if (!Running64Bit) { Logging.Warn("This application is not running in 64-bit, we recommend you run it in 64-bit. Press any key to continue.."); Console.ReadKey(); } Logging.Info("Starting to initialize Server."); new Emulator.Alias(); sw.Stop(); Logging.Debug("Time taken to start: " + sw.Elapsed.TotalSeconds.ToString().Split('.')[0] + " seconds."); ConsoleCommandManager.Initialize(); while (true) { if (Console.ReadKey(true).Key == ConsoleKey.Enter) { Logging.Command(); string input = Console.ReadLine().ToLower(); if (!ConsoleCommandManager.Handle(input)) { Logging.Warn("There was an error executing that command."); } } } }
static void Main(string[] args) { ProcessCommandLine(args); // Start console logging. Log.Start(StsConfig.LogLevel, new LogFile(StsConfig.LogDirectory, StsConfig.LogConsoleFile)); using (ConsoleService = new ConsoleServicePipeClient(StsConfig.ServiceConsoleServer, StsConfig.ServiceConsolServerPipe)) { IPCPacketManager.DefineMessageHandler(); // Start listening for incoming ipc packets. ConsoleService.Process(); // Register console to ServerManager. ConsoleService.Send(new RegisterConsole { Alias = Alias.Value }).GetAwaiter().GetResult(); Database.Auth.Initialize(new ConnectorSettings { ApiHost = $"http://{StsConfig.ApiHost}:{StsConfig.ApiPort}/api/Auth", ConnectionMode = ConnectionMode.Api, DatabaseType = DatabaseType.MySql, // Assign JSON serialize/deserialize functions (Newtonsoft.Json). ApiSerializeFunction = JsonConvert.SerializeObject, ApiDeserializeFunction = JsonConvert.DeserializeObject <object[][]> }); ConsoleCommandManager.InitializeCommands(); // Successfully started. ConsoleService.Send(new ProcessStateInfo { State = PipeProcessState.Started, Alias = Alias.Value }).GetAwaiter().GetResult(); // Listen for console commands. ConsoleCommandManager.StartCommandHandler(); } }
static void Main(string[] args) { Console.Title = "TS3GameBot by MrDj and Exp111"; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; #region CredCheck if (!CredManager.CredCheck(CredPathJson)) { MyCreds = CredManager.CreateCreds(); JsonSerialization.WriteToJsonFile <Creds>(CredPathJson, MyCreds); } else { MyCreds = JsonSerialization.ReadFromJsonFile <Creds>(CredPathJson); if (MyCreds == null) { throw new Exception("shit"); } } #endregion Console.Clear(); #region DBConnection Console.WriteLine("Connecting to Database..."); ConnectionResult CResult = DbInterface.CheckConnection(); switch (CResult) { case ConnectionResult.OK: Console.WriteLine("Connected!"); break; case ConnectionResult.SQLERROR: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nCould not connect to Database! Error: " + CResult + " Check your Settings! (" + CredPathJson + ")\n\nPress Enter to exit"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; return; // break; case ConnectionResult.UNKNOWN: default: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nCould not connect to Database! Error: " + CResult + "\n\nPress Enter to exit"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; return; // break; } Console.WriteLine(DbInterface.GetPlayerCount() + " Players found!"); // Making an Initial DB call, to get rid of the Delay on the first Commnand #endregion #region TS3Connection Console.WriteLine("Connecting to TeamSpeak Server..."); TS3QueryInfo ts3ServerInfo; if (MyCreds.TS3InfoList.Count > 1) { Console.WriteLine("You have more than 1 TS3 Server configured!\nPlease choose 1 of the following:\n"); foreach (var item in MyCreds.TS3InfoList) { Console.WriteLine("[" + item.Key + "] on " + item.Value.ServerAddress); } Console.Write("> "); String input = Console.ReadLine(); ts3ServerInfo = MyCreds.TS3InfoList.Where(e => e.Key.ToLower().Equals(input.ToLower())).FirstOrDefault().Value; while (ts3ServerInfo == null) { Console.WriteLine("Not found. Try Again!"); Console.Write("> "); ts3ServerInfo = MyCreds.TS3InfoList.Where(e => e.Key.ToLower().Equals(Console.ReadLine().ToLower())).First().Value; } } else { ts3ServerInfo = MyCreds.TS3InfoList.First().Value; } switch (GameBot.Instance.Login(ts3ServerInfo).GetAwaiter().GetResult()) { case ConnectionResult.OK: Console.WriteLine("Connected!"); break; case ConnectionResult.SOCKET: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nCould not connect to TeamSpeak Server! Is the Server offline?\n\nPress Enter to exit"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } return; // break; case ConnectionResult.QUERY: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nPlease Enter the correct Login Credentials! (" + CredPathJson + ")\n\nPress Enter to exit"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } return; // break; case ConnectionResult.UNKNOWN: default: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nCould not connect to TeamSpeak Server!\n\nPress Enter to exit"); while (Console.ReadKey(true).Key != ConsoleKey.Enter) { } return; // break; } #endregion #region ThreadStuff Thread botThread = new Thread(RunBot); botThread.Start(); #endregion ConsoleCommandManager.RegisterCommands(); // Registering all Console Commands List <String> commandArgs = new List <string>(); Console.WriteLine("Welcome to Dj's GameBot!\nUse 'help' for a list of commands.\nUse 'help <command>' for Usage of given Command."); while (Running) { Console.Write("> "); commandArgs.Clear(); String shit = Console.ReadLine().Trim(); ConsoleCommandBase cmd; String[] parts = shit.Split(" "); for (int i = 1; i < parts.Length; i++) { commandArgs.Add(parts[i]); // Putin all the args in a List } try { cmd = ConsoleCommandManager.Commands[parts[0].ToLower()]; // Getting the Command Assosciated to the give Command CCR result = ConsoleCommandManager.ExecuteCommand(cmd, commandArgs); // Tempsaving the Result #region ErrorHandling for Console Commands switch (result) { case CCR.OK: break; case CCR.WRONGPARAM: Console.WriteLine(cmd.GetUsage()); break; case CCR.INVALIDPARAM: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid Parameter! "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(cmd.GetUsage()); break; case CCR.PLAYERNOTFOUND: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Player not Found!"); Console.ForegroundColor = ConsoleColor.Green; break; case CCR.BELOWZERO: case CCR.NOTENOUGHPOINTS: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Points can't go below 0!"); Console.ForegroundColor = ConsoleColor.Green; break; case CCR.UNKNOWN: default: Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nUnknown Error appeared! Code: " + result + "\n"); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; break; } #endregion } catch (KeyNotFoundException) // If the given command is not found withing the Commands Dictionary { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Unknown Command '" + shit.Split(" ")[0] + "'!"); Console.ForegroundColor = ConsoleColor.Green; Console.Beep(); } } // Changing the Color back to normal Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; Console.Clear(); // Clearing the Console // Waiting for the Bot Thread to finish while (!botThread.IsAlive) { Console.WriteLine("Waiting for Bot Thread to finish!"); } }