diff options
Switched in NameSpaceChanges
Diffstat (limited to 'tools/mass test client/Program.cs')
-rw-r--r-- | tools/mass test client/Program.cs | 225 |
1 files changed, 0 insertions, 225 deletions
diff --git a/tools/mass test client/Program.cs b/tools/mass test client/Program.cs deleted file mode 100644 index bc30a1c..0000000 --- a/tools/mass test client/Program.cs +++ /dev/null | |||
@@ -1,225 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.IO; | ||
4 | using CommandLine.Utility; | ||
5 | |||
6 | namespace libsecondlife.TestClient | ||
7 | { | ||
8 | public class CommandLineArgumentsException : Exception | ||
9 | { | ||
10 | } | ||
11 | |||
12 | public class Program | ||
13 | { | ||
14 | |||
15 | private static void Usage() | ||
16 | { | ||
17 | Console.WriteLine("Usage: " + Environment.NewLine + | ||
18 | "MassTestClient.exe --first \"firstname\" --last \"lastname\" --pass \"password\" --contact \"youremail\" [--startpos \"sim/x/y/z\"] [--master \"master name\"] [--masterkey \"master uuid\"] [--loginuri] [--masscommandfile \"filename\"]" + | ||
19 | Environment.NewLine + Environment.NewLine + "MassTestClient.exe --loginfile \"filename\" --contact \"youremail\" [--master \"master name\"] [--masterkey \"master uuid\"] [--loginuri] [--masscommandfile \"filename\"]"); | ||
20 | Console.ReadLine(); | ||
21 | } | ||
22 | |||
23 | private static List<string> getMassTestCommands() | ||
24 | { | ||
25 | List<string> givenCommands = new List<string>(); | ||
26 | Console.WriteLine("Please enter mass test commands to run in an infinite loop. Press enter to end the current command. Entering a blank command represents that you are done."); | ||
27 | Console.WriteLine(""); | ||
28 | |||
29 | int curCommand = 0; | ||
30 | string lastCommand = "NULL"; | ||
31 | while (lastCommand.Length > 0) | ||
32 | { | ||
33 | Console.Write("Command #" + curCommand + ">"); | ||
34 | lastCommand = Console.ReadLine().Trim(); | ||
35 | if (lastCommand.Length > 0) | ||
36 | { | ||
37 | givenCommands.Add(lastCommand); | ||
38 | curCommand++; | ||
39 | } | ||
40 | } | ||
41 | |||
42 | return givenCommands; | ||
43 | } | ||
44 | |||
45 | static void Main(string[] args) | ||
46 | { | ||
47 | Arguments arguments = new Arguments(args); | ||
48 | |||
49 | ClientManager manager; | ||
50 | List<LoginDetails> accounts = new List<LoginDetails>(); | ||
51 | LoginDetails account; | ||
52 | string masterName = String.Empty; | ||
53 | LLUUID masterKey = LLUUID.Zero; | ||
54 | string file = String.Empty; | ||
55 | string contact = String.Empty; | ||
56 | string loginURI = "https://login.agni.lindenlab.com/cgi-bin/login.cgi"; | ||
57 | |||
58 | try | ||
59 | { | ||
60 | if (arguments["masterkey"] != null) | ||
61 | { | ||
62 | masterKey = LLUUID.Parse(arguments["masterkey"]); | ||
63 | } | ||
64 | |||
65 | if (arguments["master"] != null) | ||
66 | { | ||
67 | masterName = arguments["master"]; | ||
68 | } | ||
69 | |||
70 | if (arguments["contact"] == null) | ||
71 | throw new CommandLineArgumentsException(); | ||
72 | |||
73 | contact = arguments["contact"]; | ||
74 | |||
75 | if (arguments["loginfile"] != null) | ||
76 | { | ||
77 | file = arguments["loginfile"]; | ||
78 | |||
79 | // Loading names from a file | ||
80 | try | ||
81 | { | ||
82 | using (StreamReader reader = new StreamReader(file)) | ||
83 | { | ||
84 | string line; | ||
85 | int lineNumber = 0; | ||
86 | |||
87 | while ((line = reader.ReadLine()) != null) | ||
88 | { | ||
89 | lineNumber++; | ||
90 | string[] tokens = line.Trim().Split(new char[] { ' ', ',' }); | ||
91 | |||
92 | if (tokens.Length >= 3) | ||
93 | { | ||
94 | account = new LoginDetails(); | ||
95 | account.FirstName = tokens[0]; | ||
96 | account.LastName = tokens[1]; | ||
97 | account.Password = tokens[2]; | ||
98 | |||
99 | accounts.Add(account); | ||
100 | |||
101 | // Leaving this out until we have per-account masters (if that | ||
102 | // is desirable). For now the command-line option can | ||
103 | // specify the single master that TestClient supports | ||
104 | |||
105 | //if (tokens.Length == 5) | ||
106 | //{ | ||
107 | // master = tokens[3] + " " + tokens[4]; | ||
108 | //} | ||
109 | } | ||
110 | else | ||
111 | { | ||
112 | Console.WriteLine("Invalid data on line " + lineNumber + | ||
113 | ", must be in the format of: FirstName LastName Password"); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | catch (Exception e) | ||
119 | { | ||
120 | Console.WriteLine("Error reading from " + args[1]); | ||
121 | Console.WriteLine(e.ToString()); | ||
122 | Console.ReadLine(); | ||
123 | return; | ||
124 | } | ||
125 | } | ||
126 | else if (arguments["first"] != null && arguments["last"] != null && arguments["pass"] != null) | ||
127 | { | ||
128 | // Taking a single login off the command-line | ||
129 | account = new LoginDetails(); | ||
130 | account.FirstName = arguments["first"]; | ||
131 | account.LastName = arguments["last"]; | ||
132 | account.Password = arguments["pass"]; | ||
133 | |||
134 | accounts.Add(account); | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | throw new CommandLineArgumentsException(); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | catch (CommandLineArgumentsException) | ||
143 | { | ||
144 | Usage(); | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | if (arguments["loginuri"] != null) | ||
149 | { | ||
150 | Console.WriteLine("Please enter a login uri. If you enter nothing, AGNI grid is assumed:"); | ||
151 | string temp = Console.ReadLine(); | ||
152 | if (temp.Trim().Length > 0) | ||
153 | { | ||
154 | loginURI = temp.Trim(); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | List<string> massTestCommands = new List<string>(); | ||
159 | if (arguments["masscommandfile"] != null) | ||
160 | { | ||
161 | string massCommandFile = arguments["masscommandfile"]; | ||
162 | try | ||
163 | { | ||
164 | using (StreamReader reader = new StreamReader(massCommandFile)) | ||
165 | { | ||
166 | string line; | ||
167 | |||
168 | while ((line = reader.ReadLine()) != null) | ||
169 | { | ||
170 | |||
171 | line = line.Trim(); | ||
172 | if (line.Length > 0) | ||
173 | { | ||
174 | massTestCommands.Add(line); | ||
175 | } | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | catch (Exception e) | ||
180 | { | ||
181 | Console.WriteLine("Error reading from " + args[1]); | ||
182 | Console.WriteLine(e.ToString()); | ||
183 | Console.ReadLine(); | ||
184 | return; | ||
185 | } | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | Console.Clear(); | ||
190 | massTestCommands = getMassTestCommands(); | ||
191 | } | ||
192 | |||
193 | Console.Clear(); | ||
194 | if (massTestCommands.Count == 0) | ||
195 | { | ||
196 | Console.WriteLine("No mass commands entered; Normal 'TestClient' operation will be used"); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | Console.WriteLine("Detected " + massTestCommands.Count + " mass commands; MassTestClient operation will be used"); | ||
201 | } | ||
202 | |||
203 | Console.WriteLine(loginURI); | ||
204 | foreach (LoginDetails a in accounts) | ||
205 | { | ||
206 | a.MasterName = masterName; | ||
207 | a.MasterKey = masterKey; | ||
208 | a.LoginURI = loginURI; | ||
209 | } | ||
210 | |||
211 | // Login the accounts and run the input loop | ||
212 | if (arguments["startpos"] != null) | ||
213 | { | ||
214 | manager = new ClientManager(accounts, contact, arguments["startpos"]); | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | manager = new ClientManager(accounts, contact); | ||
219 | } | ||
220 | |||
221 | |||
222 | manager.Run(massTestCommands); | ||
223 | } | ||
224 | } | ||
225 | } | ||