diff options
Switched in NameSpaceChanges
Diffstat (limited to 'OpenSim/Framework/General/Types/NetworkServersInfo.cs')
-rw-r--r-- | OpenSim/Framework/General/Types/NetworkServersInfo.cs | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/OpenSim/Framework/General/Types/NetworkServersInfo.cs b/OpenSim/Framework/General/Types/NetworkServersInfo.cs new file mode 100644 index 0000000..c6b81a7 --- /dev/null +++ b/OpenSim/Framework/General/Types/NetworkServersInfo.cs | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenSim.Framework.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Framework.Types | ||
34 | { | ||
35 | public class NetworkServersInfo | ||
36 | { | ||
37 | public string AssetURL = "http://127.0.0.1:8003/"; | ||
38 | public string AssetSendKey = ""; | ||
39 | |||
40 | public string GridURL = ""; | ||
41 | public string GridSendKey = ""; | ||
42 | public string GridRecvKey = ""; | ||
43 | public string UserURL = ""; | ||
44 | public string UserSendKey = ""; | ||
45 | public string UserRecvKey = ""; | ||
46 | public bool isSandbox; | ||
47 | |||
48 | public uint DefaultHomeLocX = 0; | ||
49 | public uint DefaultHomeLocY = 0; | ||
50 | |||
51 | public int HttpListenerPort = 9000; | ||
52 | public int RemotingListenerPort = 8895; | ||
53 | |||
54 | public void InitConfig(bool sandboxMode, IGenericConfig configData) | ||
55 | { | ||
56 | this.isSandbox = sandboxMode; | ||
57 | |||
58 | try | ||
59 | { | ||
60 | string attri = ""; | ||
61 | |||
62 | attri = ""; | ||
63 | attri = configData.GetAttribute("HttpListenerPort"); | ||
64 | if (attri == "") | ||
65 | { | ||
66 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Http Listener Port", "9000"); | ||
67 | configData.SetAttribute("HttpListenerPort", location); | ||
68 | this.HttpListenerPort = Convert.ToInt32(location); | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | this.HttpListenerPort = Convert.ToInt32(attri); | ||
73 | } | ||
74 | |||
75 | attri = ""; | ||
76 | attri = configData.GetAttribute("RemotingListenerPort"); | ||
77 | if (attri == "") | ||
78 | { | ||
79 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Remoting Listener Port", "8895"); | ||
80 | configData.SetAttribute("RemotingListenerPort", location); | ||
81 | this.RemotingListenerPort = Convert.ToInt32(location); | ||
82 | } | ||
83 | else | ||
84 | { | ||
85 | this.RemotingListenerPort = Convert.ToInt32(attri); | ||
86 | } | ||
87 | |||
88 | if (sandboxMode) | ||
89 | { | ||
90 | // default home location X | ||
91 | attri = ""; | ||
92 | attri = configData.GetAttribute("DefaultLocationX"); | ||
93 | if (attri == "") | ||
94 | { | ||
95 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location X", "1000"); | ||
96 | configData.SetAttribute("DefaultLocationX", location); | ||
97 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(location); | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | this.DefaultHomeLocX = (uint)Convert.ToUInt32(attri); | ||
102 | } | ||
103 | |||
104 | // default home location Y | ||
105 | attri = ""; | ||
106 | attri = configData.GetAttribute("DefaultLocationY"); | ||
107 | if (attri == "") | ||
108 | { | ||
109 | string location = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Default Home Location Y", "1000"); | ||
110 | configData.SetAttribute("DefaultLocationY", location); | ||
111 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(location); | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | this.DefaultHomeLocY = (uint)Convert.ToUInt32(attri); | ||
116 | } | ||
117 | } | ||
118 | if (!isSandbox) | ||
119 | { | ||
120 | //Grid Server | ||
121 | attri = ""; | ||
122 | attri = configData.GetAttribute("GridServerURL"); | ||
123 | if (attri == "") | ||
124 | { | ||
125 | this.GridURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Grid server URL", "http://127.0.0.1:8001/"); | ||
126 | configData.SetAttribute("GridServerURL", this.GridURL); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | this.GridURL = attri; | ||
131 | } | ||
132 | |||
133 | //Grid Send Key | ||
134 | attri = ""; | ||
135 | attri = configData.GetAttribute("GridSendKey"); | ||
136 | if (attri == "") | ||
137 | { | ||
138 | this.GridSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to grid server", "null"); | ||
139 | configData.SetAttribute("GridSendKey", this.GridSendKey); | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | this.GridSendKey = attri; | ||
144 | } | ||
145 | |||
146 | //Grid Receive Key | ||
147 | attri = ""; | ||
148 | attri = configData.GetAttribute("GridRecvKey"); | ||
149 | if (attri == "") | ||
150 | { | ||
151 | this.GridRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from grid server", "null"); | ||
152 | configData.SetAttribute("GridRecvKey", this.GridRecvKey); | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | this.GridRecvKey = attri; | ||
157 | } | ||
158 | |||
159 | //Grid Server | ||
160 | attri = ""; | ||
161 | attri = configData.GetAttribute("UserServerURL"); | ||
162 | if (attri == "") | ||
163 | { | ||
164 | this.UserURL= OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("User server URL", "http://127.0.0.1:8002/"); | ||
165 | configData.SetAttribute("UserServerURL", this.UserURL); | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | this.UserURL = attri; | ||
170 | } | ||
171 | |||
172 | //Grid Send Key | ||
173 | attri = ""; | ||
174 | attri = configData.GetAttribute("UserSendKey"); | ||
175 | if (attri == "") | ||
176 | { | ||
177 | this.UserSendKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to send to user server", "null"); | ||
178 | configData.SetAttribute("UserSendKey", this.UserSendKey); | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | this.UserSendKey = attri; | ||
183 | } | ||
184 | |||
185 | //Grid Receive Key | ||
186 | attri = ""; | ||
187 | attri = configData.GetAttribute("UserRecvKey"); | ||
188 | if (attri == "") | ||
189 | { | ||
190 | this.UserRecvKey = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Key to expect from user server", "null"); | ||
191 | configData.SetAttribute("GridRecvKey", this.UserRecvKey); | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | this.UserRecvKey = attri; | ||
196 | } | ||
197 | |||
198 | attri = ""; | ||
199 | attri = configData.GetAttribute("AssetServerURL"); | ||
200 | if (attri == "") | ||
201 | { | ||
202 | this.AssetURL = OpenSim.Framework.Console.MainLog.Instance.CmdPrompt("Asset server URL", "http://127.0.0.1:8003/"); | ||
203 | configData.SetAttribute("AssetServerURL", this.GridURL); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | this.AssetURL = attri; | ||
208 | } | ||
209 | |||
210 | } | ||
211 | configData.Commit(); | ||
212 | } | ||
213 | catch (Exception e) | ||
214 | { | ||
215 | OpenSim.Framework.Console.MainLog.Instance.Warn("Config.cs:InitConfig() - Exception occured"); | ||
216 | OpenSim.Framework.Console.MainLog.Instance.Warn(e.ToString()); | ||
217 | } | ||
218 | } | ||
219 | } | ||
220 | } | ||