require -loginuri on pCampBot

0.6.0-stable
Sean Dague 2008-02-26 21:10:57 +00:00
parent b8e6d6e245
commit 8d31fc2cd0
2 changed files with 22 additions and 16 deletions

View File

@ -117,7 +117,7 @@ namespace pCampBot
firstname = startupConfig.GetString("firstname", "random");
lastname = startupConfig.GetString("lastname", "random");
password = startupConfig.GetString("password", "12345");
loginURI = startupConfig.GetString("loginuri", "http://10.1.1.5:9000");
loginURI = startupConfig.GetString("loginuri");

View File

@ -51,6 +51,25 @@ namespace pCampBot
{
[STAThread]
public static void Main(string[] args)
{
IConfig config = ParseConfig(args);
if (config.Get("help") != null || config.Get("loginuri") == null) {
Help();
} else {
int botcount = config.GetInt("botcount", 1);
BotManager bm = new BotManager();
//startup specified number of bots. 1 is the default
bm.dobotStartup(botcount, config);
while (true)
{
MainConsole.Instance.Prompt();
}
}
}
private static IConfig ParseConfig(String[] args)
{
//Set up our nifty config.. thanks to nini
ArgvConfigSource cs = new ArgvConfigSource(args);
@ -63,23 +82,10 @@ namespace pCampBot
cs.AddSwitch("Startup", "help","h");
IConfig ol = cs.Configs["Startup"];
if (ol.Get("help") != null) {
Help();
} else {
int botcount = ol.GetInt("botcount", 1);
BotManager bm = new BotManager();
//startup specified number of bots. 1 is the default
bm.dobotStartup(botcount, ol);
while (true)
{
MainConsole.Instance.Prompt();
}
}
return ol;
}
public static void Help()
private static void Help()
{
System.Console.WriteLine(
"usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" +