aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs')
-rw-r--r--OpenSim/Tools/LaunchSLClient/LaunchSLClient/Form1.cs215
1 files changed, 111 insertions, 104 deletions
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 @@
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28
28using System; 29using System;
29using System.IO; 30using System.IO;
30using System.Collections; 31using System.Collections;
@@ -42,143 +43,149 @@ namespace LaunchSLClient
42{ 43{
43 public partial class Form1 : Form 44 public partial class Form1 : Form
44 { 45 {
46 const string deepGridUrl = "http://user.deepgrid.com:8002/";
47 const string osGridUrl = "http://www.osgrid.org:8002/";
48 const string openLifeGridUrl = "http://logingrid.net:8002";
49
45 string gridUrl = ""; 50 string gridUrl = "";
46 string sandboxUrl = ""; 51 string sandboxUrl = "";
47 string deepGridUrl = "http://user.deepgrid.com:8002/";
48 string osGridUrl = "http://www.osgrid.org:8002/";
49 string runUrl = ""; 52 string runUrl = "";
50 string runLine = ""; 53 string runLine = "";
51 Object exeFlags; 54 string exeFlags = "";
52 Object exePath; 55 string exePath = "";
53
54 56
55 public Form1() 57 private void addLocalSandbox(ref ArrayList menuItems)
56 { 58 {
57 InitializeComponent(); 59 // build sandbox URL from Regions\default.xml
58 ArrayList menuItems=new ArrayList(); 60 // this is highly dependant on a standard default.xml
59 menuItems.Add("Please select one:"); 61 if (File.Exists(@"Regions\default.xml"))
60 string sandboxHostName = "";
61 string sandboxPort = "";
62 Object simPath = null;
63 FileInfo defaultFile;
64 StreamReader stream;
65
66
67 // get executable path from registry
68 //
69 RegistryKey regKey;
70 RegistryKey exeKey;
71 regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife");
72 if (regKey == null)
73 {
74 regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Linden Research, Inc.\SecondLife");
75 if (regKey == null)
76 {
77 throw new LauncherException("Can't find Second Life. Are you sure it is installed?", "LauncherException.Form1");
78 }
79 }
80 Object exe = regKey.GetValue("Exe");
81 exeFlags = regKey.GetValue("Flags");
82 exePath = regKey.GetValue("");
83 runLine = exePath.ToString() + "\\" + exe.ToString();
84 Registry.LocalMachine.Flush();
85 Registry.LocalMachine.Close();
86
87 // find opensim directory
88 //
89 exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim");
90 if (exeKey != null)
91 { 62 {
92 63 string sandboxHostName = "";
93 simPath = exeKey.GetValue("Path"); 64 string sandboxPort = "";
94
95 // build sandbox URL from Regions\default.xml
96 // this is highly dependant on a standard default.xml
97 //
98 Directory.SetCurrentDirectory(simPath.ToString()); //this should be set to wherever we decide to put the binaries
99 string text; 65 string text;
66
100 Regex myRegex = new Regex(".*internal_ip_port=\\\"(?<port>.*?)\\\".*external_host_name=\\\"(?<name>.*?)\\\".*"); 67 Regex myRegex = new Regex(".*internal_ip_port=\\\"(?<port>.*?)\\\".*external_host_name=\\\"(?<name>.*?)\\\".*");
101 if (File.Exists(@"Regions\default.xml")) 68
69 FileInfo defaultFile = new FileInfo(@"Regions\default.xml");
70 StreamReader stream = defaultFile.OpenText();
71 do
102 { 72 {
103 defaultFile = new FileInfo(@"Regions\default.xml"); 73 text = stream.ReadLine();
104 stream = defaultFile.OpenText(); 74 if (text == null)
105 do
106 { 75 {
107 text = stream.ReadLine(); 76 break;
108 if (text == null) 77 }
109 { 78 MatchCollection theMatches = myRegex.Matches(text);
110 break; 79 foreach (Match theMatch in theMatches)
111 } 80 {
112 MatchCollection theMatches = myRegex.Matches(text); 81 if (theMatch.Length != 0)
113 foreach (Match theMatch in theMatches)
114 { 82 {
115 if (theMatch.Length != 0) 83 sandboxHostName = theMatch.Groups["name"].ToString();
116 { 84 sandboxPort = theMatch.Groups["port"].ToString();
117 sandboxHostName = theMatch.Groups["name"].ToString();
118 sandboxPort = theMatch.Groups["port"].ToString();
119 }
120 } 85 }
121 } while (text != null); 86 }
122 stream.Close(); 87 } while (text != null);
123 sandboxUrl = "http:\\" + sandboxHostName + ":" + sandboxPort;
124 menuItems.Add("Local Sandbox");
125 }
126 else
127 {
128 MessageBox.Show("No OpenSim config files found. Please run OpenSim and finish configuration to run a local sim. Showing public grids only", "No OpenSim");
129 }
130
131 88
132 //build local grid URL from network_servers_information.xml 89 stream.Close();
133 // this is highly dependant on a standard default.xml 90 sandboxUrl = "http:\\" + sandboxHostName + ":" + sandboxPort;
134 // 91 menuItems.Add("Local Sandbox");
135 myRegex = new Regex(".*UserServerURL=\\\"(?<url>.*?)\\\".*"); 92 }
136 if (File.Exists(@"network_servers_information.xml")) 93 }
137 {
138 defaultFile = new FileInfo(@"network_servers_information.xml");
139 94
95 private void addLocalGrid(ref ArrayList menuItems)
96 {
97 //build local grid URL from network_servers_information.xml
98 // this is highly dependant on a standard default.xml
99 if (File.Exists(@"network_servers_information.xml"))
100 {
101 string text;
102 FileInfo defaultFile = new FileInfo(@"network_servers_information.xml");
103 Regex myRegex = new Regex(".*UserServerURL=\\\"(?<url>.*?)\\\".*");
104 StreamReader stream = defaultFile.OpenText();
140 105
141 stream = defaultFile.OpenText(); 106 do
142 do 107 {
108 text = stream.ReadLine();
109 if (text == null)
143 { 110 {
144 text = stream.ReadLine(); 111 break;
145 if (text == null) 112 }
146 { 113 foreach (Match theMatch in myRegex.Matches(text))
147 break; 114 {
148 } 115 if (theMatch.Length != 0)
149 MatchCollection theMatches = myRegex.Matches(text);
150 foreach (Match theMatch in theMatches)
151 { 116 {
152 if (theMatch.Length != 0) 117 gridUrl = theMatch.Groups["url"].ToString();
153 {
154 gridUrl = theMatch.Groups["url"].ToString();
155 }
156 } 118 }
157 } while (text != null);
158 stream.Close();
159 if (gridUrl != null)
160 {
161 menuItems.Add("Local Grid Server");
162 } 119 }
120 } while (text != null);
121 stream.Close();
122 if (gridUrl != null)
123 {
124 menuItems.Add("Local Grid Server");
163 } 125 }
164 } 126 }
127 }
128
129 private void addLocalSims(ref ArrayList menuItems)
130 {
131 // find opensim directory
132 RegistryKey exeKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\OpenSim\OpenSim");
133 if (exeKey != null)
134 {
135 Object simPath = exeKey.GetValue("Path");
136
137 Directory.SetCurrentDirectory(simPath.ToString()); //this should be set to wherever we decide to put the binaries
138
139 addLocalSandbox(ref menuItems);
140 addLocalGrid(ref menuItems);
141 }
165 else 142 else
166 { 143 {
167 MessageBox.Show("No OpenSim installed. Showing public grids only", "No OpenSim"); 144 MessageBox.Show("No OpenSim installed. Showing public grids only", "No OpenSim");
168 } 145 }
146 }
147
148 private void getClient(ref string exePath, ref string runLine, ref string exeFlags)
149 {
150 // get executable path from registry
151 RegistryKey regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Linden Research, Inc.\SecondLife");
152 if (regKey == null)
153 {
154 regKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Linden Research, Inc.\SecondLife");
155 if (regKey == null)
156 {
157 throw new LauncherException("Can't find Second Life. Are you sure it is installed?", "LauncherException.Form1");
158 }
159 }
160 string exe = regKey.GetValue("Exe").ToString();
161 exeFlags = regKey.GetValue("Flags").ToString();
162 exePath = regKey.GetValue("").ToString();
163 runLine = exePath + "\\" + exe;
164 Registry.LocalMachine.Flush();
165 Registry.LocalMachine.Close();
166 }
167
168 public Form1()
169 {
170 InitializeComponent();
171 ArrayList menuItems = new ArrayList();
172
173 getClient(ref exePath, ref runLine, ref exeFlags);
174
175 menuItems.Add("Please select one:");
176
177 addLocalSims(ref menuItems);
169 178
170 menuItems.Add("OSGrid - www.osgrid.org"); 179 menuItems.Add("OSGrid - www.osgrid.org");
171 menuItems.Add("DeepGrid - www.deepgrid.com"); 180 menuItems.Add("DeepGrid - www.deepgrid.com");
172 menuItems.Add("OpenlifeGrid - www.openlifegrid.com"); 181 menuItems.Add("OpenlifeGrid - www.openlifegrid.com");
173 182 menuItems.Add("Linden Labs - www.secondlife.com");
174 // We don't have a proper login uri for SL grid 183
175 // menuItems.Add("Linden Labs - www.secondlife.com"); 184 comboBox1.DataSource = menuItems;
176 comboBox1.DataSource=menuItems;
177 } 185 }
178 186
179 private void radioButton1_CheckedChanged(object sender, EventArgs e) 187 private void radioButton1_CheckedChanged(object sender, EventArgs e)
180 { 188 {
181
182 } 189 }
183 190
184 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) 191 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
@@ -188,8 +195,8 @@ namespace LaunchSLClient
188 if (comboBox1.Text == "Local Grid Server") { runUrl = " -loginuri " + gridUrl; } 195 if (comboBox1.Text == "Local Grid Server") { runUrl = " -loginuri " + gridUrl; }
189 if (comboBox1.Text == "DeepGrid - www.deepgrid.com") { runUrl = " -loginuri " + deepGridUrl; } 196 if (comboBox1.Text == "DeepGrid - www.deepgrid.com") { runUrl = " -loginuri " + deepGridUrl; }
190 if (comboBox1.Text == "OSGrid - www.osgrid.org") { runUrl = " -loginuri " + osGridUrl; } 197 if (comboBox1.Text == "OSGrid - www.osgrid.org") { runUrl = " -loginuri " + osGridUrl; }
198 if (comboBox1.Text == "OpenlifeGrid - www.openlifegrid.com") { runUrl = " -loginuri " + openLifeGridUrl; }
191 if (comboBox1.Text == "Linden Labs - www.secondlife.com") { runUrl = ""; } 199 if (comboBox1.Text == "Linden Labs - www.secondlife.com") { runUrl = ""; }
192 if (comboBox1.Text == "OpenlifeGrid - www.openlifegrid.com") { runUrl = " -loginuri http://logingrid.net:8002"; }
193 200
194 System.Diagnostics.Process proc = new System.Diagnostics.Process(); 201 System.Diagnostics.Process proc = new System.Diagnostics.Process();
195 proc.StartInfo.FileName = runLine; 202 proc.StartInfo.FileName = runLine;