From b5a9592cc1214b9bee1a69c20cd9ebe5983a396c Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Fri, 15 Feb 2008 02:37:05 +0000
Subject: Moved LaunchSLClient build system to Prebuild. Refactored
 LaunchSLClient code a bit.

---
 .../LaunchSLClient/Form1.Designer.cs               |   4 -
 .../Tools/LaunchSLClient/LaunchSLClient/Form1.cs   | 215 +++++++++++----------
 .../LaunchSLClient/LaunchSLClient.csproj           |  79 --------
 .../LaunchSLClient/LauncherException.cs            |   2 +-
 .../Tools/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, 185 insertions(+), 190 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

(limited to 'OpenSim/Tools')

diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.Designer.cs
index 40dee17..db9ad33 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 70f8b87..183a104 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,143 +43,149 @@ 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;
-
-
-            // get executable path from registry
-            //
-            RegistryKey regKey;
-            RegistryKey exeKey;
-            regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife");
-            if (regKey == null)
-            {
-                regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Linden Research, Inc.\SecondLife");
-                if (regKey == null)
-                {
-                    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();
-            Registry.LocalMachine.Flush();
-            Registry.LocalMachine.Close();
-
-            // find opensim directory
-            //
-            exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim");
-            if (exeKey != null)
+            // build sandbox URL from Regions\default.xml
+            // this is highly dependant on a standard default.xml
+            if (File.Exists(@"Regions\default.xml"))
             {
-
-                simPath = exeKey.GetValue("Path");
-
-                // 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 sandboxHostName = "";
+                string sandboxPort = "";
                 string text;
+                
                 Regex myRegex = new Regex(".*internal_ip_port=\\\"(?<port>.*?)\\\".*external_host_name=\\\"(?<name>.*?)\\\".*");
-                if (File.Exists(@"Regions\default.xml"))
+
+                FileInfo defaultFile = new FileInfo(@"Regions\default.xml");
+                StreamReader stream = defaultFile.OpenText();
+                do
                 {
-                    defaultFile = new FileInfo(@"Regions\default.xml");
-                    stream = defaultFile.OpenText();
-                    do
+                    text = stream.ReadLine();
+                    if (text == null)
                     {
-                        text = stream.ReadLine();
-                        if (text == null)
-                        {
-                            break;
-                        }
-                        MatchCollection theMatches = myRegex.Matches(text);
-                        foreach (Match theMatch in theMatches)
+                        break;
+                    }
+                    MatchCollection theMatches = myRegex.Matches(text);
+                    foreach (Match theMatch in theMatches)
+                    {
+                        if (theMatch.Length != 0)
                         {
-                            if (theMatch.Length != 0)
-                            {
-                                sandboxHostName = theMatch.Groups["name"].ToString();
-                                sandboxPort = theMatch.Groups["port"].ToString();
-                            }
+                            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");
-                }
-
+                    }
+                } while (text != null);
 
-                //build local grid URL from network_servers_information.xml
-                // this is highly dependant on a standard default.xml
-                //
-                myRegex = new Regex(".*UserServerURL=\\\"(?<url>.*?)\\\".*");
-                if (File.Exists(@"network_servers_information.xml"))
-                {
-                    defaultFile = new FileInfo(@"network_servers_information.xml");
+                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=\\\"(?<url>.*?)\\\".*");
+                StreamReader stream = defaultFile.OpenText();
 
-                    stream = defaultFile.OpenText();
-                    do
+                do
+                {
+                    text = stream.ReadLine();
+                    if (text == null)
                     {
-                        text = stream.ReadLine();
-                        if (text == null)
-                        {
-                            break;
-                        }
-                        MatchCollection theMatches = myRegex.Matches(text);
-                        foreach (Match theMatch in theMatches)
+                        break;
+                    }
+                    foreach (Match theMatch in myRegex.Matches(text))
+                    {
+                        if (theMatch.Length != 0)
                         {
-                            if (theMatch.Length != 0)
-                            {
-                                gridUrl = theMatch.Groups["url"].ToString();
-                            }
+                            gridUrl = theMatch.Groups["url"].ToString();
                         }
-                    } while (text != null);
-                    stream.Close();
-                    if (gridUrl != null)
-                    {
-                        menuItems.Add("Local Grid Server");
                     }
+                } 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 = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife");
+            if (regKey == null)
+            {
+                regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Linden Research, Inc.\SecondLife");
+                if (regKey == null)
+                {
+                    throw new LauncherException("Can't find Second Life. Are you sure it is installed?", "LauncherException.Form1");
+                }
+            }
+            string exe = regKey.GetValue("Exe").ToString();
+            exeFlags = regKey.GetValue("Flags").ToString();
+            exePath = regKey.GetValue("").ToString();
+            runLine = exePath + "\\" + exe;
+            Registry.LocalMachine.Flush();
+            Registry.LocalMachine.Close();
+        }
+
+        public Form1()
+        {
+            InitializeComponent();
+            ArrayList menuItems = new ArrayList();
+
+            getClient(ref exePath, ref runLine, ref exeFlags);
+
+            menuItems.Add("Please select one:");
+
+            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 2589ec7..0000000
--- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LaunchSLClient.csproj
+++ /dev/null
@@ -1,79 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{50FD2DCD-2E2D-413C-8260-D9CD22405895}</ProjectGuid>
-    <OutputType>WinExe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>LaunchSLClient</RootNamespace>
-    <AssemblyName>LaunchSLClient</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Deployment" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Form1.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="Form1.Designer.cs">
-      <DependentUpon>Form1.cs</DependentUpon>
-    </Compile>
-    <Compile Include="LauncherException.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <EmbeddedResource Include="Form1.resx">
-      <SubType>Designer</SubType>
-      <DependentUpon>Form1.cs</DependentUpon>
-    </EmbeddedResource>
-    <EmbeddedResource Include="Properties\Resources.resx">
-      <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
-      <SubType>Designer</SubType>
-    </EmbeddedResource>
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Resources.resx</DependentUpon>
-    </Compile>
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-    <Compile Include="Properties\Settings.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file
diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LauncherException.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/LauncherException.cs
index acfa421..e31bd1d 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 0e77abe..778d5c0 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 0000000..8e58ba6
--- /dev/null
+++ b/OpenSim/Tools/LaunchSLClient/prebuild.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Prebuild xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.7.xsd" version="1.7">
+  <Solution name="LaunchSLClient" activeConfig="Debug" path="./" version="0.5.0-svn">
+    <Configuration name="Debug">
+      <Options>
+        <CompilerDefines>TRACE;DEBUG</CompilerDefines>
+        <OptimizeCode>false</OptimizeCode>
+        <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
+        <AllowUnsafe>false</AllowUnsafe>
+        <WarningLevel>4</WarningLevel>
+        <WarningsAsErrors>false</WarningsAsErrors>
+        <SuppressWarnings></SuppressWarnings>
+        <OutputPath>../../../bin</OutputPath>
+        <DebugInformation>true</DebugInformation>
+        <IncrementalBuild>true</IncrementalBuild>
+        <NoStdLib>false</NoStdLib>
+      </Options>
+    </Configuration>
+    <Configuration name="Release">
+      <Options>
+        <CompilerDefines>TRACE</CompilerDefines>
+        <OptimizeCode>true</OptimizeCode>
+        <CheckUnderflowOverflow>false</CheckUnderflowOverflow>
+        <AllowUnsafe>false</AllowUnsafe>
+        <WarningLevel>4</WarningLevel>
+        <WarningsAsErrors>false</WarningsAsErrors>
+        <SuppressWarnings></SuppressWarnings>
+        <OutputPath>../../../bin</OutputPath>
+        <DebugInformation>false</DebugInformation>
+        <IncrementalBuild>true</IncrementalBuild>
+        <NoStdLib>false</NoStdLib>
+      </Options>
+    </Configuration>
+
+    <Project name="LaunchSLClient" path="LaunchSLClient" type="Exe">
+      <Configuration name="Debug">
+        <Options>
+          <OutputPath>../../../bin/</OutputPath>
+        </Options>
+      </Configuration>
+      <Configuration name="Release">
+        <Options>
+          <OutputPath>../../../bin/</OutputPath>
+        </Options>
+      </Configuration>
+
+      <ReferencePath>../../../bin/</ReferencePath>
+      <Reference name="System" localCopy="false"/>
+      <Reference name="System.IO" localCopy="false"/>
+      <Reference name="System.Collections" localCopy="false"/>
+      <Reference name="System.Collections.Generic" localCopy="false"/>
+      <Reference name="System.ComponentModel" localCopy="false"/>
+      <Reference name="System.Data" localCopy="false"/>
+      <Reference name="System.Diagnostics" localCopy="false"/>
+      <Reference name="System.Drawing" localCopy="false"/>
+      <Reference name="System.Text" localCopy="false"/>
+      <Reference name="System.Text.RegularExpressions" localCopy="false"/>
+      <Reference name="System.Windows.Forms" localCopy="false"/>
+      <Reference name="Microsoft.Win32" localCopy="false"/>
+
+      <Files>
+        <Match pattern="*.cs" recurse="true"/>
+      </Files>
+    </Project>
+  </Solution>
+</Prebuild>
diff --git a/OpenSim/Tools/LaunchSLClient/runprebuild.bat b/OpenSim/Tools/LaunchSLClient/runprebuild.bat
new file mode 100755
index 0000000..8a2c21a
--- /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 0000000..7215bc5
--- /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
-- 
cgit v1.1