aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/OpenSim.GUI/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/OpenSim.GUI/Main.cs')
-rw-r--r--OpenSim/Tools/OpenSim.GUI/Main.cs536
1 files changed, 0 insertions, 536 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/Main.cs b/OpenSim/Tools/OpenSim.GUI/Main.cs
deleted file mode 100644
index 9467312..0000000
--- a/OpenSim/Tools/OpenSim.GUI/Main.cs
+++ /dev/null
@@ -1,536 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.ComponentModel;
31using System.Data;
32using System.Drawing;
33using System.Text;
34using System.Windows.Forms;
35
36namespace OpenSim.GUI
37{
38 public partial class Main : Form
39 {
40
41 public ProcessManager proc_OpenSim;
42 public ProcessManager proc_UserServer;
43 public ProcessManager proc_GridServer;
44 public ProcessManager proc_AssetServer;
45
46 public Main()
47 {
48 InitializeComponent();
49 }
50
51 private void Main_Load(object sender, EventArgs e)
52 {
53 txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress);
54 txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress);
55 txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress);
56 txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress);
57
58 tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected);
59
60 UpdateTabVisibility();
61 }
62
63 void tabLogs_Selected(object sender, TabControlEventArgs e)
64 {
65 if (e.TabPage == tabUserServer)
66 txtInputUserServer.Focus();
67 if (e.TabPage == tabGridServer)
68 txtInputGridServer.Focus();
69 if (e.TabPage == tabAssetServer)
70 txtInputAssetServer.Focus();
71 if (e.TabPage == tabRegionServer)
72 txtInputRegionServer.Focus();
73 }
74
75 void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e)
76 {
77
78 if (e.KeyChar == 13)
79 {
80 // We got a command
81 e.Handled = true;
82 proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n");
83 txtInputUserServer.Text = "";
84 }
85 }
86
87 void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e)
88 {
89 if (e.KeyChar == 13)
90 {
91 // We got a command
92 e.Handled = true;
93 proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n");
94 txtInputGridServer.Text = "";
95 }
96 }
97
98 void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e)
99 {
100 if (e.KeyChar == 13)
101 {
102 // We got a command
103 e.Handled = true;
104 proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n");
105 txtInputAssetServer.Text = "";
106 }
107 }
108
109 void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e)
110 {
111 if (e.KeyChar == 13)
112 {
113 // We got a command
114 e.Handled = true;
115 proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n");
116 txtInputRegionServer.Text = "";
117 }
118 }
119
120 private void btnStart_Click(object sender, EventArgs e)
121 {
122 noProbe1.Checked = true;
123 multiple1.Checked = true;
124 loginuri1.Checked = true;
125 login1.Checked = true;
126 //
127 // THIS PART NEEDS TO BE MOVED TO A SEPARATE THREAD OR A TIMER OF SOME SORT
128 // should not block on wait
129 // ALSO - IF SOME SERVICES ARE NOT CONFIGURED, POP UP CONFIGURATION BOX FOR THAT SERVICE!
130 //
131
132 btnStart.Enabled = false;
133 btnStop.Enabled = false;
134
135
136
137 if (rbGridServer.Checked)
138 {
139 // Start UserServer
140 proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", "");
141 txtMainLog.AppendText("Starting: User server" + "\r\n");
142 proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
143 proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
144 proc_UserServer.StartProcess();
145 System.Threading.Thread.Sleep(3000);
146
147 // Start GridServer
148 proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", "");
149 txtMainLog.AppendText("Starting: Grid server" + "\r\n");
150 proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
151 proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
152 proc_GridServer.StartProcess();
153 System.Threading.Thread.Sleep(3000);
154
155 // Start AssetServer
156 proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", "");
157 txtMainLog.AppendText("Starting: Asset server" + "\r\n");
158 proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
159 proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
160 proc_AssetServer.StartProcess();
161 System.Threading.Thread.Sleep(3000);
162 }
163
164 // Start OpenSim
165 string p = "";
166 if (rbGridServer.Checked)
167 p = "-gridmode=true";
168
169 proc_OpenSim = new ProcessManager("OpenSim.EXE", p);
170 txtMainLog.AppendText("Starting: OpenSim (Region server)" + "\r\n");
171 proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
172 proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
173 proc_OpenSim.StartProcess();
174
175 btnStart.Enabled = false;
176 btnStop.Enabled = true;
177
178 }
179 public delegate void AppendText(string Text);
180 void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
181 {
182 this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" });
183 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" });
184 }
185 void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
186 {
187 this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" });
188 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" });
189 }
190 void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
191 {
192 this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" });
193 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" });
194 }
195 void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
196 {
197 this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" });
198 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" });
199 }
200
201 private void btnStop_Click(object sender, EventArgs e)
202 {
203 btnStart.Enabled = false;
204 btnStop.Enabled = false;
205 Stop();
206 btnStart.Enabled = true;
207 btnStop.Enabled = false;
208 }
209
210 private void clear1_Click(object sender, EventArgs e)
211 {
212 noProbe1.Checked = false; multiple1.Checked = false; loginuri1.Checked = false;
213 noMultiple1.Checked = false; korean1.Checked = false; spanish1.Checked = false;
214 ignorepixeldepth1.Checked = false; nothread1.Checked = false; safe1.Checked = false;
215 noconsole1.Checked = false; log1.Checked = false; helperuri1.Checked = false;
216 autologin1.Checked = false; dialog1.Checked = false; previous1.Checked = false;
217 simple1.Checked = false; noinvlib1.Checked = false; noutc1.Checked = false;
218 debugst1.Checked = false; local1.Checked = false; purge1.Checked = false;
219 nofmod1.Checked = false; nosound1.Checked = false; noaudio1.Checked = false;
220 url1.Checked = false; port1.Checked = false; drop1.Checked = false;
221 inbw1.Checked = false; outbw1.Checked = false; settings1.Checked = false;
222 logfile1.Checked = false; yield1.Checked = false; techTag1.Checked = false;
223 quitAfter1.Checked = false; loginuri1.Checked = false; set1.Checked = false;
224 errmask1.Checked = false; raw1.Checked = false; skin1.Checked = false;
225 user1.Checked = false; login1.Checked = false;
226 }
227
228 private void Stop()
229 {
230 if (proc_UserServer != null)
231 {
232 txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime.ToString() + "\r\n");
233 proc_UserServer.StopProcess();
234 proc_UserServer = null;
235 }
236 if (proc_GridServer != null)
237 {
238 txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime.ToString() + "\r\n");
239 proc_GridServer.StopProcess();
240 proc_GridServer = null;
241 }
242 if (proc_AssetServer != null)
243 {
244 txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime.ToString() + "\r\n");
245 proc_AssetServer.StopProcess();
246 proc_AssetServer = null;
247 }
248 if (proc_OpenSim != null)
249 {
250 txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime.ToString() + "\r\n");
251 proc_OpenSim.StopProcess();
252 proc_OpenSim = null;
253 }
254 }
255 private void UpdateTabVisibility()
256 {
257 if (rbStandAloneMode.Checked)
258 {
259 if (tabLogs.TabPages.Contains(tabUserServer))
260 tabLogs.TabPages.Remove(tabUserServer);
261 if (tabLogs.TabPages.Contains(tabGridServer))
262 tabLogs.TabPages.Remove(tabGridServer);
263 if (tabLogs.TabPages.Contains(tabAssetServer))
264 tabLogs.TabPages.Remove(tabAssetServer);
265 }
266 else
267 {
268 if (!tabLogs.TabPages.Contains(tabUserServer))
269 tabLogs.TabPages.Add(tabUserServer);
270 if (!tabLogs.TabPages.Contains(tabGridServer))
271 tabLogs.TabPages.Add(tabGridServer);
272 if (!tabLogs.TabPages.Contains(tabAssetServer))
273 tabLogs.TabPages.Add(tabAssetServer);
274 }
275 }
276
277 private void rbStandAloneMode_CheckedChanged(object sender, EventArgs e)
278 {
279 UpdateTabVisibility();
280 }
281
282 private void rbGridRegionMode_CheckedChanged(object sender, EventArgs e)
283 {
284 UpdateTabVisibility();
285 }
286
287 private void rbGridServer_CheckedChanged(object sender, EventArgs e)
288 {
289 UpdateTabVisibility();
290 }
291
292 private int counter;
293
294 private void Exit()
295 {
296 counter = 0;
297 timer1.Interval = 600;
298 timer1.Enabled = true;
299 this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
300 }
301
302 private void timer1_Tick(object sender, System.EventArgs e)
303 {
304 if (counter >= 10)
305 {
306 timer1.Enabled = false;
307 counter = 0;
308 Application.Exit();
309 }
310 else
311 {
312 counter = counter + 1;
313 }
314 }
315
316 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
317 {
318 if (proc_UserServer != null || proc_GridServer != null || proc_AssetServer != null || proc_OpenSim != null)
319 {
320 label6.Text = "Stopping server(s) and waiting to safely close..............";
321 Stop();
322 Exit();
323 }
324 else
325 {
326 Application.Exit();
327 }
328 }
329 /// <summary>
330 /// CLIENT SECTION
331 /// </summary>
332 string exeString;
333 string exeArgs;
334 string usrsvr;
335 string error = "Reconsider your commandline choices, you have opposing values selected!";
336
337 private void label6_Click(object sender, EventArgs e)
338 {
339 label6.Text = clientBox1.Text;
340 }
341 private void errorSwitches()
342 {
343 MessageBox.Show(error);
344 label6.Text = error;
345 }
346 bool exists;
347 private void Launch1_Click(object sender, EventArgs e)
348 {
349 if (exists = System.IO.File.Exists(clientBox1.Text + exeBox1.Text))
350 {
351 executeClient();
352 }
353 else
354 {
355 MessageBox.Show("FILE DOES NOT EXIST!!!");
356 label6.Text = "FILE DOES NOT EXIST!!!";
357 }
358 }
359 private void NATfix()
360 {
361 }
362 private void executeClient()
363 {
364 label6.Text = "";
365 exeArgs = "";
366 exeString = clientBox1.Text;
367 exeString = exeString += exeBox1.Text;
368
369 if (multiple1.Checked == true && noMultiple1.Checked == true) errorSwitches();
370 else if (korean1.Checked == true && spanish1.Checked == true) errorSwitches();
371 else
372 {
373 if (noProbe1.Checked == true) exeArgs = exeArgs += " -noprobe";
374 if (multiple1.Checked == true) exeArgs = exeArgs += " -multiple";
375 if (noMultiple1.Checked == true) exeArgs = exeArgs += " -nomultiple";
376 if (korean1.Checked == true) exeArgs = exeArgs += " -korean";
377 if (spanish1.Checked == true) exeArgs = exeArgs += " -spanish";
378 if (ignorepixeldepth1.Checked == true) exeArgs = exeArgs += " -ignorepixeldepth";
379 if (nothread1.Checked == true) exeArgs = exeArgs += " -nothread";
380 if (safe1.Checked == true) exeArgs = exeArgs += " -safe";
381 if (noconsole1.Checked == true) exeArgs = exeArgs += " -noconsole";
382 if (log1.Checked == true) exeArgs = exeArgs += " -log";
383 if (helperuri1.Checked == true) exeArgs = exeArgs += " -helperuri";
384 if (autologin1.Checked == true) exeArgs = exeArgs += " --autologin";
385 if (dialog1.Checked == true) exeArgs = exeArgs += " -dialog";
386 if (previous1.Checked == true) exeArgs = exeArgs += " -previous";
387 if (simple1.Checked == true) exeArgs = exeArgs += " -simple";
388 if (noinvlib1.Checked == true) exeArgs = exeArgs += " -noinvlib";
389 if (noutc1.Checked == true) exeArgs = exeArgs += " -noutc";
390 if (debugst1.Checked == true) exeArgs = exeArgs += " -debugst";
391 if (local1.Checked == true) exeArgs = exeArgs += " -local";
392 if (purge1.Checked == true) exeArgs = exeArgs += " -purge";
393 if (nofmod1.Checked == true) exeArgs = exeArgs += " -nofmod";
394 if (nosound1.Checked == true) exeArgs = exeArgs += " -nosound";
395 if (noaudio1.Checked == true) exeArgs = exeArgs += " -noaudio";
396 if (url1.Checked == true)
397 {
398 exeArgs = exeArgs += " -url ";
399 exeArgs = exeArgs += simBox1.Text;
400 }
401 if (port1.Checked == true)
402 {
403 int aPort;
404 aPort = Convert.ToInt32(portBox1.Text);
405 if (aPort > 13050)
406 {
407 portBox1.Text = "13050";
408 MessageBox.Show("Enter Usable port number, defaulting to 13050.");
409 }
410 if (aPort < 13000)
411 {
412 portBox1.Text = "13000";
413 MessageBox.Show("Enter Usable port number, defaulting to 13000.");
414 }
415 else
416 {
417 }
418 exeArgs = exeArgs += " -port ";
419 exeArgs = exeArgs += portBox1.Text;
420 }
421 if (drop1.Checked == true)
422 {
423 int aPct;
424 aPct = Convert.ToInt32(dropBox1.Text);
425 if (aPct > 100)
426 {
427 dropBox1.Text = "100";
428 MessageBox.Show("Enter Usable port number, defaulting to 100.");
429 }
430 if (aPct < 0)
431 {
432 dropBox1.Text = "0";
433 MessageBox.Show("Enter Usable port number, defaulting to 0.");
434 }
435 else
436 {
437 }
438 exeArgs = exeArgs += " -drop ";
439 exeArgs = exeArgs += dropBox1.Text;
440 }
441 if (inbw1.Checked == true)
442 {
443 exeArgs = exeArgs += " -inbw ";
444 exeArgs = exeArgs += inbwBox1.Text;
445 }
446 if (outbw1.Checked == true)
447 {
448 exeArgs = exeArgs += " -outbw ";
449 exeArgs = exeArgs += outbwBox1.Text;
450 }
451 if (settings1.Checked == true)
452 {
453 exeArgs = exeArgs += " -settings ";
454 exeArgs = exeArgs += settingsBox1.Text;
455 }
456 if (logfile1.Checked == true)
457 {
458 exeArgs = exeArgs += " -logfile ";
459 exeArgs = exeArgs += logfileBox1.Text;
460 }
461 if (yield1.Checked == true)
462 {
463 exeArgs = exeArgs += " -yield ";
464 exeArgs = exeArgs += yieldBox1.Text;
465 }
466 if (techTag1.Checked == true)
467 {
468 exeArgs = exeArgs += " -techtag ";
469 exeArgs = exeArgs += techtagBox1.Text;
470 }
471 if (quitAfter1.Checked == true)
472 {
473 exeArgs = exeArgs += " -quitafter ";
474 exeArgs = exeArgs += quitafterBox1.Text;
475 }
476 if (loginuri1.Checked == true)
477 {
478 exeArgs = exeArgs += " -loginuri ";
479 exeArgs = exeArgs += loginuriBox1.Text;
480 }
481 if (set1.Checked == true)
482 {
483 exeArgs = exeArgs += " -set ";
484 exeArgs = exeArgs += setBox1.Text;
485 }
486 if (errmask1.Checked == true)
487 {
488 exeArgs = exeArgs += " -errmask ";
489 exeArgs = exeArgs += errmaskBox1.Text;
490 }
491 if (raw1.Checked == true)
492 {
493 exeArgs = exeArgs += " " + rawBox1.Text;
494 }
495 if (skin1.Checked == true)
496 {
497 bool exists;
498 if (exists = System.IO.File.Exists(skinBox1.Text + "skin.xml"))
499 {
500 exeArgs = exeArgs += " -skin ";
501 exeArgs = exeArgs += skinBox1.Text + "skin.xml";
502 }
503 else
504 {
505 MessageBox.Show("SKIN FILE DOES NOT EXIST AT SPECIFIED LOCATION!!!");
506 skin1.Checked = false;
507 executeClient();
508 }
509 }
510 if (user1.Checked == true)
511 {
512 //find actual login urls
513 if (comboBox1.Text == "agni") { usrsvr = " -user " + "--agni"; }
514 if (comboBox1.Text == "colo") { usrsvr = " -user " + "--colo"; }
515 if (comboBox1.Text == "dmz") { usrsvr = " -user " + "--dmz"; }
516 if (comboBox1.Text == "durga") { usrsvr = " -user " + "--Durga"; }
517 if (comboBox1.Text == "siva") { usrsvr = " -user " + "--siva"; }
518 exeArgs = exeArgs += usrsvr;
519 }
520 if (login1.Checked == true)
521 {
522 exeArgs = exeArgs += " -login ";
523 exeArgs = exeArgs += firstBox1.Text + " " + lastBox1.Text + " " + passBox1.Text;
524 }
525 label6.Text = exeString + exeArgs;
526 System.Diagnostics.Process proc = new System.Diagnostics.Process();
527 proc.StartInfo.FileName = exeString;
528 proc.StartInfo.Arguments = exeArgs;
529 proc.StartInfo.UseShellExecute = false;
530 proc.StartInfo.RedirectStandardOutput = false;
531 proc.StartInfo.WorkingDirectory = clientBox1.Text;
532 proc.Start();
533 }
534 }
535 }
536}