aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ConvertToPlugins/src/Config
diff options
context:
space:
mode:
authorgareth2007-03-07 18:49:20 +0000
committergareth2007-03-07 18:49:20 +0000
commit16476f06b867adf01fa0d17c6761f4a862fc17ad (patch)
treec3a1147578ae33d269812adfe8de5ece8c62d586 /ConvertToPlugins/src/Config
parentDeleted old trunk code (diff)
downloadopensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.zip
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.gz
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.bz2
opensim-SC_OLD-16476f06b867adf01fa0d17c6761f4a862fc17ad.tar.xz
Imported branch
Diffstat (limited to 'ConvertToPlugins/src/Config')
-rw-r--r--ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs31
-rw-r--r--ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs146
-rw-r--r--ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj49
-rw-r--r--ConvertToPlugins/src/Config/SimConfig/SimConfig.sln7
-rw-r--r--ConvertToPlugins/src/Config/default.build52
5 files changed, 285 insertions, 0 deletions
diff --git a/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs b/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs
new file mode 100644
index 0000000..96c3e73
--- /dev/null
+++ b/ConvertToPlugins/src/Config/SimConfig/AssemblyInfo.cs
@@ -0,0 +1,31 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// Information about this assembly is defined by the following
6// attributes.
7//
8// change them to the information which is associated with the assembly
9// you compile.
10
11[assembly: AssemblyTitle("SimConfig")]
12[assembly: AssemblyDescription("")]
13[assembly: AssemblyConfiguration("")]
14[assembly: AssemblyCompany("")]
15[assembly: AssemblyProduct("SimConfig")]
16[assembly: AssemblyCopyright("")]
17[assembly: AssemblyTrademark("")]
18[assembly: AssemblyCulture("")]
19
20// This sets the default COM visibility of types in the assembly to invisible.
21// If you need to expose a type to COM, use [ComVisible(true)] on that type.
22[assembly: ComVisible(false)]
23
24// The assembly version has following format :
25//
26// Major.Minor.Build.Revision
27//
28// You can specify all values by your own or you can build default build and revision
29// numbers with the '*' character (the default):
30
31[assembly: AssemblyVersion("1.0.*")]
diff --git a/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs b/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs
new file mode 100644
index 0000000..cc31328
--- /dev/null
+++ b/ConvertToPlugins/src/Config/SimConfig/Db4SimConfig.cs
@@ -0,0 +1,146 @@
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*/
27using System;
28using System.Collections.Generic;
29using OpenSim;
30using OpenSim.world;
31using Db4objects.Db4o;
32
33namespace 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("Grid server key: ");
63 }
64 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
65 }
66
67 public override void InitConfig() {
68 try {
69 db = Db4oFactory.OpenFile("opensim.yap");
70 IObjectSet result = db.Get(typeof(DbSimConfig));
71 if(result.Count==1) {
72 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
73 foreach (DbSimConfig cfg in result) {
74 this.RegionName = cfg.RegionName;
75 this.RegionLocX = cfg.RegionLocX;
76 this.RegionLocY = cfg.RegionLocY;
77 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
78 this.IPListenPort = cfg.IPListenPort;
79 this.IPListenAddr = cfg.IPListenAddr;
80 this.AssetURL = cfg.AssetURL;
81 this.AssetSendKey = cfg.AssetSendKey;
82 this.GridURL = cfg.GridURL;
83 this.GridSendKey = cfg.GridSendKey;
84 }
85 } else {
86 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
87 LoadDefaults();
88 ServerConsole.MainConsole.Instance.WriteLine("Writing out default settings to local database");
89 db.Set(this);
90 }
91 } catch(Exception e) {
92 db.Close();
93 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
94 ServerConsole.MainConsole.Instance.WriteLine(e.ToString());
95 }
96
97 ServerConsole.MainConsole.Instance.WriteLine("Sim settings loaded:");
98 ServerConsole.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
99 ServerConsole.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
100 ServerConsole.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
101 ServerConsole.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
102 ServerConsole.MainConsole.Instance.WriteLine("Sandbox Mode? " + OpenSim_Main.sim.sandbox.ToString());
103 ServerConsole.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
104 ServerConsole.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
105 ServerConsole.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
106 ServerConsole.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
107 }
108
109 public override World LoadWorld()
110 {
111 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
112 World blank = new World();
113 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
114 IObjectSet world_result = db.Get(new float[65536]);
115 if(world_result.Count>0) {
116 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
117 blank.LandMap=(float[])world_result.Next();
118 } else {
119 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
120 HeightmapGenHills hills = new HeightmapGenHills();
121 blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
122 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
123 db.Set(blank.LandMap);
124 db.Commit();
125 }
126 return blank;
127 }
128
129 public override void LoadFromGrid() {
130 ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
131 // TODO: Make this crap work
132 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
133 WebResponse GridResponse = GridLogin.GetResponse();
134 byte[] idata = new byte[(int)GridResponse.ContentLength];
135 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
136
137 br.Close();
138 GridResponse.Close();
139 */
140 }
141
142 public void Shutdown() {
143 db.Close();
144 }
145 }
146}
diff --git a/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj b/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj
new file mode 100644
index 0000000..08f0f24
--- /dev/null
+++ b/ConvertToPlugins/src/Config/SimConfig/SimConfig.csproj
@@ -0,0 +1,49 @@
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\Debug\</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\Release\</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 <Compile Include="AssemblyInfo.cs" />
37 </ItemGroup>
38 <ItemGroup>
39 <ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
40 <Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
41 <Name>ServerConsole</Name>
42 </ProjectReference>
43 <ProjectReference Include="..\..\Second-server.csproj">
44 <Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
45 <Name>Second-server</Name>
46 </ProjectReference>
47 </ItemGroup>
48 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
49</Project> \ No newline at end of file
diff --git a/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln b/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln
new file mode 100644
index 0000000..944d6a8
--- /dev/null
+++ b/ConvertToPlugins/src/Config/SimConfig/SimConfig.sln
@@ -0,0 +1,7 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# SharpDevelop 2.1.0.2017
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}"
5EndProject
6Global
7EndGlobal
diff --git a/ConvertToPlugins/src/Config/default.build b/ConvertToPlugins/src/Config/default.build
new file mode 100644
index 0000000..2ee0c52
--- /dev/null
+++ b/ConvertToPlugins/src/Config/default.build
@@ -0,0 +1,52 @@
1<?xml version="1.0"?>
2 <project name="OpenSim" default="build" basedir=".">
3 <description>nant buildfile for OpenSim</description>
4 <property name="debug" value="true" overwrite="false" />
5 <target name="clean" description="remove all generated files">
6 <delete file="../bin/SimConfig.dll" failonerror="false" />
7 </target>
8
9 <target name="svnupdate" description="updates to latest SVN">
10 <exec program="svn">
11 <arg value="update" />
12 </exec>
13 </target>
14
15 <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build">
16
17 </target>
18
19 <target name="build" description="compiles the source code">
20
21 <loadfile file="../../VERSION" property="svnver"/>
22 <asminfo output="SimConfig/AssemblyInfo.cs" language="CSharp">
23 <imports>
24 <import namespace="System" />
25 <import namespace="System.Reflection" />
26 <import namespace="System.Runtime.InteropServices" />
27 </imports>
28 <attributes>
29 <attribute type="ComVisibleAttribute" value="false" />
30 <attribute type="CLSCompliantAttribute" value="false" />
31 <attribute type="AssemblyVersionAttribute" value="${svnver}" />
32 <attribute type="AssemblyTitleAttribute" value="opensim-simconfig" />
33 <attribute type="AssemblyDescriptionAttribute" value="The default configuration handler" />
34 <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/>
35 </attributes>
36 </asminfo>
37
38 <csc target="library" output="../../bin/SimConfig.dll" debug="${debug}" verbose="true" warninglevel="4">
39 <references basedir="../../bin/" failonempty="true">
40 <include name="System" />
41 <include name="System.Data" />
42 <include name="System.Xml" />
43 <include name="ServerConsole.dll" />
44 <include name="OpenSim.exe" />
45 <include name="Db4objects.Db4o.dll" />
46 </references>
47 <sources basedir="SimConfig/">
48 <include name="*.cs" />
49 </sources>
50 </csc>
51 </target>
52</project>