Moved LaunchSLClient build system to Prebuild.

Refactored LaunchSLClient code a bit.
ThreadPoolClientBranch
Jeff Ames 2008-02-15 02:37:05 +00:00
parent b13836db57
commit b5a9592cc1
8 changed files with 188 additions and 193 deletions

View File

@ -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;
}
}

View File

@ -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=\\\"(?<port>.*?)\\\".*external_host_name=\\\"(?<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=\\\"(?<url>.*?)\\\".*");
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=\\\"(?<port>.*?)\\\".*external_host_name=\\\"(?<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=\\\"(?<url>.*?)\\\".*");
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;

View File

@ -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>

View File

@ -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() { }

View File

@ -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();

View File

@ -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>

View File

@ -0,0 +1,2 @@
bin\Prebuild.exe /target nant
bin\Prebuild.exe /target vs2005

View File

@ -0,0 +1,4 @@
#!/bin/sh
mono ../../../bin/Prebuild.exe /target nant
mono ../../../bin/Prebuild.exe /target vs2005