aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/pCampBot/pCampBot.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/pCampBot/pCampBot.cs')
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs35
1 files changed, 29 insertions, 6 deletions
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 2707a49..e43037d 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using System.Reflection; 30using System.Reflection;
30using System.Threading; 31using System.Threading;
31using log4net; 32using log4net;
@@ -50,28 +51,50 @@ namespace pCampBot
50 { 51 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 53
54 public const string ConfigFileName = "pCampbot.ini";
55
53 [STAThread] 56 [STAThread]
54 public static void Main(string[] args) 57 public static void Main(string[] args)
55 { 58 {
56 XmlConfigurator.Configure(); 59 XmlConfigurator.Configure();
57 60
58 IConfig config = ParseConfig(args); 61 IConfig commandLineConfig = ParseConfig(args);
59 if (config.Get("help") != null || config.Get("loginuri") == null) 62 if (commandLineConfig.Get("help") != null || commandLineConfig.Get("loginuri") == null)
60 { 63 {
61 Help(); 64 Help();
62 } 65 }
63 else if (config.Get("firstname") == null || config.Get("lastname") == null || config.Get("password") == null) 66 else if (
67 commandLineConfig.Get("firstname") == null
68 || commandLineConfig.Get("lastname") == null
69 || commandLineConfig.Get("password") == null)
64 { 70 {
65 Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots."); 71 Console.WriteLine("ERROR: You must supply a firstname, lastname and password for the bots.");
66 } 72 }
67 else 73 else
68 { 74 {
69 int botcount = config.GetInt("botcount", 1);
70
71 BotManager bm = new BotManager(); 75 BotManager bm = new BotManager();
72 76
77 string iniFilePath = Path.GetFullPath(Path.Combine(Util.configDir(), ConfigFileName));
78
79 if (File.Exists(iniFilePath))
80 {
81 m_log.InfoFormat("[PCAMPBOT]: Reading configuration settings from {0}", iniFilePath);
82
83 IConfigSource configSource = new IniConfigSource(iniFilePath);
84
85 IConfig botConfig = configSource.Configs["Bot"];
86
87 if (botConfig != null)
88 {
89 bm.BotsInitSendAgentUpdates
90 = botConfig.GetBoolean("SendAgentUpdates", bm.BotsInitSendAgentUpdates);
91 }
92 }
93
94 int botcount = commandLineConfig.GetInt("botcount", 1);
95
73 //startup specified number of bots. 1 is the default 96 //startup specified number of bots. 1 is the default
74 Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, config)); 97 Thread startBotThread = new Thread(o => bm.dobotStartup(botcount, commandLineConfig));
75 startBotThread.Name = "Initial start bots thread"; 98 startBotThread.Name = "Initial start bots thread";
76 startBotThread.Start(); 99 startBotThread.Start();
77 100