Load grid list in LaunchSLClient from .ini file at run-time.
Add script to build LaunchSLClient.app on OS X.0.6.0-stable
parent
20a9bf08f5
commit
c1e901989a
|
@ -36,15 +36,12 @@ using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace LaunchSLClient
|
namespace LaunchSLClient
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
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 gridUrl = "";
|
||||||
string sandboxUrl = "";
|
string sandboxUrl = "";
|
||||||
string runUrl = "";
|
string runUrl = "";
|
||||||
|
@ -53,23 +50,26 @@ namespace LaunchSLClient
|
||||||
string exePath = "";
|
string exePath = "";
|
||||||
|
|
||||||
private MachineConfig m_machineConfig;
|
private MachineConfig m_machineConfig;
|
||||||
|
private List<Grid> m_grids = new List<Grid>();
|
||||||
|
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ArrayList menuItems = new ArrayList();
|
|
||||||
|
|
||||||
m_machineConfig = getMachineConfig();
|
m_machineConfig = getMachineConfig();
|
||||||
m_machineConfig.GetClient(ref exePath, ref runLine, ref exeFlags);
|
m_machineConfig.GetClient(ref exePath, ref runLine, ref exeFlags);
|
||||||
|
|
||||||
|
initializeGrids();
|
||||||
|
|
||||||
|
ArrayList menuItems = new ArrayList();
|
||||||
menuItems.Add("Please select one:");
|
menuItems.Add("Please select one:");
|
||||||
|
|
||||||
addLocalSims(ref menuItems);
|
addLocalSims(ref menuItems);
|
||||||
|
|
||||||
menuItems.Add("OSGrid - www.osgrid.org");
|
foreach (Grid grid in m_grids)
|
||||||
menuItems.Add("DeepGrid - www.deepgrid.com");
|
{
|
||||||
menuItems.Add("OpenlifeGrid - www.openlifegrid.com");
|
menuItems.Add(grid.Name + " - " + grid.URL);
|
||||||
menuItems.Add("Linden Labs - www.secondlife.com");
|
}
|
||||||
|
|
||||||
comboBox1.DataSource = menuItems;
|
comboBox1.DataSource = menuItems;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,27 @@ namespace LaunchSLClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initializeGrids()
|
||||||
|
{
|
||||||
|
string iniFile = "LaunchSLClient.ini";
|
||||||
|
|
||||||
|
if (!File.Exists(iniFile))
|
||||||
|
return;
|
||||||
|
|
||||||
|
IniConfigSource configSource = new IniConfigSource(iniFile);
|
||||||
|
|
||||||
|
foreach (IConfig config in configSource.Configs)
|
||||||
|
{
|
||||||
|
Grid grid = new Grid();
|
||||||
|
|
||||||
|
grid.Name = config.Name;
|
||||||
|
grid.LoginURI = config.GetString("loginURI", "");
|
||||||
|
grid.URL = config.GetString("URL", "");
|
||||||
|
|
||||||
|
m_grids.Add(grid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addLocalSandbox(ref ArrayList menuItems)
|
private void addLocalSandbox(ref ArrayList menuItems)
|
||||||
{
|
{
|
||||||
// build sandbox URL from Regions/default.xml
|
// build sandbox URL from Regions/default.xml
|
||||||
|
@ -134,7 +155,6 @@ namespace LaunchSLClient
|
||||||
private void addLocalGrid(ref ArrayList menuItems)
|
private void addLocalGrid(ref ArrayList menuItems)
|
||||||
{
|
{
|
||||||
//build local grid URL from network_servers_information.xml
|
//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"))
|
if (File.Exists("network_servers_information.xml"))
|
||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
|
@ -180,13 +200,33 @@ namespace LaunchSLClient
|
||||||
|
|
||||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (comboBox1.Text == "Please select one:") { return; }
|
if (comboBox1.Text == "Please select one:")
|
||||||
if (comboBox1.Text == "Local Sandbox") { runUrl=" -loginuri " + sandboxUrl;}
|
{
|
||||||
if (comboBox1.Text == "Local Grid Server") { runUrl = " -loginuri " + gridUrl; }
|
return;
|
||||||
if (comboBox1.Text == "DeepGrid - www.deepgrid.com") { runUrl = " -loginuri " + deepGridUrl; }
|
}
|
||||||
if (comboBox1.Text == "OSGrid - www.osgrid.org") { runUrl = " -loginuri " + osGridUrl; }
|
else if (comboBox1.Text == "Local Sandbox")
|
||||||
if (comboBox1.Text == "OpenlifeGrid - www.openlifegrid.com") { runUrl = " -loginuri " + openLifeGridUrl; }
|
{
|
||||||
if (comboBox1.Text == "Linden Labs - www.secondlife.com") { runUrl = ""; }
|
runUrl=" -loginuri " + sandboxUrl;
|
||||||
|
}
|
||||||
|
else if (comboBox1.Text == "Local Grid Server")
|
||||||
|
{
|
||||||
|
runUrl = " -loginuri " + gridUrl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (Grid grid in m_grids)
|
||||||
|
{
|
||||||
|
if (comboBox1.Text == grid.Name + " - " + grid.URL)
|
||||||
|
{
|
||||||
|
if (grid.LoginURI != string.Empty)
|
||||||
|
runUrl = " -loginuri " + grid.LoginURI;
|
||||||
|
else
|
||||||
|
runUrl = "";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
System.Diagnostics.Process proc = new System.Diagnostics.Process();
|
System.Diagnostics.Process proc = new System.Diagnostics.Process();
|
||||||
proc.StartInfo.FileName = runLine;
|
proc.StartInfo.FileName = runLine;
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LaunchSLClient
|
||||||
|
{
|
||||||
|
public struct Grid
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public string LoginURI;
|
||||||
|
public string URL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ namespace LaunchSLClient
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message,"Unhandled Error");
|
MessageBox.Show(ex.ToString(), "Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script will build LaunchSLClient.app from the .exe, .dll's, and
|
||||||
|
# other necessary files.
|
||||||
|
#
|
||||||
|
# This should be run from the bin directory.
|
||||||
|
|
||||||
|
APP_NAME="LaunchSLClient"
|
||||||
|
|
||||||
|
# Note that proper form is to copy Frameworks to
|
||||||
|
# *.app/Contents/Frameworks, but because @executable_path resolves to
|
||||||
|
# [...]/Resources/bin, and the libraries reference
|
||||||
|
# @executable_path/../Frameworks, we put frameworks in
|
||||||
|
# Contents/Resources instead.
|
||||||
|
FRAMEWORKS_PATH="${APP_NAME}.app/Contents/Resources/Frameworks"
|
||||||
|
|
||||||
|
if [ ! -e ${APP_NAME}.exe ]; then
|
||||||
|
echo "Error: Could not find ${APP_NAME}.exe." >& 2
|
||||||
|
echo "Have you built it, and are you currently in the bin directory?" >& 2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CMDFLAGS="-m console -n ${APP_NAME} -a ${APP_NAME}.exe"
|
||||||
|
|
||||||
|
REFERENCES="-r /Library/Frameworks/Mono.framework/Versions/Current/lib/ \
|
||||||
|
-r Nini.dll \
|
||||||
|
-r ${APP_NAME}.ini"
|
||||||
|
|
||||||
|
if [ -f ${APP_NAME}.icns ]; then
|
||||||
|
CMDFLAGS="${CMDFLAGS} -i ${APP_NAME}.icns"
|
||||||
|
else
|
||||||
|
echo "Warning: no icon file found. Will use default application icon." >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d ${APP_NAME}.app ]; then rm -rf ${APP_NAME}.app; fi
|
||||||
|
macpack ${REFERENCES} ${CMDFLAGS}
|
||||||
|
|
||||||
|
mkdir -p ${FRAMEWORKS_PATH}
|
|
@ -57,6 +57,7 @@
|
||||||
<Reference name="System.Text.RegularExpressions" localCopy="false"/>
|
<Reference name="System.Text.RegularExpressions" localCopy="false"/>
|
||||||
<Reference name="System.Windows.Forms" localCopy="false"/>
|
<Reference name="System.Windows.Forms" localCopy="false"/>
|
||||||
<Reference name="Microsoft.Win32" localCopy="false"/>
|
<Reference name="Microsoft.Win32" localCopy="false"/>
|
||||||
|
<Reference name="Nini.dll"/>
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
[DeepGrid]
|
||||||
|
loginURI = http://user.deepgrid.com:8002/
|
||||||
|
URL = www.deepgrid.com
|
||||||
|
|
||||||
|
[OSGrid]
|
||||||
|
loginURI = http://www.osgrid.org:8002/
|
||||||
|
URL = www.osgrid.org
|
||||||
|
|
||||||
|
[OpenlifeGrid]
|
||||||
|
loginURI = http://logingrid.net:8002/
|
||||||
|
URL = www.openlifegrid.com
|
||||||
|
|
||||||
|
[Linden Lab]
|
||||||
|
loginURI =
|
||||||
|
URL = www.secondlife.com
|
Loading…
Reference in New Issue