From c1e901989ae16f782801aeb12ec12712a2fdd85a Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 May 2008 18:28:32 +0000 Subject: Load grid list in LaunchSLClient from .ini file at run-time. Add script to build LaunchSLClient.app on OS X. --- .../Tools/LaunchSLClient/LaunchSLClient/Form1.cs | 74 +++++++++++++++++----- .../Tools/LaunchSLClient/LaunchSLClient/Grid.cs | 38 +++++++++++ .../Tools/LaunchSLClient/LaunchSLClient/Program.cs | 2 +- OpenSim/Tools/LaunchSLClient/make-OSX-app.sh | 38 +++++++++++ OpenSim/Tools/LaunchSLClient/prebuild.xml | 1 + bin/LaunchSLClient.ini | 15 +++++ 6 files changed, 150 insertions(+), 18 deletions(-) create mode 100644 OpenSim/Tools/LaunchSLClient/LaunchSLClient/Grid.cs create mode 100755 OpenSim/Tools/LaunchSLClient/make-OSX-app.sh create mode 100644 bin/LaunchSLClient.ini diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs index a0eca6e..a827c76 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs @@ -36,15 +36,12 @@ using System.Drawing; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; +using Nini.Config; 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 runUrl = ""; @@ -53,23 +50,26 @@ namespace LaunchSLClient string exePath = ""; private MachineConfig m_machineConfig; + private List m_grids = new List(); public Form1() { InitializeComponent(); - ArrayList menuItems = new ArrayList(); m_machineConfig = getMachineConfig(); m_machineConfig.GetClient(ref exePath, ref runLine, ref exeFlags); + initializeGrids(); + + ArrayList menuItems = new ArrayList(); 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"); - menuItems.Add("Linden Labs - www.secondlife.com"); + foreach (Grid grid in m_grids) + { + menuItems.Add(grid.Name + " - " + grid.URL); + } 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) { // build sandbox URL from Regions/default.xml @@ -134,7 +155,6 @@ namespace LaunchSLClient 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; @@ -180,13 +200,33 @@ namespace LaunchSLClient private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { - if (comboBox1.Text == "Please select one:") { return; } - if (comboBox1.Text == "Local Sandbox") { runUrl=" -loginuri " + sandboxUrl;} - 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 == "Please select one:") + { + return; + } + else if (comboBox1.Text == "Local Sandbox") + { + 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(); proc.StartInfo.FileName = runLine; diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Grid.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Grid.cs new file mode 100644 index 0000000..89fcefe --- /dev/null +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Grid.cs @@ -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; + } +} diff --git a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs index 1d715a5..53ea9f8 100644 --- a/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs +++ b/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Program.cs @@ -44,7 +44,7 @@ namespace LaunchSLClient } catch (Exception ex) { - MessageBox.Show(ex.Message,"Unhandled Error"); + MessageBox.Show(ex.ToString(), "Error"); } } } diff --git a/OpenSim/Tools/LaunchSLClient/make-OSX-app.sh b/OpenSim/Tools/LaunchSLClient/make-OSX-app.sh new file mode 100755 index 0000000..9b9177e --- /dev/null +++ b/OpenSim/Tools/LaunchSLClient/make-OSX-app.sh @@ -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} diff --git a/OpenSim/Tools/LaunchSLClient/prebuild.xml b/OpenSim/Tools/LaunchSLClient/prebuild.xml index c51d59a..4a13365 100644 --- a/OpenSim/Tools/LaunchSLClient/prebuild.xml +++ b/OpenSim/Tools/LaunchSLClient/prebuild.xml @@ -57,6 +57,7 @@ + diff --git a/bin/LaunchSLClient.ini b/bin/LaunchSLClient.ini new file mode 100644 index 0000000..9250a7b --- /dev/null +++ b/bin/LaunchSLClient.ini @@ -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 -- cgit v1.1