From b5a9592cc1214b9bee1a69c20cd9ebe5983a396c Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Fri, 15 Feb 2008 02:37:05 +0000 Subject: [PATCH] Moved LaunchSLClient build system to Prebuild. Refactored LaunchSLClient code a bit. --- .../LaunchSLClient/Form1.Designer.cs | 4 - .../LaunchSLClient/LaunchSLClient/Form1.cs | 221 +++++++++--------- .../LaunchSLClient/LaunchSLClient.csproj | 79 ------- .../LaunchSLClient/LauncherException.cs | 2 +- .../LaunchSLClient/LaunchSLClient/Program.cs | 3 +- OpenSim/Tools/LaunchSLClient/prebuild.xml | 66 ++++++ OpenSim/Tools/LaunchSLClient/runprebuild.bat | 2 + OpenSim/Tools/LaunchSLClient/runprebuild.sh | 4 + 8 files changed, 188 insertions(+), 193 deletions(-) delete mode 100644 OpenSim/Tools/LaunchSLClient/LaunchSLClient/LaunchSLClient.csproj create mode 100644 OpenSim/Tools/LaunchSLClient/prebuild.xml create mode 100755 OpenSim/Tools/LaunchSLClient/runprebuild.bat create mode 100755 OpenSim/Tools/LaunchSLClient/runprebuild.sh diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs index 40dee179d0..db9ad33843 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs @@ -98,15 +98,11 @@ namespace LaunchSLClient this.Text = "OpenSim Client Launcher"; this.ResumeLayout(false); this.PerformLayout(); - } #endregion private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.TextBox textBox1; - } } - - diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs index 70f8b879e2..183a104b23 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.IO; using System.Collections; @@ -42,33 +43,112 @@ namespace LaunchSLClient { public partial class Form1 : Form { + const string deepGridUrl = "http://user.deepgrid.com:8002/"; + const string osGridUrl = "http://www.osgrid.org:8002/"; + const string openLifeGridUrl = "http://logingrid.net:8002"; + string gridUrl = ""; string sandboxUrl = ""; - string deepGridUrl = "http://user.deepgrid.com:8002/"; - string osGridUrl = "http://www.osgrid.org:8002/"; string runUrl = ""; string runLine = ""; - Object exeFlags; - Object exePath; + string exeFlags = ""; + string exePath = ""; - - public Form1() + private void addLocalSandbox(ref ArrayList menuItems) { - InitializeComponent(); - ArrayList menuItems=new ArrayList(); - menuItems.Add("Please select one:"); - string sandboxHostName = ""; - string sandboxPort = ""; - Object simPath = null; - FileInfo defaultFile; - StreamReader stream; + // build sandbox URL from Regions\default.xml + // this is highly dependant on a standard default.xml + if (File.Exists(@"Regions\default.xml")) + { + string sandboxHostName = ""; + string sandboxPort = ""; + string text; + + Regex myRegex = new Regex(".*internal_ip_port=\\\"(?.*?)\\\".*external_host_name=\\\"(?.*?)\\\".*"); + FileInfo defaultFile = new FileInfo(@"Regions\default.xml"); + StreamReader stream = defaultFile.OpenText(); + do + { + text = stream.ReadLine(); + if (text == null) + { + break; + } + MatchCollection theMatches = myRegex.Matches(text); + foreach (Match theMatch in theMatches) + { + if (theMatch.Length != 0) + { + sandboxHostName = theMatch.Groups["name"].ToString(); + sandboxPort = theMatch.Groups["port"].ToString(); + } + } + } while (text != null); + stream.Close(); + sandboxUrl = "http:\\" + sandboxHostName + ":" + sandboxPort; + menuItems.Add("Local Sandbox"); + } + } + + private void addLocalGrid(ref ArrayList menuItems) + { + //build local grid URL from network_servers_information.xml + // this is highly dependant on a standard default.xml + if (File.Exists(@"network_servers_information.xml")) + { + string text; + FileInfo defaultFile = new FileInfo(@"network_servers_information.xml"); + Regex myRegex = new Regex(".*UserServerURL=\\\"(?.*?)\\\".*"); + StreamReader stream = defaultFile.OpenText(); + + do + { + text = stream.ReadLine(); + if (text == null) + { + break; + } + foreach (Match theMatch in myRegex.Matches(text)) + { + if (theMatch.Length != 0) + { + gridUrl = theMatch.Groups["url"].ToString(); + } + } + } while (text != null); + stream.Close(); + if (gridUrl != null) + { + menuItems.Add("Local Grid Server"); + } + } + } + + private void addLocalSims(ref ArrayList menuItems) + { + // find opensim directory + RegistryKey exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim"); + if (exeKey != null) + { + Object simPath = exeKey.GetValue("Path"); + + Directory.SetCurrentDirectory(simPath.ToString()); //this should be set to wherever we decide to put the binaries + + addLocalSandbox(ref menuItems); + addLocalGrid(ref menuItems); + } + else + { + MessageBox.Show("No OpenSim installed. Showing public grids only", "No OpenSim"); + } + } + + private void getClient(ref string exePath, ref string runLine, ref string exeFlags) + { // get executable path from registry - // - RegistryKey regKey; - RegistryKey exeKey; - regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife"); + RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife"); if (regKey == null) { regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Linden Research, Inc.\SecondLife"); @@ -77,108 +157,35 @@ namespace LaunchSLClient throw new LauncherException("Can't find Second Life. Are you sure it is installed?", "LauncherException.Form1"); } } - Object exe = regKey.GetValue("Exe"); - exeFlags = regKey.GetValue("Flags"); - exePath = regKey.GetValue(""); - runLine = exePath.ToString() + "\\" + exe.ToString(); + string exe = regKey.GetValue("Exe").ToString(); + exeFlags = regKey.GetValue("Flags").ToString(); + exePath = regKey.GetValue("").ToString(); + runLine = exePath + "\\" + exe; Registry.LocalMachine.Flush(); Registry.LocalMachine.Close(); + } - // find opensim directory - // - exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim"); - if (exeKey != null) - { + public Form1() + { + InitializeComponent(); + ArrayList menuItems = new ArrayList(); - simPath = exeKey.GetValue("Path"); + getClient(ref exePath, ref runLine, ref exeFlags); - // build sandbox URL from Regions\default.xml - // this is highly dependant on a standard default.xml - // - Directory.SetCurrentDirectory(simPath.ToString()); //this should be set to wherever we decide to put the binaries - string text; - Regex myRegex = new Regex(".*internal_ip_port=\\\"(?.*?)\\\".*external_host_name=\\\"(?.*?)\\\".*"); - if (File.Exists(@"Regions\default.xml")) - { - defaultFile = new FileInfo(@"Regions\default.xml"); - stream = defaultFile.OpenText(); - do - { - text = stream.ReadLine(); - if (text == null) - { - break; - } - MatchCollection theMatches = myRegex.Matches(text); - foreach (Match theMatch in theMatches) - { - if (theMatch.Length != 0) - { - sandboxHostName = theMatch.Groups["name"].ToString(); - sandboxPort = theMatch.Groups["port"].ToString(); - } - } - } while (text != null); - stream.Close(); - sandboxUrl = "http:\\" + sandboxHostName + ":" + sandboxPort; - menuItems.Add("Local Sandbox"); - } - else - { - MessageBox.Show("No OpenSim config files found. Please run OpenSim and finish configuration to run a local sim. Showing public grids only", "No OpenSim"); - } + menuItems.Add("Please select one:"); - - //build local grid URL from network_servers_information.xml - // this is highly dependant on a standard default.xml - // - myRegex = new Regex(".*UserServerURL=\\\"(?.*?)\\\".*"); - if (File.Exists(@"network_servers_information.xml")) - { - defaultFile = new FileInfo(@"network_servers_information.xml"); - - - stream = defaultFile.OpenText(); - do - { - text = stream.ReadLine(); - if (text == null) - { - break; - } - MatchCollection theMatches = myRegex.Matches(text); - foreach (Match theMatch in theMatches) - { - if (theMatch.Length != 0) - { - gridUrl = theMatch.Groups["url"].ToString(); - } - } - } while (text != null); - stream.Close(); - if (gridUrl != null) - { - menuItems.Add("Local Grid Server"); - } - } - } - else - { - MessageBox.Show("No OpenSim installed. Showing public grids only", "No OpenSim"); - } + addLocalSims(ref menuItems); menuItems.Add("OSGrid - www.osgrid.org"); menuItems.Add("DeepGrid - www.deepgrid.com"); menuItems.Add("OpenlifeGrid - www.openlifegrid.com"); - - // We don't have a proper login uri for SL grid - // menuItems.Add("Linden Labs - www.secondlife.com"); - comboBox1.DataSource=menuItems; + menuItems.Add("Linden Labs - www.secondlife.com"); + + comboBox1.DataSource = menuItems; } private void radioButton1_CheckedChanged(object sender, EventArgs e) { - } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) @@ -188,8 +195,8 @@ namespace LaunchSLClient if (comboBox1.Text == "Local Grid Server") { runUrl = " -loginuri " + gridUrl; } if (comboBox1.Text == "DeepGrid - www.deepgrid.com") { runUrl = " -loginuri " + deepGridUrl; } if (comboBox1.Text == "OSGrid - www.osgrid.org") { runUrl = " -loginuri " + osGridUrl; } + if (comboBox1.Text == "OpenlifeGrid - www.openlifegrid.com") { runUrl = " -loginuri " + openLifeGridUrl; } if (comboBox1.Text == "Linden Labs - www.secondlife.com") { runUrl = ""; } - if (comboBox1.Text == "OpenlifeGrid - www.openlifegrid.com") { runUrl = " -loginuri http://logingrid.net:8002"; } System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = runLine; diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LaunchSLClient.csproj b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LaunchSLClient.csproj deleted file mode 100644 index 2589ec7b73..0000000000 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LaunchSLClient.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {50FD2DCD-2E2D-413C-8260-D9CD22405895} - WinExe - Properties - LaunchSLClient - LaunchSLClient - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - Form - - - Form1.cs - - - - - - Designer - Form1.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/LaunchSLClient/LaunchSLClient/LauncherException.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LauncherException.cs index acfa421d5a..e31bd1de87 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LauncherException.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LauncherException.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using System.Text; @@ -33,7 +34,6 @@ namespace LaunchSLClient { class LauncherException : ApplicationException { - private const string CUSTOMMESSAGE = "The SL Client Launcher has failed with the following error: "; private LauncherException() { } diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs index 0e77abe57a..778d5c0606 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs @@ -25,11 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + using System; using System.Collections.Generic; using System.Windows.Forms; - namespace LaunchSLClient { static class Program @@ -40,7 +40,6 @@ namespace LaunchSLClient [STAThread] static void Main() { - try { Application.EnableVisualStyles(); diff --git a/OpenSim/Tools/LaunchSLClient/prebuild.xml b/OpenSim/Tools/LaunchSLClient/prebuild.xml new file mode 100644 index 0000000000..8e58ba6e0b --- /dev/null +++ b/OpenSim/Tools/LaunchSLClient/prebuild.xml @@ -0,0 +1,66 @@ + + + + + + TRACE;DEBUG + false + false + false + 4 + false + + ../../../bin + true + true + false + + + + + TRACE + true + false + false + 4 + false + + ../../../bin + false + true + false + + + + + + + ../../../bin/ + + + + + ../../../bin/ + + + + ../../../bin/ + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Tools/LaunchSLClient/runprebuild.bat b/OpenSim/Tools/LaunchSLClient/runprebuild.bat new file mode 100755 index 0000000000..8a2c21a43c --- /dev/null +++ b/OpenSim/Tools/LaunchSLClient/runprebuild.bat @@ -0,0 +1,2 @@ +bin\Prebuild.exe /target nant +bin\Prebuild.exe /target vs2005 \ No newline at end of file diff --git a/OpenSim/Tools/LaunchSLClient/runprebuild.sh b/OpenSim/Tools/LaunchSLClient/runprebuild.sh new file mode 100755 index 0000000000..7215bc5b53 --- /dev/null +++ b/OpenSim/Tools/LaunchSLClient/runprebuild.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +mono ../../../bin/Prebuild.exe /target nant +mono ../../../bin/Prebuild.exe /target vs2005