aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
diff options
context:
space:
mode:
authorMW2007-04-04 18:26:33 +0000
committerMW2007-04-04 18:26:33 +0000
commitd3766d0aef46c53b9e92afa77ffaa33817c7a04a (patch)
tree6e93d5ac3a70e38ce68d2694f0e0fbec68633e6c /OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
parentSplit Avatar class into three partial classes (hopefully will make it easier ... (diff)
downloadopensim-SC-d3766d0aef46c53b9e92afa77ffaa33817c7a04a.zip
opensim-SC-d3766d0aef46c53b9e92afa77ffaa33817c7a04a.tar.gz
opensim-SC-d3766d0aef46c53b9e92afa77ffaa33817c7a04a.tar.bz2
opensim-SC-d3766d0aef46c53b9e92afa77ffaa33817c7a04a.tar.xz
Deleted OpenSim.Config/SimConfigDb4o, as it hasn't been used for a while now.
Split World class into two partial classes
Diffstat (limited to '')
-rw-r--r--OpenSim.Config/SimConfigDb4o/DbSimConfig.cs136
1 files changed, 0 insertions, 136 deletions
diff --git a/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs b/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
deleted file mode 100644
index 9b51b45..0000000
--- a/OpenSim.Config/SimConfigDb4o/DbSimConfig.cs
+++ /dev/null
@@ -1,136 +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*/
27using System;
28using System.Collections.Generic;
29using OpenSim;
30using OpenSim.Framework.Utilities;
31using OpenSim.Framework.Interfaces;
32//using OpenSim.world;
33using Db4objects.Db4o;
34
35namespace OpenSim.Config.SimConfigDb4o
36{
37 public class Db40ConfigPlugin: ISimConfig
38 {
39 public SimConfig GetConfigObject()
40 {
41 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Loading Db40Config dll");
42 return ( new DbSimConfig());
43 }
44 }
45
46 public class DbSimConfig : SimConfig
47 {
48 private bool isSandbox;
49 private IObjectContainer db;
50
51 public void LoadDefaults() {
52 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings");
53
54 this.RegionName=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Name [OpenSim test]: ","OpenSim test");
55 this.RegionLocX=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location X [997]: ","997"));
56 this.RegionLocY=(uint)Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid Location Y [996]: ","996"));
57 this.IPListenPort=Convert.ToInt32(OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("UDP port for client connections [9000]: ","9000"));
58 this.IPListenAddr=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ","127.0.0.1");
59
60 if(!isSandbox)
61 {
62 this.AssetURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server URL: ");
63 this.AssetSendKey=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Asset server key: ");
64 this.GridURL=OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Grid server URL: ");
65 this.GridSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to grid server: ");
66 this.GridRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from grid server: ");
67 this.UserURL = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("User server URL: ");
68 this.UserSendKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to send to user server: ");
69 this.UserRecvKey = OpenSim.Framework.Console.MainConsole.Instance.CmdPrompt("Key to expect from user server: ");
70 }
71 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
72 }
73
74 public override void InitConfig(bool sandboxMode) {
75 this.isSandbox = sandboxMode;
76 try {
77 db = Db4oFactory.OpenFile("opensim.yap");
78 IObjectSet result = db.Get(typeof(DbSimConfig));
79 if(result.Count==1) {
80 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading");
81 foreach (DbSimConfig cfg in result) {
82 this.RegionName = cfg.RegionName;
83 this.RegionLocX = cfg.RegionLocX;
84 this.RegionLocY = cfg.RegionLocY;
85 this.RegionHandle = Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
86 this.IPListenPort = cfg.IPListenPort;
87 this.IPListenAddr = cfg.IPListenAddr;
88 this.AssetURL = cfg.AssetURL;
89 this.AssetSendKey = cfg.AssetSendKey;
90 this.GridURL = cfg.GridURL;
91 this.GridSendKey = cfg.GridSendKey;
92 }
93 } else {
94 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults");
95 LoadDefaults();
96 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Writing out default settings to local database");
97 db.Set(this);
98 db.Commit();
99 }
100 } catch(Exception e) {
101 db.Close();
102 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:InitConfig() - Exception occured");
103 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(e.ToString());
104 }
105
106 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sim settings loaded:");
107 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Name: " + this.RegionName);
108 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]");
109 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Region Handle: " + this.RegionHandle.ToString());
110 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort);
111 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Sandbox Mode? " + isSandbox.ToString());
112 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset URL: " + this.AssetURL);
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Asset key: " + this.AssetSendKey);
114 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid URL: " + this.GridURL);
115 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Grid key: " + this.GridSendKey);
116 }
117
118 public override void LoadFromGrid() {
119 OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!");
120 // TODO: Make this crap work
121 /* WebRequest GridLogin = WebRequest.Create(this.GridURL + "regions/" + this.RegionHandle.ToString() + "/login");
122 WebResponse GridResponse = GridLogin.GetResponse();
123 byte[] idata = new byte[(int)GridResponse.ContentLength];
124 BinaryReader br = new BinaryReader(GridResponse.GetResponseStream());
125
126 br.Close();
127 GridResponse.Close();
128 */
129 }
130
131 public void Shutdown() {
132 db.Close();
133 }
134 }
135
136}