From dcaab9103ce1b7475872ee3224ccf58c1266f95e Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Wed, 12 Sep 2007 13:03:21 +0000 Subject: [PATCH] Early alpha version of a GUI tool to configure and start OpenSim. Currently can start an already configured Grid server. --- .../Tools/OpenSim.GUI/InputTextBoxControl.cs | 88 +++++ OpenSim/Tools/OpenSim.GUI/Main.Designer.cs | 348 ++++++++++++++++++ OpenSim/Tools/OpenSim.GUI/Main.cs | 187 ++++++++++ OpenSim/Tools/OpenSim.GUI/Main.resx | 120 ++++++ OpenSim/Tools/OpenSim.GUI/OpenSim.GUI.csproj | 84 +++++ OpenSim/Tools/OpenSim.GUI/ProcessManager.cs | 71 ++++ OpenSim/Tools/OpenSim.GUI/Program.cs | 20 + .../OpenSim.GUI/Properties/AssemblyInfo.cs | 33 ++ .../Properties/Resources.Designer.cs | 71 ++++ .../OpenSim.GUI/Properties/Resources.resx | 117 ++++++ .../Properties/Settings.Designer.cs | 30 ++ .../OpenSim.GUI/Properties/Settings.settings | 7 + 12 files changed, 1176 insertions(+) create mode 100644 OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Main.Designer.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Main.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Main.resx create mode 100644 OpenSim/Tools/OpenSim.GUI/OpenSim.GUI.csproj create mode 100644 OpenSim/Tools/OpenSim.GUI/ProcessManager.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Program.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Properties/Resources.resx create mode 100644 OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs create mode 100644 OpenSim/Tools/OpenSim.GUI/Properties/Settings.settings diff --git a/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs new file mode 100644 index 0000000000..91b3f603d3 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/InputTextBoxControl.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Forms; + +namespace OpenSim.GUI +{ + class InputTextBoxControl:System.Windows.Forms.TextBox + { + public InputTextBoxControl() + { + this.KeyDown += new System.Windows.Forms.KeyEventHandler(TextInputControl_KeyDown); + } + + + private List CommandHistory = new List(); + private bool InHistory = false; + private int HistoryPosition = -1; + + void TextInputControl_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) + { + + + if (e.KeyCode == Keys.Enter && InHistory == false) + { + CommandHistory.Add(this.Text); + } + + + if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) + { + // if not inside buffer, enter + // InBuffer = true + //Console.WriteLine("History: Check"); + if (InHistory == false) + { + if (this.Text != "") + { + //Console.WriteLine("History: Add"); + CommandHistory.Add(this.Text); + HistoryPosition = CommandHistory.Count; + } + else + { + //HistoryPosition = CommandHistory.Count + 1; + } + //Console.WriteLine("History: InHistory"); + InHistory = true; + } + + if (e.KeyCode == Keys.Up) + HistoryPosition -= 1; + if (e.KeyCode == Keys.Down) + HistoryPosition += 1; + + if (HistoryPosition > CommandHistory.Count - 1) + HistoryPosition = -1; + if (HistoryPosition < -1) + HistoryPosition = CommandHistory.Count - 1; + + //Console.WriteLine("History: Pos: " + HistoryPosition); + //Console.WriteLine("History: HaveInHistCount: " + CommandHistory.Count); + if (CommandHistory.Count != 0) + { + if (HistoryPosition != -1) + { + //Console.WriteLine("History: Getting"); + //this.Text = CommandHistory.Item(HistoryPosition); + this.Text = CommandHistory[HistoryPosition]; + this.SelectionStart = this.Text.Length; + this.SelectionLength = 0; + } + else + { + //Console.WriteLine("History: Nothing"); + this.Text = ""; + } + } + e.Handled = true; + } else { + InHistory = false; + HistoryPosition = -1; + } + } + + + } +} diff --git a/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs new file mode 100644 index 0000000000..b1ed5a4579 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Main.Designer.cs @@ -0,0 +1,348 @@ +namespace OpenSim.GUI +{ + partial class Main + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabLogs = new System.Windows.Forms.TabControl(); + this.tabMainLog = new System.Windows.Forms.TabPage(); + this.txtMainLog = new System.Windows.Forms.TextBox(); + this.tabRegionServer = new System.Windows.Forms.TabPage(); + this.label1 = new System.Windows.Forms.Label(); + this.txtInputRegionServer = new OpenSim.GUI.InputTextBoxControl(); + this.txtOpenSim = new System.Windows.Forms.TextBox(); + this.tabUserServer = new System.Windows.Forms.TabPage(); + this.label2 = new System.Windows.Forms.Label(); + this.txtInputUserServer = new OpenSim.GUI.InputTextBoxControl(); + this.txtUserServer = new System.Windows.Forms.TextBox(); + this.tabAssetServer = new System.Windows.Forms.TabPage(); + this.label3 = new System.Windows.Forms.Label(); + this.txtInputAssetServer = new OpenSim.GUI.InputTextBoxControl(); + this.txtAssetServer = new System.Windows.Forms.TextBox(); + this.tabGridServer = new System.Windows.Forms.TabPage(); + this.label4 = new System.Windows.Forms.Label(); + this.txtInputGridServer = new OpenSim.GUI.InputTextBoxControl(); + this.txtGridServer = new System.Windows.Forms.TextBox(); + this.gbLog = new System.Windows.Forms.GroupBox(); + this.btnStart = new System.Windows.Forms.Button(); + this.btnStop = new System.Windows.Forms.Button(); + this.tabLogs.SuspendLayout(); + this.tabMainLog.SuspendLayout(); + this.tabRegionServer.SuspendLayout(); + this.tabUserServer.SuspendLayout(); + this.tabAssetServer.SuspendLayout(); + this.tabGridServer.SuspendLayout(); + this.gbLog.SuspendLayout(); + this.SuspendLayout(); + // + // tabLogs + // + this.tabLogs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabLogs.Controls.Add(this.tabMainLog); + this.tabLogs.Controls.Add(this.tabRegionServer); + this.tabLogs.Controls.Add(this.tabUserServer); + this.tabLogs.Controls.Add(this.tabAssetServer); + this.tabLogs.Controls.Add(this.tabGridServer); + this.tabLogs.Location = new System.Drawing.Point(6, 19); + this.tabLogs.Name = "tabLogs"; + this.tabLogs.SelectedIndex = 0; + this.tabLogs.Size = new System.Drawing.Size(562, 230); + this.tabLogs.TabIndex = 0; + // + // tabMainLog + // + this.tabMainLog.Controls.Add(this.txtMainLog); + this.tabMainLog.Location = new System.Drawing.Point(4, 22); + this.tabMainLog.Name = "tabMainLog"; + this.tabMainLog.Size = new System.Drawing.Size(554, 204); + this.tabMainLog.TabIndex = 4; + this.tabMainLog.Text = "Main log"; + this.tabMainLog.UseVisualStyleBackColor = true; + // + // txtMainLog + // + this.txtMainLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtMainLog.Location = new System.Drawing.Point(6, 5); + this.txtMainLog.Multiline = true; + this.txtMainLog.Name = "txtMainLog"; + this.txtMainLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtMainLog.Size = new System.Drawing.Size(542, 195); + this.txtMainLog.TabIndex = 1; + // + // tabRegionServer + // + this.tabRegionServer.Controls.Add(this.label1); + this.tabRegionServer.Controls.Add(this.txtInputRegionServer); + this.tabRegionServer.Controls.Add(this.txtOpenSim); + this.tabRegionServer.Location = new System.Drawing.Point(4, 22); + this.tabRegionServer.Name = "tabRegionServer"; + this.tabRegionServer.Padding = new System.Windows.Forms.Padding(3); + this.tabRegionServer.Size = new System.Drawing.Size(554, 204); + this.tabRegionServer.TabIndex = 0; + this.tabRegionServer.Text = "Region server"; + this.tabRegionServer.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 183); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(57, 13); + this.label1.TabIndex = 4; + this.label1.Text = "Command:"; + // + // txtInputRegionServer + // + this.txtInputRegionServer.Location = new System.Drawing.Point(69, 180); + this.txtInputRegionServer.Name = "txtInputRegionServer"; + this.txtInputRegionServer.Size = new System.Drawing.Size(479, 20); + this.txtInputRegionServer.TabIndex = 0; + // + // txtOpenSim + // + this.txtOpenSim.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtOpenSim.Location = new System.Drawing.Point(6, 6); + this.txtOpenSim.Multiline = true; + this.txtOpenSim.Name = "txtOpenSim"; + this.txtOpenSim.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtOpenSim.Size = new System.Drawing.Size(542, 168); + this.txtOpenSim.TabIndex = 0; + // + // tabUserServer + // + this.tabUserServer.Controls.Add(this.label2); + this.tabUserServer.Controls.Add(this.txtInputUserServer); + this.tabUserServer.Controls.Add(this.txtUserServer); + this.tabUserServer.Location = new System.Drawing.Point(4, 22); + this.tabUserServer.Name = "tabUserServer"; + this.tabUserServer.Padding = new System.Windows.Forms.Padding(3); + this.tabUserServer.Size = new System.Drawing.Size(554, 204); + this.tabUserServer.TabIndex = 1; + this.tabUserServer.Text = "User server"; + this.tabUserServer.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 181); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(57, 13); + this.label2.TabIndex = 6; + this.label2.Text = "Command:"; + // + // txtInputUserServer + // + this.txtInputUserServer.Location = new System.Drawing.Point(69, 178); + this.txtInputUserServer.Name = "txtInputUserServer"; + this.txtInputUserServer.Size = new System.Drawing.Size(479, 20); + this.txtInputUserServer.TabIndex = 5; + // + // txtUserServer + // + this.txtUserServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtUserServer.Location = new System.Drawing.Point(6, 5); + this.txtUserServer.Multiline = true; + this.txtUserServer.Name = "txtUserServer"; + this.txtUserServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtUserServer.Size = new System.Drawing.Size(542, 168); + this.txtUserServer.TabIndex = 1; + // + // tabAssetServer + // + this.tabAssetServer.Controls.Add(this.label3); + this.tabAssetServer.Controls.Add(this.txtInputAssetServer); + this.tabAssetServer.Controls.Add(this.txtAssetServer); + this.tabAssetServer.Location = new System.Drawing.Point(4, 22); + this.tabAssetServer.Name = "tabAssetServer"; + this.tabAssetServer.Size = new System.Drawing.Size(554, 204); + this.tabAssetServer.TabIndex = 2; + this.tabAssetServer.Text = "Asset server"; + this.tabAssetServer.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 182); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(57, 13); + this.label3.TabIndex = 6; + this.label3.Text = "Command:"; + // + // txtInputAssetServer + // + this.txtInputAssetServer.Location = new System.Drawing.Point(69, 179); + this.txtInputAssetServer.Name = "txtInputAssetServer"; + this.txtInputAssetServer.Size = new System.Drawing.Size(479, 20); + this.txtInputAssetServer.TabIndex = 5; + // + // txtAssetServer + // + this.txtAssetServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtAssetServer.Location = new System.Drawing.Point(6, 5); + this.txtAssetServer.Multiline = true; + this.txtAssetServer.Name = "txtAssetServer"; + this.txtAssetServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtAssetServer.Size = new System.Drawing.Size(542, 168); + this.txtAssetServer.TabIndex = 1; + // + // tabGridServer + // + this.tabGridServer.Controls.Add(this.label4); + this.tabGridServer.Controls.Add(this.txtInputGridServer); + this.tabGridServer.Controls.Add(this.txtGridServer); + this.tabGridServer.Location = new System.Drawing.Point(4, 22); + this.tabGridServer.Name = "tabGridServer"; + this.tabGridServer.Size = new System.Drawing.Size(554, 204); + this.tabGridServer.TabIndex = 3; + this.tabGridServer.Text = "Grid server"; + this.tabGridServer.UseVisualStyleBackColor = true; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 182); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(57, 13); + this.label4.TabIndex = 6; + this.label4.Text = "Command:"; + // + // txtInputGridServer + // + this.txtInputGridServer.Location = new System.Drawing.Point(69, 179); + this.txtInputGridServer.Name = "txtInputGridServer"; + this.txtInputGridServer.Size = new System.Drawing.Size(479, 20); + this.txtInputGridServer.TabIndex = 5; + // + // txtGridServer + // + this.txtGridServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtGridServer.Location = new System.Drawing.Point(6, 5); + this.txtGridServer.Multiline = true; + this.txtGridServer.Name = "txtGridServer"; + this.txtGridServer.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtGridServer.Size = new System.Drawing.Size(542, 168); + this.txtGridServer.TabIndex = 1; + // + // gbLog + // + this.gbLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.gbLog.Controls.Add(this.tabLogs); + this.gbLog.Location = new System.Drawing.Point(2, 41); + this.gbLog.Name = "gbLog"; + this.gbLog.Size = new System.Drawing.Size(574, 255); + this.gbLog.TabIndex = 1; + this.gbLog.TabStop = false; + this.gbLog.Text = "Logs"; + // + // btnStart + // + this.btnStart.Location = new System.Drawing.Point(8, 12); + this.btnStart.Name = "btnStart"; + this.btnStart.Size = new System.Drawing.Size(75, 23); + this.btnStart.TabIndex = 2; + this.btnStart.Text = "Start"; + this.btnStart.UseVisualStyleBackColor = true; + this.btnStart.Click += new System.EventHandler(this.btnStart_Click); + // + // btnStop + // + this.btnStop.Location = new System.Drawing.Point(89, 12); + this.btnStop.Name = "btnStop"; + this.btnStop.Size = new System.Drawing.Size(75, 23); + this.btnStop.TabIndex = 3; + this.btnStop.Text = "Stop"; + this.btnStop.UseVisualStyleBackColor = true; + this.btnStop.Click += new System.EventHandler(this.btnStop_Click); + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(583, 299); + this.Controls.Add(this.btnStop); + this.Controls.Add(this.btnStart); + this.Controls.Add(this.gbLog); + this.Name = "Main"; + this.Text = "OpenSim"; + this.Load += new System.EventHandler(this.Main_Load); + this.tabLogs.ResumeLayout(false); + this.tabMainLog.ResumeLayout(false); + this.tabMainLog.PerformLayout(); + this.tabRegionServer.ResumeLayout(false); + this.tabRegionServer.PerformLayout(); + this.tabUserServer.ResumeLayout(false); + this.tabUserServer.PerformLayout(); + this.tabAssetServer.ResumeLayout(false); + this.tabAssetServer.PerformLayout(); + this.tabGridServer.ResumeLayout(false); + this.tabGridServer.PerformLayout(); + this.gbLog.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabLogs; + private System.Windows.Forms.TabPage tabRegionServer; + private System.Windows.Forms.TabPage tabUserServer; + private System.Windows.Forms.GroupBox gbLog; + private System.Windows.Forms.TextBox txtOpenSim; + private System.Windows.Forms.TextBox txtUserServer; + private System.Windows.Forms.TabPage tabAssetServer; + private System.Windows.Forms.TextBox txtAssetServer; + private System.Windows.Forms.TabPage tabGridServer; + private System.Windows.Forms.TextBox txtGridServer; + private System.Windows.Forms.TabPage tabMainLog; + private System.Windows.Forms.Button btnStart; + private System.Windows.Forms.Button btnStop; + private System.Windows.Forms.TextBox txtMainLog; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private InputTextBoxControl txtInputRegionServer; + private InputTextBoxControl txtInputUserServer; + private InputTextBoxControl txtInputAssetServer; + private InputTextBoxControl txtInputGridServer; + } +} + diff --git a/OpenSim/Tools/OpenSim.GUI/Main.cs b/OpenSim/Tools/OpenSim.GUI/Main.cs new file mode 100644 index 0000000000..b9ea20948f --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Main.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace OpenSim.GUI +{ + public partial class Main : Form + { + + public ProcessManager proc_OpenSim; + public ProcessManager proc_UserServer; + public ProcessManager proc_GridServer; + public ProcessManager proc_AssetServer; + + public Main() + { + InitializeComponent(); + } + + private void Main_Load(object sender, EventArgs e) + { + txtInputUserServer.KeyPress += new KeyPressEventHandler(txtInputUserServer_KeyPress); + txtInputGridServer.KeyPress += new KeyPressEventHandler(txtInputGridServer_KeyPress); + txtInputAssetServer.KeyPress += new KeyPressEventHandler(txtInputAssetServer_KeyPress); + txtInputRegionServer.KeyPress += new KeyPressEventHandler(txtInputRegionServer_KeyPress); + + tabLogs.Selected += new TabControlEventHandler(tabLogs_Selected); + } + + void tabLogs_Selected(object sender, TabControlEventArgs e) + { + if (e.TabPage == tabUserServer) + txtInputUserServer.Focus(); + if (e.TabPage == tabGridServer) + txtInputGridServer.Focus(); + if (e.TabPage == tabAssetServer) + txtInputAssetServer.Focus(); + if (e.TabPage == tabRegionServer) + txtInputRegionServer.Focus(); + } + + void txtInputUserServer_KeyPress(object sender, KeyPressEventArgs e) + { + + if (e.KeyChar == 13) + { + // We got a command + e.Handled = true; + proc_UserServer.StandardInput.WriteLine(txtInputUserServer.Text + "\r\n"); + txtInputUserServer.Text = ""; + } + } + + void txtInputGridServer_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == 13) + { + // We got a command + e.Handled = true; + proc_GridServer.StandardInput.WriteLine(txtInputGridServer.Text + "\r\n"); + txtInputGridServer.Text = ""; + } + } + + void txtInputAssetServer_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == 13) + { + // We got a command + e.Handled = true; + proc_AssetServer.StandardInput.WriteLine(txtInputAssetServer.Text + "\r\n"); + txtInputAssetServer.Text = ""; + } + } + + void txtInputRegionServer_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == 13) + { + // We got a command + e.Handled = true; + proc_OpenSim.StandardInput.WriteLine(txtInputRegionServer.Text + "\r\n"); + txtInputRegionServer.Text = ""; + } + } + + private void btnStart_Click(object sender, EventArgs e) + { + btnStart.Enabled = false; + btnStop.Enabled = false; + + // Start UserServer + proc_UserServer = new ProcessManager("OpenSim.Grid.UserServer.exe", ""); + txtMainLog.AppendText("Starting: UserServer"); + proc_UserServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); + proc_UserServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_UserServer_DataReceived); + proc_UserServer.StartProcess(); + System.Threading.Thread.Sleep(2000); + + // Start GridServer + proc_GridServer = new ProcessManager("OpenSim.Grid.GridServer.exe", ""); + txtMainLog.AppendText("Starting: GridServer"); + proc_GridServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); + proc_GridServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_GridServer_DataReceived); + proc_GridServer.StartProcess(); + System.Threading.Thread.Sleep(2000); + + // Start AssetServer + proc_AssetServer = new ProcessManager("OpenSim.Grid.AssetServer.exe", ""); + txtMainLog.AppendText("Starting: AssetServer"); + proc_AssetServer.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); + proc_AssetServer.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_AssetServer_DataReceived); + proc_AssetServer.StartProcess(); + System.Threading.Thread.Sleep(2000); + + // Start OpenSim + proc_OpenSim = new ProcessManager("OpenSim.EXE", "-gridmode=true"); + txtMainLog.AppendText("Starting: OpenSim"); + proc_OpenSim.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); + proc_OpenSim.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(proc_OpenSim_DataReceived); + proc_OpenSim.StartProcess(); + + btnStart.Enabled = false; + btnStop.Enabled = true; + + } + public delegate void AppendText(string Text); + void proc_UserServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + { + this.Invoke(new AppendText(txtUserServer.AppendText), new object[] { e.Data + "\r\n" }); + this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "UserServer: " + e.Data + "\r\n" }); + } + void proc_GridServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + { + this.Invoke(new AppendText(txtGridServer.AppendText), new object[] { e.Data + "\r\n" }); + this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "GridServer: " + e.Data + "\r\n" }); + } + void proc_AssetServer_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + { + this.Invoke(new AppendText(txtAssetServer.AppendText), new object[] { e.Data + "\r\n" }); + this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "AssetServer: " + e.Data + "\r\n" }); + } + void proc_OpenSim_DataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e) + { + this.Invoke(new AppendText(txtOpenSim.AppendText), new object[] { e.Data + "\r\n" }); + this.Invoke(new AppendText(txtMainLog.AppendText), new object[] { "OpenSim: " + e.Data + "\r\n" }); + } + + private void btnStop_Click(object sender, EventArgs e) + { + btnStart.Enabled = false; + btnStop.Enabled = false; + + if (proc_UserServer != null) + { + txtMainLog.AppendText("Shutting down UserServer. CPU time used: " + proc_UserServer.TotalProcessorTime); + proc_UserServer.StopProcess(); + } + if (proc_GridServer != null) + { + txtMainLog.AppendText("Shutting down GridServer. CPU time used: " + proc_GridServer.TotalProcessorTime); + proc_GridServer.StopProcess(); + } + if (proc_AssetServer != null) + { + txtMainLog.AppendText("Shutting down AssetServer. CPU time used: " + proc_AssetServer.TotalProcessorTime); + proc_AssetServer.StopProcess(); + } + if (proc_OpenSim != null) + { + txtMainLog.AppendText("Shutting down OpenSim. CPU time used: " + proc_OpenSim.TotalProcessorTime); + proc_OpenSim.StopProcess(); + } + + btnStart.Enabled = true; + btnStop.Enabled = false; + + + } + + + } +} \ No newline at end of file diff --git a/OpenSim/Tools/OpenSim.GUI/Main.resx b/OpenSim/Tools/OpenSim.GUI/Main.resx new file mode 100644 index 0000000000..ff31a6db56 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Main.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OpenSim/Tools/OpenSim.GUI/OpenSim.GUI.csproj b/OpenSim/Tools/OpenSim.GUI/OpenSim.GUI.csproj new file mode 100644 index 0000000000..5228b2bf28 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/OpenSim.GUI.csproj @@ -0,0 +1,84 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {78AEEDD5-4DA8-4E05-8D53-F3C5476A0B97} + WinExe + Properties + OpenSim.GUI + OpenSim.GUI + + + true + full + false + ..\..\..\bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + Component + + + Form + + + Main.cs + + + Component + + + + + Designer + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs new file mode 100644 index 0000000000..0ab074e8d2 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/ProcessManager.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Diagnostics; + +namespace OpenSim.GUI +{ + public class ProcessManager : Process + { + private string m_FileName; + private string m_Arguments; + public ProcessManager(string FileName,string Arguments) + { + m_FileName = FileName; + m_Arguments = Arguments; + +// MyProc = new Process(); + StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; + Console.WriteLine("WorkingDirectory: " + StartInfo.WorkingDirectory); + StartInfo.FileName = m_FileName; + + //p.StartInfo.Arguments = ""; + StartInfo.UseShellExecute = false; + StartInfo.RedirectStandardError = true; + StartInfo.RedirectStandardInput = true; + StartInfo.RedirectStandardOutput = true; + StartInfo.CreateNoWindow = true; + + + + } + + public void StartProcess() + { + try + { + Start(); + BeginOutputReadLine(); + BeginErrorReadLine(); + } + catch (Exception ex) + { + Console.WriteLine("Exception Occurred :{0},{1}", + ex.Message, ex.StackTrace.ToString()); + } + } + public void StopProcess() + { + try + { + CancelErrorRead(); + CancelErrorRead(); + if (!HasExited) + { + StandardInput.WriteLine("quit"); + StandardInput.WriteLine("shutdown"); + System.Threading.Thread.Sleep(500); + if (!HasExited) + { + Kill(); + } + } + } + catch (Exception ex) + { + Console.WriteLine("Exception Occurred :{0},{1}", + ex.Message, ex.StackTrace.ToString()); + } + } + } +} diff --git a/OpenSim/Tools/OpenSim.GUI/Program.cs b/OpenSim/Tools/OpenSim.GUI/Program.cs new file mode 100644 index 0000000000..a849b1bffd --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace OpenSim.GUI +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} \ No newline at end of file diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs b/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..3e86b1ced0 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.GUI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.GUI")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c8dbda49-66bd-476b-93b3-71774870b73e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..f7de4f0501 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.312 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OpenSim.GUI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenSim.GUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Resources.resx b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.resx new file mode 100644 index 0000000000..ffecec851a --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..e23862a275 --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.312 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OpenSim.GUI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/OpenSim/Tools/OpenSim.GUI/Properties/Settings.settings b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.settings new file mode 100644 index 0000000000..abf36c5d3d --- /dev/null +++ b/OpenSim/Tools/OpenSim.GUI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +