public static void Main(string[] args) { XmlConfigurator.Configure(); IConfig commandLineConfig = ParseConfig(args); if (commandLineConfig.Get("help") != null || commandLineConfig.Get("loginuri") == null) { Help(); } else if ( commandLineConfig.Get("firstname") == null || commandLineConfig.Get("lastname") == null || commandLineConfig.Get("password") == null) { Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); } else { BotManager bm = new BotManager(); string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName)); if (File.Exists(iniFilePath)) { m_log.InfoFormat("[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath); IConfigSource configSource = new IniConfigSource(iniFilePath); IConfig botManagerConfig = configSource.Configs["BotManager"]; if (botManagerConfig != null) { bm.LoginDelay = botManagerConfig.GetInt("LoginDelay", bm.LoginDelay); } IConfig botConfig = configSource.Configs["Bot"]; if (botConfig != null) { bm.InitBotSendAgentUpdates = botConfig.GetBoolean("SendAgentUpdates", bm.InitBotSendAgentUpdates); bm.InitBotRequestObjectTextures = botConfig.GetBoolean("RequestObjectTextures", bm.InitBotRequestObjectTextures); } } int botcount = commandLineConfig.GetInt("botcount", 1); bool startConnected = commandLineConfig.Get("connect") != null; bm.CreateBots(botcount, commandLineConfig); if (startConnected) { bm.ConnectBots(botcount); } while (true) { try { MainConsole.Instance.Prompt(); } catch (Exception e) { m_log.ErrorFormat("Command error: {0}", e); } } } }
public static void Main(string[] args) { XmlConfigurator.Configure(); IConfig commandLineConfig = ParseConfig(args); if (commandLineConfig.Get("help") != null || commandLineConfig.Get("loginuri") == null) { Help(); } else if ( commandLineConfig.Get("firstname") == null || commandLineConfig.Get("lastname") == null || commandLineConfig.Get("password") == null) { Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); } else { BotManager bm = new BotManager(); string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName)); if (File.Exists(iniFilePath)) { m_log.InfoFormat("[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath); IConfigSource configSource = new IniConfigSource(iniFilePath); IConfig botManagerConfig = configSource.Configs["BotManager"]; if (botManagerConfig != null) { bm.LoginDelay = botManagerConfig.GetInt("LoginDelay", bm.LoginDelay); } IConfig botConfig = configSource.Configs["Bot"]; if (botConfig != null) { bm.InitBotSendAgentUpdates = botConfig.GetBoolean("SendAgentUpdates", bm.InitBotSendAgentUpdates); bm.InitBotRequestObjectTextures = botConfig.GetBoolean("RequestObjectTextures", bm.InitBotRequestObjectTextures); } } int botcount = commandLineConfig.GetInt("botcount", 1); bool startConnected = commandLineConfig.Get("connect") != null; bm.CreateBots(botcount, commandLineConfig); if (startConnected) bm.ConnectBots(botcount); while (true) { try { MainConsole.Instance.Prompt(); } catch (Exception e) { m_log.ErrorFormat("Command error: {0}", e); } } } }