aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/Program.cs')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs221
1 files changed, 0 insertions, 221 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
deleted file mode 100644
index d75ecaa..0000000
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2* Copyright (c) Contributors, http://opensimulator.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
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Net;
33using libsecondlife;
34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Console;
38using OpenSim.Region.ClientStack;
39using OpenSim.Region.Communications.Local;
40using OpenSim.Region.Environment;
41using OpenSim.Region.Environment.Scenes;
42using OpenSim.Region.Physics.Manager;
43
44namespace SimpleApp
45{
46 internal class Program : RegionApplicationBase, conscmd_callback
47 {
48 private ModuleLoader m_moduleLoader;
49 private IConfigSource m_config = null;
50
51 private string m_userPlugin = "OpenSim.Framework.Data.SQLite.dll";
52 private string m_inventoryPlugin = "OpenSim.Framework.Data.SQLite.dll";
53
54 protected override ConsoleBase CreateConsole()
55 {
56 return new ConsoleBase("SimpleApp", this);
57 }
58
59 protected override void Initialize()
60 {
61 m_networkServersInfo = new NetworkServersInfo(1000, 1000);
62
63 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
64
65 LocalAssetServer assetServer = new LocalAssetServer();
66
67 m_assetCache = new AssetCache(assetServer);
68 }
69
70 public void Run()
71 {
72 StartConsole();
73 StartUp();
74
75 LocalInventoryService inventoryService = new LocalInventoryService();
76 inventoryService.AddPlugin(m_inventoryPlugin);
77
78 LocalUserServices userService =
79 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
80 m_networkServersInfo.DefaultHomeLocY, inventoryService);
81 userService.AddPlugin(m_userPlugin);
82
83 LocalBackEndServices backendService = new LocalBackEndServices();
84
85 CommunicationsLocal localComms =
86 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService,
87 backendService, backendService, false);
88 m_commsManager = localComms;
89
90 LocalLoginService loginService =
91 new LocalLoginService(
92 userService, String.Empty, localComms, m_networkServersInfo, false);
93 loginService.OnLoginToRegion += backendService.AddNewSession;
94
95 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
96
97 m_console.Notice(m_console.LineInfo);
98
99 IPEndPoint internalEndPoint =
100 new IPEndPoint(IPAddress.Parse("127.0.0.1"), (int) m_networkServersInfo.HttpListenerPort);
101
102 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost");
103 regionInfo.DataStore = "simpleapp_datastore.yap";
104
105 UDPServer udpServer;
106
107 m_moduleLoader = new ModuleLoader(m_config);
108 m_moduleLoader.LoadDefaultSharedModules();
109
110 Scene scene = SetupScene(regionInfo, out udpServer, false);
111
112 m_moduleLoader.InitialiseSharedModules(scene);
113
114 scene.SetModuleInterfaces();
115
116 scene.StartTimer();
117
118 m_sceneManager.Add(scene);
119
120 m_moduleLoader.PostInitialise();
121 m_moduleLoader.ClearCache();
122
123 udpServer.ServerListener();
124
125 LLVector3 pos = new LLVector3(110, 129, 27);
126
127 SceneObjectGroup sceneObject =
128 new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
129 pos + new LLVector3(1f, 1f, 1f));
130 scene.AddEntity(sceneObject);
131
132 for (int i = 0; i < 27; i++)
133 {
134 LLVector3 posOffset = new LLVector3((i%3)*4, (i%9)/3*4, (i/9)*4);
135 ComplexObject complexObject =
136 new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
137 pos + posOffset);
138 scene.AddEntity(complexObject);
139 }
140
141 for (int i = 0; i < 2; i++)
142 {
143 MyNpcCharacter m_character = new MyNpcCharacter(scene.EventManager);
144 scene.AddNewClient(m_character, false);
145 }
146
147 List<ScenePresence> avatars = scene.GetAvatars();
148 foreach (ScenePresence avatar in avatars)
149 {
150 avatar.AbsolutePosition =
151 new LLVector3((float) Util.RandomClass.Next(100, 200), (float) Util.RandomClass.Next(30, 200), 2);
152 }
153
154 DirectoryInfo dirInfo = new DirectoryInfo(".");
155
156 float x = 0;
157 float z = 0;
158
159 foreach (FileInfo fileInfo in dirInfo.GetFiles())
160 {
161 LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z);
162 x = x + 2;
163 if (x > 50)
164 {
165 x = 0;
166 z = z + 2;
167 }
168
169 FileSystemObject fileObject = new FileSystemObject(scene, fileInfo, filePos);
170 scene.AddEntity(fileObject);
171 }
172
173 m_console.Notice("Press enter to quit.");
174 m_console.ReadLine();
175 }
176
177 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
178 AgentCircuitManager circuitManager)
179 {
180 PermissionManager permissionManager = new PermissionManager();
181 SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager);
182 return
183 new MyWorld(regionInfo, circuitManager, permissionManager, m_commsManager, sceneGridService,
184 m_assetCache, storageManager, m_httpServer,
185 new ModuleLoader(m_config), true, false);
186 }
187
188 protected override StorageManager CreateStorageManager(string connectionstring)
189 {
190 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", false);
191 }
192
193 protected override PhysicsScene GetPhysicsScene()
194 {
195 return GetPhysicsScene("basicphysics", "Meshmerizer");
196 }
197
198 #region conscmd_callback Members
199
200 public override void RunCmd(string cmd, string[] cmdparams)
201 {
202 base.RunCmd(cmd, cmdparams);
203 }
204
205 public override void Show(string ShowWhat)
206 {
207 base.Show(ShowWhat);
208 }
209
210 #endregion
211
212 private static void Main(string[] args)
213 {
214 log4net.Config.XmlConfigurator.Configure();
215
216 Program app = new Program();
217
218 app.Run();
219 }
220 }
221}