aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ExportBot/Program.cs
diff options
context:
space:
mode:
authorgareth2007-05-08 00:10:04 +0000
committergareth2007-05-08 00:10:04 +0000
commit5b6afeafbc249ba88dcc20d1fbc98ce12418b21b (patch)
tree78861e5f6ae871d63c83b4ab1cc4c55ea184ed6d /ExportBot/Program.cs
parentZOMG! (diff)
downloadopensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.zip
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.gz
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.bz2
opensim-SC_OLD-5b6afeafbc249ba88dcc20d1fbc98ce12418b21b.tar.xz
Brought in TestClient code for teh fork
Diffstat (limited to 'ExportBot/Program.cs')
-rw-r--r--ExportBot/Program.cs127
1 files changed, 127 insertions, 0 deletions
diff --git a/ExportBot/Program.cs b/ExportBot/Program.cs
new file mode 100644
index 0000000..705cf90
--- /dev/null
+++ b/ExportBot/Program.cs
@@ -0,0 +1,127 @@
1using System;
2using System.Collections.Generic;
3using System.IO;
4using CommandLine.Utility;
5
6namespace libsecondlife.TestClient
7{
8 public class Program
9 {
10 private static void Usage()
11 {
12 Console.WriteLine("Usage: " + Environment.NewLine +
13 "TestClient.exe --first firstname --last lastname --pass password --contact \"youremail\" [--startpos \"sim/x/y/z\"] [--master \"master name\"] [--masterkey \"master uuid\"]" +
14 Environment.NewLine + "TestClient.exe --file filename --contact \"youremail\" [--master \"master name\"] [--masterkey \"master uuid\"]");
15 }
16
17 static void Main(string[] args)
18 {
19 Arguments arguments = new Arguments(args);
20
21 ClientManager manager;
22 List<LoginDetails> accounts = new List<LoginDetails>();
23 LoginDetails account;
24 string masterName = String.Empty;
25 LLUUID masterKey = LLUUID.Zero;
26 string file = String.Empty;
27 string contact = String.Empty;
28
29 if (arguments["masterkey"] != null)
30 {
31 masterKey = LLUUID.Parse(arguments["masterkey"]);
32 }
33 if (arguments["master"] != null)
34 {
35 masterName = arguments["master"];
36 }
37
38 if (arguments["contact"] != null)
39 {
40 contact = arguments["contact"];
41 if (arguments["file"] != null)
42 {
43 file = arguments["file"];
44
45 // Loading names from a file
46 try
47 {
48 using (StreamReader reader = new StreamReader(file))
49 {
50 string line;
51 int lineNumber = 0;
52
53 while ((line = reader.ReadLine()) != null)
54 {
55 lineNumber++;
56 string[] tokens = line.Trim().Split(new char[] { ' ', ',' });
57
58 if (tokens.Length >= 3)
59 {
60 account = new LoginDetails();
61 account.FirstName = tokens[0];
62 account.LastName = tokens[1];
63 account.Password = tokens[2];
64
65 accounts.Add(account);
66
67 // Leaving this out until we have per-account masters (if that
68 // is desirable). For now the command-line option can
69 // specify the single master that TestClient supports
70
71 //if (tokens.Length == 5)
72 //{
73 // master = tokens[3] + " " + tokens[4];
74 //}
75 }
76 else
77 {
78 Console.WriteLine("Invalid data on line " + lineNumber +
79 ", must be in the format of: FirstName LastName Password");
80 }
81 }
82 }
83 }
84 catch (Exception e)
85 {
86 Console.WriteLine("Error reading from " + args[1]);
87 Console.WriteLine(e.ToString());
88 return;
89 }
90 }
91 else
92 {
93 if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null)
94 {
95 // Taking a single login off the command-line
96 account = new LoginDetails();
97 account.FirstName = arguments["first"];
98 account.LastName = arguments["last"];
99 account.Password = arguments["pass"];
100
101 accounts.Add(account);
102 }
103 }
104 }
105 else
106 {
107 Usage();
108 return;
109 }
110
111 foreach (LoginDetails a in accounts)
112 {
113 a.MasterName = masterName;
114 a.MasterKey = masterKey;
115 }
116
117 // Login the accounts and run the input loop
118 if ( arguments["start"] != null ) {
119 manager = new ClientManager(accounts, contact, arguments["start"]);
120 } else {
121 manager = new ClientManager(accounts, contact);
122 }
123 manager.Run();
124
125 }
126 }
127}