diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/Types/RegionInfo.cs | 684 |
1 files changed, 342 insertions, 342 deletions
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index cfc0925..a216b52 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs | |||
@@ -1,342 +1,342 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | 2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
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 | using System; | 28 | using System; |
29 | using System.Globalization; | 29 | using System.Globalization; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Net.Sockets; | 31 | using System.Net.Sockets; |
32 | using libsecondlife; | 32 | using libsecondlife; |
33 | using OpenSim.Framework.Console; | 33 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | 34 | using OpenSim.Framework.Interfaces; |
35 | using OpenSim.Framework.Utilities; | 35 | using OpenSim.Framework.Utilities; |
36 | 36 | ||
37 | namespace OpenSim.Framework.Types | 37 | namespace OpenSim.Framework.Types |
38 | { | 38 | { |
39 | public class RegionInfo | 39 | public class RegionInfo |
40 | { | 40 | { |
41 | public LLUUID SimUUID = new LLUUID(); | 41 | public LLUUID SimUUID = new LLUUID(); |
42 | public string RegionName = ""; | 42 | public string RegionName = ""; |
43 | 43 | ||
44 | private IPEndPoint m_internalEndPoint; | 44 | private IPEndPoint m_internalEndPoint; |
45 | public IPEndPoint InternalEndPoint | 45 | public IPEndPoint InternalEndPoint |
46 | { | 46 | { |
47 | get | 47 | get |
48 | { | 48 | { |
49 | return m_internalEndPoint; | 49 | return m_internalEndPoint; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | public IPEndPoint ExternalEndPoint | 53 | public IPEndPoint ExternalEndPoint |
54 | { | 54 | { |
55 | get | 55 | get |
56 | { | 56 | { |
57 | // Old one defaults to IPv6 | 57 | // Old one defaults to IPv6 |
58 | //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); | 58 | //return new IPEndPoint( Dns.GetHostAddresses( m_externalHostName )[0], m_internalEndPoint.Port ); |
59 | 59 | ||
60 | // New method favors IPv4 | 60 | // New method favors IPv4 |
61 | IPAddress ia = null; | 61 | IPAddress ia = null; |
62 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) | 62 | foreach (IPAddress Adr in Dns.GetHostAddresses(m_externalHostName)) |
63 | { | 63 | { |
64 | if (ia == null) | 64 | if (ia == null) |
65 | ia = Adr; | 65 | ia = Adr; |
66 | 66 | ||
67 | if (Adr.AddressFamily == AddressFamily.InterNetwork) | 67 | if (Adr.AddressFamily == AddressFamily.InterNetwork) |
68 | { | 68 | { |
69 | ia = Adr; | 69 | ia = Adr; |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | 72 | ||
73 | } | 73 | } |
74 | 74 | ||
75 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 75 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | private string m_externalHostName; | 79 | private string m_externalHostName; |
80 | public string ExternalHostName | 80 | public string ExternalHostName |
81 | { | 81 | { |
82 | get | 82 | get |
83 | { | 83 | { |
84 | return m_externalHostName; | 84 | return m_externalHostName; |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | private uint? m_regionLocX; | 88 | private uint? m_regionLocX; |
89 | public uint RegionLocX | 89 | public uint RegionLocX |
90 | { | 90 | { |
91 | get | 91 | get |
92 | { | 92 | { |
93 | return m_regionLocX.Value; | 93 | return m_regionLocX.Value; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
97 | private uint? m_regionLocY; | 97 | private uint? m_regionLocY; |
98 | public uint RegionLocY | 98 | public uint RegionLocY |
99 | { | 99 | { |
100 | get | 100 | get |
101 | { | 101 | { |
102 | return m_regionLocY.Value; | 102 | return m_regionLocY.Value; |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | private ulong? m_regionHandle; | 106 | private ulong? m_regionHandle; |
107 | public ulong RegionHandle | 107 | public ulong RegionHandle |
108 | { | 108 | { |
109 | get | 109 | get |
110 | { | 110 | { |
111 | if (!m_regionHandle.HasValue) | 111 | if (!m_regionHandle.HasValue) |
112 | { | 112 | { |
113 | m_regionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | 113 | m_regionHandle = Util.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); |
114 | } | 114 | } |
115 | 115 | ||
116 | return m_regionHandle.Value; | 116 | return m_regionHandle.Value; |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | // Only used for remote regions , ie ones not in the current instance | 120 | // Only used for remote regions , ie ones not in the current instance |
121 | private uint m_remotingPort; | 121 | private uint m_remotingPort; |
122 | public uint RemotingPort | 122 | public uint RemotingPort |
123 | { | 123 | { |
124 | get | 124 | get |
125 | { | 125 | { |
126 | return m_remotingPort; | 126 | return m_remotingPort; |
127 | } | 127 | } |
128 | set | 128 | set |
129 | { | 129 | { |
130 | m_remotingPort = value; | 130 | m_remotingPort = value; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | public string RemotingAddress; | 133 | public string RemotingAddress; |
134 | 134 | ||
135 | public string DataStore = ""; | 135 | public string DataStore = ""; |
136 | public bool isSandbox = false; | 136 | public bool isSandbox = false; |
137 | 137 | ||
138 | public LLUUID MasterAvatarAssignedUUID = new LLUUID(); | 138 | public LLUUID MasterAvatarAssignedUUID = new LLUUID(); |
139 | public string MasterAvatarFirstName = ""; | 139 | public string MasterAvatarFirstName = ""; |
140 | public string MasterAvatarLastName = ""; | 140 | public string MasterAvatarLastName = ""; |
141 | public string MasterAvatarSandboxPassword = ""; | 141 | public string MasterAvatarSandboxPassword = ""; |
142 | 142 | ||
143 | public EstateSettings estateSettings; | 143 | public EstateSettings estateSettings; |
144 | 144 | ||
145 | public RegionInfo() | 145 | public RegionInfo() |
146 | { | 146 | { |
147 | estateSettings = new EstateSettings(); | 147 | estateSettings = new EstateSettings(); |
148 | } | 148 | } |
149 | 149 | ||
150 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) | 150 | public RegionInfo(uint regionLocX, uint regionLocY, IPEndPoint internalEndPoint, string externalUri) |
151 | : this() | 151 | : this() |
152 | { | 152 | { |
153 | m_regionLocX = regionLocX; | 153 | m_regionLocX = regionLocX; |
154 | m_regionLocY = regionLocY; | 154 | m_regionLocY = regionLocY; |
155 | 155 | ||
156 | m_internalEndPoint = internalEndPoint; | 156 | m_internalEndPoint = internalEndPoint; |
157 | m_externalHostName = externalUri; | 157 | m_externalHostName = externalUri; |
158 | } | 158 | } |
159 | 159 | ||
160 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | 160 | public void InitConfig(bool sandboxMode, IGenericConfig configData) |
161 | { | 161 | { |
162 | this.isSandbox = sandboxMode; | 162 | this.isSandbox = sandboxMode; |
163 | try | 163 | try |
164 | { | 164 | { |
165 | string attri = ""; | 165 | string attri = ""; |
166 | 166 | ||
167 | // Sim UUID | 167 | // Sim UUID |
168 | string simId = configData.GetAttribute("SimUUID"); | 168 | string simId = configData.GetAttribute("SimUUID"); |
169 | if (String.IsNullOrEmpty( simId )) | 169 | if (String.IsNullOrEmpty( simId )) |
170 | { | 170 | { |
171 | this.SimUUID = LLUUID.Random(); | 171 | this.SimUUID = LLUUID.Random(); |
172 | } | 172 | } |
173 | else | 173 | else |
174 | { | 174 | { |
175 | this.SimUUID = new LLUUID(simId); | 175 | this.SimUUID = new LLUUID(simId); |
176 | } | 176 | } |
177 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); | 177 | configData.SetAttribute("SimUUID", this.SimUUID.ToString()); |
178 | 178 | ||
179 | this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name"); | 179 | this.RegionName = GetString(configData, "SimName", "OpenSim test", "Region Name"); |
180 | 180 | ||
181 | //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X"); | 181 | //m_regionLocX = (uint) GetInt(configData, "SimLocationX", 1000, "Grid Location X"); |
182 | 182 | ||
183 | attri = ""; | 183 | attri = ""; |
184 | attri = configData.GetAttribute("SimLocationX"); | 184 | attri = configData.GetAttribute("SimLocationX"); |
185 | if (attri == "") | 185 | if (attri == "") |
186 | { | 186 | { |
187 | string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000"); | 187 | string location = MainLog.Instance.CmdPrompt("Grid Location X", "1000"); |
188 | configData.SetAttribute("SimLocationX", location); | 188 | configData.SetAttribute("SimLocationX", location); |
189 | m_regionLocX = (uint)Convert.ToUInt32(location); | 189 | m_regionLocX = (uint)Convert.ToUInt32(location); |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | m_regionLocX = (uint)Convert.ToUInt32(attri); | 193 | m_regionLocX = (uint)Convert.ToUInt32(attri); |
194 | } | 194 | } |
195 | // Sim/Grid location Y | 195 | // Sim/Grid location Y |
196 | attri = ""; | 196 | attri = ""; |
197 | attri = configData.GetAttribute("SimLocationY"); | 197 | attri = configData.GetAttribute("SimLocationY"); |
198 | if (attri == "") | 198 | if (attri == "") |
199 | { | 199 | { |
200 | string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); | 200 | string location = MainLog.Instance.CmdPrompt("Grid Location Y", "1000"); |
201 | configData.SetAttribute("SimLocationY", location); | 201 | configData.SetAttribute("SimLocationY", location); |
202 | m_regionLocY = (uint)Convert.ToUInt32(location); | 202 | m_regionLocY = (uint)Convert.ToUInt32(location); |
203 | } | 203 | } |
204 | else | 204 | else |
205 | { | 205 | { |
206 | m_regionLocY = (uint)Convert.ToUInt32(attri); | 206 | m_regionLocY = (uint)Convert.ToUInt32(attri); |
207 | } | 207 | } |
208 | 208 | ||
209 | m_regionHandle = null; | 209 | m_regionHandle = null; |
210 | 210 | ||
211 | this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage"); | 211 | this.DataStore = GetString(configData, "Datastore", "localworld.yap", "Filename for local storage"); |
212 | 212 | ||
213 | IPAddress internalAddress = GetIPAddress(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections"); | 213 | IPAddress internalAddress = GetIPAddress(configData, "InternalIPAddress", "0.0.0.0", "Internal IP Address for UDP client connections"); |
214 | int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); | 214 | int internalPort = GetIPPort(configData, "InternalIPPort", "9000", "Internal IP Port for UDP client connections"); |
215 | m_internalEndPoint = new IPEndPoint(internalAddress, internalPort); | 215 | m_internalEndPoint = new IPEndPoint(internalAddress, internalPort); |
216 | 216 | ||
217 | m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); | 217 | m_externalHostName = GetString(configData, "ExternalHostName", "127.0.0.1", "External Host Name"); |
218 | 218 | ||
219 | estateSettings.terrainFile = | 219 | estateSettings.terrainFile = |
220 | GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File"); | 220 | GetString(configData, "TerrainFile", "default.r32", "GENERAL SETTING: Default Terrain File"); |
221 | 221 | ||
222 | attri = ""; | 222 | attri = ""; |
223 | attri = configData.GetAttribute("TerrainMultiplier"); | 223 | attri = configData.GetAttribute("TerrainMultiplier"); |
224 | if (attri == "") | 224 | if (attri == "") |
225 | { | 225 | { |
226 | string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); | 226 | string re = MainLog.Instance.CmdPrompt("GENERAL SETTING: Terrain Height Multiplier", "60.0"); |
227 | this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); | 227 | this.estateSettings.terrainMultiplier = Convert.ToDouble(re, CultureInfo.InvariantCulture); |
228 | configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); | 228 | configData.SetAttribute("TerrainMultiplier", this.estateSettings.terrainMultiplier.ToString()); |
229 | } | 229 | } |
230 | else | 230 | else |
231 | { | 231 | { |
232 | this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); | 232 | this.estateSettings.terrainMultiplier = Convert.ToDouble(attri); |
233 | } | 233 | } |
234 | 234 | ||
235 | attri = ""; | 235 | attri = ""; |
236 | attri = configData.GetAttribute("MasterAvatarFirstName"); | 236 | attri = configData.GetAttribute("MasterAvatarFirstName"); |
237 | if (attri == "") | 237 | if (attri == "") |
238 | { | 238 | { |
239 | this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test"); | 239 | this.MasterAvatarFirstName = MainLog.Instance.CmdPrompt("First name of Master Avatar (Land and Region Owner)", "Test"); |
240 | 240 | ||
241 | configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); | 241 | configData.SetAttribute("MasterAvatarFirstName", this.MasterAvatarFirstName); |
242 | } | 242 | } |
243 | else | 243 | else |
244 | { | 244 | { |
245 | this.MasterAvatarFirstName = attri; | 245 | this.MasterAvatarFirstName = attri; |
246 | } | 246 | } |
247 | 247 | ||
248 | attri = ""; | 248 | attri = ""; |
249 | attri = configData.GetAttribute("MasterAvatarLastName"); | 249 | attri = configData.GetAttribute("MasterAvatarLastName"); |
250 | if (attri == "") | 250 | if (attri == "") |
251 | { | 251 | { |
252 | this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User"); | 252 | this.MasterAvatarLastName = MainLog.Instance.CmdPrompt("Last name of Master Avatar (Land and Region Owner)", "User"); |
253 | 253 | ||
254 | configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); | 254 | configData.SetAttribute("MasterAvatarLastName", this.MasterAvatarLastName); |
255 | } | 255 | } |
256 | else | 256 | else |
257 | { | 257 | { |
258 | this.MasterAvatarLastName = attri; | 258 | this.MasterAvatarLastName = attri; |
259 | } | 259 | } |
260 | 260 | ||
261 | if (isSandbox) //Sandbox Mode Specific Settings | 261 | if (isSandbox) //Sandbox Mode Specific Settings |
262 | { | 262 | { |
263 | attri = ""; | 263 | attri = ""; |
264 | attri = configData.GetAttribute("MasterAvatarSandboxPassword"); | 264 | attri = configData.GetAttribute("MasterAvatarSandboxPassword"); |
265 | if (attri == "") | 265 | if (attri == "") |
266 | { | 266 | { |
267 | this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test"); | 267 | this.MasterAvatarSandboxPassword = MainLog.Instance.CmdPrompt("Password of Master Avatar (Needed for sandbox mode account creation only)", "test"); |
268 | 268 | ||
269 | //Should I store this? | 269 | //Should I store this? |
270 | configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); | 270 | configData.SetAttribute("MasterAvatarSandboxPassword", this.MasterAvatarSandboxPassword); |
271 | } | 271 | } |
272 | else | 272 | else |
273 | { | 273 | { |
274 | this.MasterAvatarSandboxPassword = attri; | 274 | this.MasterAvatarSandboxPassword = attri; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | configData.Commit(); | 278 | configData.Commit(); |
279 | } | 279 | } |
280 | catch (Exception e) | 280 | catch (Exception e) |
281 | { | 281 | { |
282 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | 282 | MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); |
283 | MainLog.Instance.Warn(e.ToString()); | 283 | MainLog.Instance.Warn(e.ToString()); |
284 | } | 284 | } |
285 | 285 | ||
286 | MainLog.Instance.Verbose("Sim settings loaded:"); | 286 | MainLog.Instance.Verbose("Sim settings loaded:"); |
287 | MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated()); | 287 | MainLog.Instance.Verbose("UUID: " + this.SimUUID.ToStringHyphenated()); |
288 | MainLog.Instance.Verbose("Name: " + this.RegionName); | 288 | MainLog.Instance.Verbose("Name: " + this.RegionName); |
289 | MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | 289 | MainLog.Instance.Verbose("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); |
290 | MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString()); | 290 | MainLog.Instance.Verbose("Region Handle: " + this.RegionHandle.ToString()); |
291 | MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() ); | 291 | MainLog.Instance.Verbose("Listening on IP end point: " + m_internalEndPoint.ToString() ); |
292 | MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString()); | 292 | MainLog.Instance.Verbose("Sandbox Mode? " + isSandbox.ToString()); |
293 | 293 | ||
294 | } | 294 | } |
295 | 295 | ||
296 | private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4) | 296 | private uint GetInt(IGenericConfig configData, string p, int p_3, string p_4) |
297 | { | 297 | { |
298 | throw new Exception("The method or operation is not implemented."); | 298 | throw new Exception("The method or operation is not implemented."); |
299 | } | 299 | } |
300 | 300 | ||
301 | private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | 301 | private string GetString(IGenericConfig configData, string attrName, string defaultvalue, string prompt) |
302 | { | 302 | { |
303 | string s = configData.GetAttribute(attrName); | 303 | string s = configData.GetAttribute(attrName); |
304 | 304 | ||
305 | if (String.IsNullOrEmpty( s )) | 305 | if (String.IsNullOrEmpty( s )) |
306 | { | 306 | { |
307 | s = MainLog.Instance.CmdPrompt(prompt, defaultvalue); | 307 | s = MainLog.Instance.CmdPrompt(prompt, defaultvalue); |
308 | configData.SetAttribute(attrName, s ); | 308 | configData.SetAttribute(attrName, s ); |
309 | } | 309 | } |
310 | return s; | 310 | return s; |
311 | } | 311 | } |
312 | 312 | ||
313 | private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | 313 | private IPAddress GetIPAddress(IGenericConfig configData, string attrName, string defaultvalue, string prompt) |
314 | { | 314 | { |
315 | string addressStr = configData.GetAttribute(attrName); | 315 | string addressStr = configData.GetAttribute(attrName); |
316 | 316 | ||
317 | IPAddress address; | 317 | IPAddress address; |
318 | 318 | ||
319 | if (!IPAddress.TryParse(addressStr, out address)) | 319 | if (!IPAddress.TryParse(addressStr, out address)) |
320 | { | 320 | { |
321 | address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue); | 321 | address = MainLog.Instance.CmdPromptIPAddress(prompt, defaultvalue); |
322 | configData.SetAttribute(attrName, address.ToString()); | 322 | configData.SetAttribute(attrName, address.ToString()); |
323 | } | 323 | } |
324 | return address; | 324 | return address; |
325 | } | 325 | } |
326 | 326 | ||
327 | private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt) | 327 | private int GetIPPort(IGenericConfig configData, string attrName, string defaultvalue, string prompt) |
328 | { | 328 | { |
329 | string portStr = configData.GetAttribute(attrName); | 329 | string portStr = configData.GetAttribute(attrName); |
330 | 330 | ||
331 | int port; | 331 | int port; |
332 | 332 | ||
333 | if (!int.TryParse(portStr, out port)) | 333 | if (!int.TryParse(portStr, out port)) |
334 | { | 334 | { |
335 | port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue); | 335 | port = MainLog.Instance.CmdPromptIPPort(prompt, defaultvalue); |
336 | configData.SetAttribute(attrName, port.ToString()); | 336 | configData.SetAttribute(attrName, port.ToString()); |
337 | } | 337 | } |
338 | 338 | ||
339 | return port; | 339 | return port; |
340 | } | 340 | } |
341 | } | 341 | } |
342 | } | 342 | } |