diff options
Diffstat (limited to 'OpenSim/Tools/pCampBot/pCampBot.cs')
-rw-r--r-- | OpenSim/Tools/pCampBot/pCampBot.cs | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs index b701d7d..56f2e26 100644 --- a/OpenSim/Tools/pCampBot/pCampBot.cs +++ b/OpenSim/Tools/pCampBot/pCampBot.cs | |||
@@ -52,34 +52,40 @@ namespace pCampBot | |||
52 | [STAThread] | 52 | [STAThread] |
53 | public static void Main(string[] args) | 53 | public static void Main(string[] args) |
54 | { | 54 | { |
55 | //Set up our nifty config.. thanks to nini | 55 | IConfig config = ParseConfig(args); |
56 | ArgvConfigSource cs = new ArgvConfigSource(args); | 56 | if (config.Get("help") != null || config.Get("loginuri") == null) { |
57 | |||
58 | cs.AddSwitch("Startup", "botcount","n"); | ||
59 | cs.AddSwitch("Startup", "loginuri","l"); | ||
60 | cs.AddSwitch("Startup", "firstname"); | ||
61 | cs.AddSwitch("Startup", "lastname"); | ||
62 | cs.AddSwitch("Startup", "password"); | ||
63 | cs.AddSwitch("Startup", "help","h"); | ||
64 | |||
65 | IConfig ol = cs.Configs["Startup"]; | ||
66 | if (ol.Get("help") != null) { | ||
67 | Help(); | 57 | Help(); |
68 | } else { | 58 | } else { |
69 | int botcount = ol.GetInt("botcount", 1); | 59 | int botcount = config.GetInt("botcount", 1); |
70 | 60 | ||
71 | BotManager bm = new BotManager(); | 61 | BotManager bm = new BotManager(); |
72 | 62 | ||
73 | //startup specified number of bots. 1 is the default | 63 | //startup specified number of bots. 1 is the default |
74 | bm.dobotStartup(botcount, ol); | 64 | bm.dobotStartup(botcount, config); |
75 | while (true) | 65 | while (true) |
76 | { | 66 | { |
77 | MainConsole.Instance.Prompt(); | 67 | MainConsole.Instance.Prompt(); |
78 | } | 68 | } |
79 | } | 69 | } |
80 | } | 70 | } |
71 | |||
72 | private static IConfig ParseConfig(String[] args) | ||
73 | { | ||
74 | //Set up our nifty config.. thanks to nini | ||
75 | ArgvConfigSource cs = new ArgvConfigSource(args); | ||
76 | |||
77 | cs.AddSwitch("Startup", "botcount","n"); | ||
78 | cs.AddSwitch("Startup", "loginuri","l"); | ||
79 | cs.AddSwitch("Startup", "firstname"); | ||
80 | cs.AddSwitch("Startup", "lastname"); | ||
81 | cs.AddSwitch("Startup", "password"); | ||
82 | cs.AddSwitch("Startup", "help","h"); | ||
83 | |||
84 | IConfig ol = cs.Configs["Startup"]; | ||
85 | return ol; | ||
86 | } | ||
81 | 87 | ||
82 | public static void Help() | 88 | private static void Help() |
83 | { | 89 | { |
84 | System.Console.WriteLine( | 90 | System.Console.WriteLine( |
85 | "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + | 91 | "usage: pCampBot <-loginuri loginuri> [OPTIONS]\n" + |