aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/OpenSim.GUI/Main.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Tools/OpenSim.GUI/Main.cs187
1 files changed, 187 insertions, 0 deletions
diff --git a/OpenSim/Tools/OpenSim.GUI/Main.cs b/OpenSim/Tools/OpenSim.GUI/Main.cs
new file mode 100644
index 0000000..b9ea209
--- /dev/null
+++ b/OpenSim/Tools/OpenSim.GUI/Main.cs
@@ -0,0 +1,187 @@
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8
9namespace OpenSim.GUI
10{
11 public partial class Main : Form
12 {
13
14 public ProcessManager proc_OpenSim;
15 public ProcessManager proc_UserServer;
16 public ProcessManager proc_GridServer;
17 public ProcessManager proc_AssetServer;
18
19 public Main()
20 {
21 InitializeComponent();
22 }
23
24 private void Main_Load(object sender, EventArgs e)
25 {
26 txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress);
27 txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress);
28 txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress);
29 txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress);
30
31 tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected);
32 }
33
34 void tabLogs_Selected(object sender, TabControlEventArgs e)
35 {
36 if (e.TabPage == tabUserServer)
37 txtInputUserServer.Focus();
38 if (e.TabPage == tabGridServer)
39 txtInputGridServer.Focus();
40 if (e.TabPage == tabAssetServer)
41 txtInputAssetServer.Focus();
42 if (e.TabPage == tabRegionServer)
43 txtInputRegionServer.Focus();
44 }
45
46 void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e)
47 {
48
49 if (e.KeyChar == 13)
50 {
51 // We got a command
52 e.Handled = true;
53 proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n");
54 txtInputUserServer.Text = "";
55 }
56 }
57
58 void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e)
59 {
60 if (e.KeyChar == 13)
61 {
62 // We got a command
63 e.Handled = true;
64 proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n");
65 txtInputGridServer.Text = "";
66 }
67 }
68
69 void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e)
70 {
71 if (e.KeyChar == 13)
72 {
73 // We got a command
74 e.Handled = true;
75 proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n");
76 txtInputAssetServer.Text = "";
77 }
78 }
79
80 void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e)
81 {
82 if (e.KeyChar == 13)
83 {
84 // We got a command
85 e.Handled = true;
86 proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n");
87 txtInputRegionServer.Text = "";
88 }
89 }
90
91 private void btnStart_Click(object sender, EventArgs e)
92 {
93 btnStart.Enabled = false;
94 btnStop.Enabled = false;
95
96 // Start UserServer
97 proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", "");
98 txtMainLog.AppendText("Starting: UserServer");
99 proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
100 proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived);
101 proc_UserServer.StartProcess();
102 System.Threading.Thread.Sleep(2000);
103
104 // Start GridServer
105 proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", "");
106 txtMainLog.AppendText("Starting: GridServer");
107 proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
108 proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived);
109 proc_GridServer.StartProcess();
110 System.Threading.Thread.Sleep(2000);
111
112 // Start AssetServer
113 proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", "");
114 txtMainLog.AppendText("Starting: AssetServer");
115 proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
116 proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived);
117 proc_AssetServer.StartProcess();
118 System.Threading.Thread.Sleep(2000);
119
120 // Start OpenSim
121 proc_OpenSim = new ProcessManager("OpenSim.EXE", "-gridmode=true");
122 txtMainLog.AppendText("Starting: OpenSim");
123 proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
124 proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived);
125 proc_OpenSim.StartProcess();
126
127 btnStart.Enabled = false;
128 btnStop.Enabled = true;
129
130 }
131 public delegate void AppendText(string Text);
132 void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
133 {
134 this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" });
135 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" });
136 }
137 void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
138 {
139 this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" });
140 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" });
141 }
142 void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
143 {
144 this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" });
145 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" });
146 }
147 void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
148 {
149 this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" });
150 this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" });
151 }
152
153 private void btnStop_Click(object sender, EventArgs e)
154 {
155 btnStart.Enabled = false;
156 btnStop.Enabled = false;
157
158 if (proc_UserServer != null)
159 {
160 txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime);
161 proc_UserServer.StopProcess();
162 }
163 if (proc_GridServer != null)
164 {
165 txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime);
166 proc_GridServer.StopProcess();
167 }
168 if (proc_AssetServer != null)
169 {
170 txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime);
171 proc_AssetServer.StopProcess();
172 }
173 if (proc_OpenSim != null)
174 {
175 txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime);
176 proc_OpenSim.StopProcess();
177 }
178
179 btnStart.Enabled = true;
180 btnStop.Enabled = false;
181
182
183 }
184
185
186 }
187} \ No newline at end of file