diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/General/Interfaces/ILocalStorage.cs | 71 | ||||
-rw-r--r-- | OpenSim/Framework/General/Interfaces/IUserServer.cs | 39 | ||||
-rw-r--r-- | OpenSim/Framework/General/Types/RegionInfo.cs | 49 | ||||
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 25 |
4 files changed, 73 insertions, 111 deletions
diff --git a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs b/OpenSim/Framework/General/Interfaces/ILocalStorage.cs deleted file mode 100644 index 1b7b01e..0000000 --- a/OpenSim/Framework/General/Interfaces/ILocalStorage.cs +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
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 | |||
29 | using libsecondlife; | ||
30 | using OpenSim.Framework.Types; | ||
31 | |||
32 | namespace OpenSim.Framework.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// ILocalStorage. Really hacked together right now needs cleaning up | ||
36 | /// </summary> | ||
37 | [System.Obsolete("Redundant, use IRegionDataStore instead")] | ||
38 | public interface ILocalStorage | ||
39 | { | ||
40 | void Initialise(string datastore); | ||
41 | |||
42 | void StorePrim(PrimData prim); | ||
43 | void RemovePrim(LLUUID primID); | ||
44 | void LoadPrimitives(ILocalStorageReceiver receiver); | ||
45 | |||
46 | [System.Obsolete("Use DataStorage instead")] | ||
47 | float[] LoadScene(); | ||
48 | [System.Obsolete("Use DataStorage instead")] | ||
49 | void SaveMap(float[] heightmap); | ||
50 | |||
51 | void SaveLandObjects(LandData[] lands); | ||
52 | void SaveLandObject(LandData land); | ||
53 | void RemoveLandObject(LandData land); | ||
54 | void RemoveAllLandObjects(); | ||
55 | void LoadLandObjects(ILocalStorageLandObjectReceiver recv); | ||
56 | |||
57 | void ShutDown(); | ||
58 | } | ||
59 | |||
60 | public interface ILocalStorageReceiver | ||
61 | { | ||
62 | void PrimFromStorage(PrimData prim); | ||
63 | } | ||
64 | |||
65 | public interface ILocalStorageLandObjectReceiver | ||
66 | { | ||
67 | void LandFromStorage(LandData data); | ||
68 | void NoLandDataFromStorage(); | ||
69 | } | ||
70 | } | ||
71 | |||
diff --git a/OpenSim/Framework/General/Interfaces/IUserServer.cs b/OpenSim/Framework/General/Interfaces/IUserServer.cs deleted file mode 100644 index ca5816d..0000000 --- a/OpenSim/Framework/General/Interfaces/IUserServer.cs +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
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 libsecondlife; | ||
29 | using OpenSim.Framework.Inventory; | ||
30 | |||
31 | namespace OpenSim.Framework.Interfaces | ||
32 | { | ||
33 | public interface IUserServer | ||
34 | { | ||
35 | AgentInventory RequestAgentsInventory(LLUUID agentID); | ||
36 | void SetServerInfo(string ServerUrl, string SendKey, string RecvKey); | ||
37 | bool UpdateAgentsInventory(LLUUID agentID, AgentInventory inventory); | ||
38 | } | ||
39 | } | ||
diff --git a/OpenSim/Framework/General/Types/RegionInfo.cs b/OpenSim/Framework/General/Types/RegionInfo.cs index b9ed8d2..aa391c0 100644 --- a/OpenSim/Framework/General/Types/RegionInfo.cs +++ b/OpenSim/Framework/General/Types/RegionInfo.cs | |||
@@ -29,6 +29,7 @@ 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 Nini.Config; | ||
32 | using libsecondlife; | 33 | using libsecondlife; |
33 | using OpenSim.Framework.Console; | 34 | using OpenSim.Framework.Console; |
34 | using OpenSim.Framework.Interfaces; | 35 | using OpenSim.Framework.Interfaces; |
@@ -163,9 +164,55 @@ namespace OpenSim.Framework.Types | |||
163 | m_externalHostName = externalUri; | 164 | m_externalHostName = externalUri; |
164 | } | 165 | } |
165 | 166 | ||
167 | public void LoadFromNiniSource(IConfigSource source) | ||
168 | { | ||
169 | this.LoadFromNiniSource(source, "RegionInfo"); | ||
170 | } | ||
171 | |||
172 | public void LoadFromNiniSource(IConfigSource source, string sectionName) | ||
173 | { | ||
174 | string errorMessage = ""; | ||
175 | this.SimUUID = new LLUUID(source.Configs[sectionName].GetString("sim_UUID", LLUUID.Random().ToStringHyphenated())); | ||
176 | this.RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); | ||
177 | this.m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); | ||
178 | this.m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); | ||
179 | this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | ||
180 | |||
181 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); | ||
182 | IPAddress ipAddressResult; | ||
183 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) | ||
184 | { | ||
185 | this.m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | errorMessage = "needs an IP Address (IPAddress)"; | ||
190 | } | ||
191 | this.m_internalEndPoint.Port = source.Configs[sectionName].GetInt("internal_ip_port",(int) 9000); | ||
192 | |||
193 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); | ||
194 | if (externalHost != "SYSTEMIP") | ||
195 | { | ||
196 | this.m_externalHostName = externalHost; | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | this.m_externalHostName = Util.GetLocalHost().ToString(); | ||
201 | } | ||
202 | |||
203 | this.MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); | ||
204 | this.MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); | ||
205 | this.MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); | ||
206 | |||
207 | if (errorMessage != "") | ||
208 | { | ||
209 | // a error | ||
210 | } | ||
211 | } | ||
212 | |||
166 | public void loadConfigurationOptions() | 213 | public void loadConfigurationOptions() |
167 | { | 214 | { |
168 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString(),true); | 215 | configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "UUID of Simulator (Default is recommended, random UUID)", LLUUID.Random().ToString(), true); |
169 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); | 216 | configMember.addConfigurationOption("sim_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Simulator Name", "OpenSim Test", false); |
170 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); | 217 | configMember.addConfigurationOption("sim_location_x", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (X Axis)", "1000", false); |
171 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); | 218 | configMember.addConfigurationOption("sim_location_y", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Grid Location (Y Axis)", "1000", false); |
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index f3e2a01..f3a8c73 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -32,6 +32,8 @@ using System.Net; | |||
32 | using System.Text; | 32 | using System.Text; |
33 | using libsecondlife; | 33 | using libsecondlife; |
34 | 34 | ||
35 | using Nini.Config; | ||
36 | |||
35 | namespace OpenSim.Framework.Utilities | 37 | namespace OpenSim.Framework.Utilities |
36 | { | 38 | { |
37 | public class Util | 39 | public class Util |
@@ -313,5 +315,28 @@ namespace OpenSim.Framework.Utilities | |||
313 | { | 315 | { |
314 | 316 | ||
315 | } | 317 | } |
318 | |||
319 | // Nini (config) related Methods | ||
320 | public static IConfigSource ConvertDataRowToXMLConfig(System.Data.DataRow row, string fileName) | ||
321 | { | ||
322 | if(!File.Exists(fileName)) | ||
323 | { | ||
324 | //create new file | ||
325 | } | ||
326 | XmlConfigSource config = new XmlConfigSource(fileName); | ||
327 | AddDataRowToConfig(config, row); | ||
328 | config.Save(); | ||
329 | |||
330 | return config; | ||
331 | } | ||
332 | |||
333 | public static void AddDataRowToConfig(IConfigSource config, System.Data.DataRow row) | ||
334 | { | ||
335 | config.Configs.Add((string)row[0]); | ||
336 | for (int i = 0; i < row.Table.Columns.Count; i++) | ||
337 | { | ||
338 | config.Configs[(string)row[0]].Set(row.Table.Columns[i].ColumnName, row[i]); | ||
339 | } | ||
340 | } | ||
316 | } | 341 | } |
317 | } | 342 | } |