diff options
author | gareth | 2007-03-22 10:11:15 +0000 |
---|---|---|
committer | gareth | 2007-03-22 10:11:15 +0000 |
commit | 7daa3955bc3a1918e40962851f9e8d38597a245e (patch) | |
tree | bee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /src/Config/SimConfig | |
parent | Load XML for neighbourinfo from grid (diff) | |
download | opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.zip opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2 opensim-SC_OLD-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz |
brought zircon branch into trunk
Diffstat (limited to 'src/Config/SimConfig')
-rw-r--r-- | src/Config/SimConfig/AssemblyInfo.cs | 21 | ||||
-rw-r--r-- | src/Config/SimConfig/Db4SimConfig.cs | 177 | ||||
-rw-r--r-- | src/Config/SimConfig/SimConfig.csproj | 52 |
3 files changed, 0 insertions, 250 deletions
diff --git a/src/Config/SimConfig/AssemblyInfo.cs b/src/Config/SimConfig/AssemblyInfo.cs deleted file mode 100644 index 7fabd63..0000000 --- a/src/Config/SimConfig/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Reflection; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // ------------------------------------------------------------------------------ | ||
6 | // <autogenerated> | ||
7 | // This code was generated by a tool. | ||
8 | // Mono Runtime Version: 2.0.50727.42 | ||
9 | // | ||
10 | // Changes to this file may cause incorrect behavior and will be lost if | ||
11 | // the code is regenerated. | ||
12 | // </autogenerated> | ||
13 | // ------------------------------------------------------------------------------ | ||
14 | |||
15 | [assembly: ComVisibleAttribute(false)] | ||
16 | [assembly: CLSCompliantAttribute(false)] | ||
17 | [assembly: AssemblyVersionAttribute("0.1.0.240")] | ||
18 | [assembly: AssemblyTitleAttribute("opensim-simconfig")] | ||
19 | [assembly: AssemblyDescriptionAttribute("The default configuration handler")] | ||
20 | [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] | ||
21 | |||
diff --git a/src/Config/SimConfig/Db4SimConfig.cs b/src/Config/SimConfig/Db4SimConfig.cs deleted file mode 100644 index 1b696fe..0000000 --- a/src/Config/SimConfig/Db4SimConfig.cs +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
27 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using OpenSim; | ||
30 | using OpenSim.world; | ||
31 | using Db4objects.Db4o; | ||
32 | |||
33 | namespace Db40SimConfig | ||
34 | { | ||
35 | public class Db40ConfigPlugin: ISimConfig | ||
36 | { | ||
37 | public SimConfig GetConfigObject() | ||
38 | { | ||
39 | ServerConsole.MainConsole.Instance.WriteLine("Loading Db40Config dll"); | ||
40 | return ( new DbSimConfig()); | ||
41 | } | ||
42 | } | ||
43 | |||
44 | public class DbSimConfig :SimConfig | ||
45 | { | ||
46 | private IObjectContainer db; | ||
47 | |||
48 | public void LoadDefaults() { | ||
49 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
50 | |||
51 | this.RegionName=ServerConsole.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test"); | ||
52 | this.RegionLocX=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997")); | ||
53 | this.RegionLocY=(uint)Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996")); | ||
54 | this.IPListenPort=Convert.ToInt32(ServerConsole.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000")); | ||
55 | this.IPListenAddr=ServerConsole.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1"); | ||
56 | |||
57 | if(!OpenSim_Main.sim.sandbox) | ||
58 | { | ||
59 | this.AssetURL=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server URL: "); | ||
60 | this.AssetSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Asset server key: "); | ||
61 | this.GridURL=ServerConsole.MainConsole.Instance.CmdPrompt("Grid server URL: "); | ||
62 | this.GridSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to grid server: "); | ||
63 | this.GridRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from grid server: "); | ||
64 | this.UserURL=ServerConsole.MainConsole.Instance.CmdPrompt("User server URL: "); | ||
65 | this.UserSendKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to send to user server: "); | ||
66 | this.UserRecvKey=ServerConsole.MainConsole.Instance.CmdPrompt("Key to expect from user server: "); | ||
67 | } | ||
68 | this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); | ||
69 | } | ||
70 | |||
71 | public override void InitConfig() { | ||
72 | try { | ||
73 | db = Db4oFactory.OpenFile("opensim.yap"); | ||
74 | IObjectSet result = db.Get(typeof(DbSimConfig)); | ||
75 | if(result.Count==1) { | ||
76 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); | ||
77 | foreach (DbSimConfig cfg in result) { | ||
78 | this.RegionName = cfg.RegionName; | ||
79 | this.RegionLocX = cfg.RegionLocX; | ||
80 | this.RegionLocY = cfg.RegionLocY; | ||
81 | this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); | ||
82 | this.IPListenPort = cfg.IPListenPort; | ||
83 | this.IPListenAddr = cfg.IPListenAddr; | ||
84 | this.AssetURL = cfg.AssetURL; | ||
85 | this.AssetSendKey = cfg.AssetSendKey; | ||
86 | this.GridURL = cfg.GridURL; | ||
87 | this.GridSendKey = cfg.GridSendKey; | ||
88 | } | ||
89 | } else { | ||
90 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
91 | LoadDefaults(); | ||
92 | ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database"); | ||
93 | db.Set(this); | ||
94 | } | ||
95 | } catch(Exception e) { | ||
96 | db.Close(); | ||
97 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured"); | ||
98 | ServerConsole.MainConsole.Instance.WriteLine(e.ToString()); | ||
99 | } | ||
100 | |||
101 | ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:"); | ||
102 | ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName); | ||
103 | ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
104 | ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString()); | ||
105 | ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | ||
106 | ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString()); | ||
107 | ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL); | ||
108 | ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey); | ||
109 | ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL); | ||
110 | ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey); | ||
111 | } | ||
112 | |||
113 | public override World LoadWorld() | ||
114 | { | ||
115 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world...."); | ||
116 | World blank = new World(); | ||
117 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); | ||
118 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
119 | if(world_result.Count>0) { | ||
120 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); | ||
121 | MapStorage map=(MapStorage)world_result.Next(); | ||
122 | blank.LandMap = map.Map; | ||
123 | } else { | ||
124 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); | ||
125 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
126 | blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
127 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); | ||
128 | MapStorage map= new MapStorage(); | ||
129 | map.Map = blank.LandMap; | ||
130 | db.Set(map); | ||
131 | db.Commit(); | ||
132 | } | ||
133 | return blank; | ||
134 | } | ||
135 | |||
136 | public override void SaveMap() | ||
137 | { | ||
138 | IObjectSet world_result = db.Get(typeof(MapStorage)); | ||
139 | if(world_result.Count>0) { | ||
140 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - updating saved copy of heightmap in local database"); | ||
141 | MapStorage map=(MapStorage)world_result.Next(); | ||
142 | db.Delete(map); | ||
143 | } | ||
144 | MapStorage map1= new MapStorage(); | ||
145 | map1.Map = OpenSim_Main.local_world.LandMap; | ||
146 | db.Set(map1); | ||
147 | db.Commit(); | ||
148 | } | ||
149 | |||
150 | public override void LoadFromGrid() { | ||
151 | ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); | ||
152 | // TODO: Make this crap work | ||
153 | /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login"); | ||
154 | WebResponse GridResponse = GridLogin.GetResponse(); | ||
155 | byte[] idata = new byte[(int)GridResponse.ContentLength]; | ||
156 | BinaryReader br = new BinaryReader(GridResponse.GetResponseStream()); | ||
157 | |||
158 | br.Close(); | ||
159 | GridResponse.Close(); | ||
160 | */ | ||
161 | } | ||
162 | |||
163 | public void Shutdown() { | ||
164 | db.Close(); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | public class MapStorage | ||
169 | { | ||
170 | public float[] Map; | ||
171 | |||
172 | public MapStorage() | ||
173 | { | ||
174 | |||
175 | } | ||
176 | } | ||
177 | } | ||
diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj deleted file mode 100644 index 43e9499..0000000 --- a/src/Config/SimConfig/SimConfig.csproj +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Library</OutputType> | ||
4 | <RootNamespace>SimConfig</RootNamespace> | ||
5 | <AssemblyName>SimConfig</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{B063760D-DB8D-4F64-B6FE-335FAD1E650A}</ProjectGuid> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
11 | <OutputPath>..\..\..\bin\</OutputPath> | ||
12 | <Optimize>False</Optimize> | ||
13 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
14 | <DebugSymbols>True</DebugSymbols> | ||
15 | <DebugType>Full</DebugType> | ||
16 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
17 | </PropertyGroup> | ||
18 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
19 | <OutputPath>..\..\..\bin\</OutputPath> | ||
20 | <Optimize>True</Optimize> | ||
21 | <DefineConstants>TRACE</DefineConstants> | ||
22 | <DebugSymbols>False</DebugSymbols> | ||
23 | <DebugType>None</DebugType> | ||
24 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
25 | </PropertyGroup> | ||
26 | <ItemGroup> | ||
27 | <Reference Include="System" /> | ||
28 | <Reference Include="System.Xml" /> | ||
29 | <Reference Include="Db4objects.Db4o"> | ||
30 | <HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
31 | <SpecificVersion>False</SpecificVersion> | ||
32 | </Reference> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <Compile Include="Db4SimConfig.cs" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj"> | ||
39 | <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project> | ||
40 | <Name>ServerConsole</Name> | ||
41 | </ProjectReference> | ||
42 | <ProjectReference Include="..\..\Second-server.csproj"> | ||
43 | <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project> | ||
44 | <Name>Second-server</Name> | ||
45 | </ProjectReference> | ||
46 | <ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj"> | ||
47 | <Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project> | ||
48 | <Name>GridInterfaces</Name> | ||
49 | </ProjectReference> | ||
50 | </ItemGroup> | ||
51 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
52 | </Project> \ No newline at end of file | ||