aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/Program.cs
diff options
context:
space:
mode:
authorlbsa712007-10-30 09:05:31 +0000
committerlbsa712007-10-30 09:05:31 +0000
commit67e12b95ea7b68f4904a7484d77ecfd787d16d0c (patch)
tree20b00d24c8a7617017960432ec044852e3ad5fa9 /OpenSim/Region/Examples/SimpleApp/Program.cs
parent* Deleted .user file (diff)
downloadopensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.zip
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.gz
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.bz2
opensim-SC_OLD-67e12b95ea7b68f4904a7484d77ecfd787d16d0c.tar.xz
* Optimized usings
* Shortened type references * Removed redundant 'this' qualifier
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/Program.cs')
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs87
1 files changed, 50 insertions, 37 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 72aaf6b..b37c2ee 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -31,23 +31,23 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Net; 32using System.Net;
33using libsecondlife; 33using libsecondlife;
34using Nini.Config;
35using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
36using OpenSim.Framework;
37using OpenSim.Region.ClientStack; 38using OpenSim.Region.ClientStack;
38using OpenSim.Region.Communications.Local; 39using OpenSim.Region.Communications.Local;
39using OpenSim.Region.Environment; 40using OpenSim.Region.Environment;
40using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42using Nini.Config;
43 43
44namespace SimpleApp 44namespace SimpleApp
45{ 45{
46 class Program : RegionApplicationBase, conscmd_callback 46 internal class Program : RegionApplicationBase, conscmd_callback
47 { 47 {
48 private ModuleLoader m_moduleLoader; 48 private ModuleLoader m_moduleLoader;
49 private IConfigSource m_config; 49 private IConfigSource m_config;
50 50
51 protected override LogBase CreateLog() 51 protected override LogBase CreateLog()
52 { 52 {
53 return new LogBase(null, "SimpleApp", this, true); 53 return new LogBase(null, "SimpleApp", this, true);
@@ -57,45 +57,51 @@ namespace SimpleApp
57 { 57 {
58 StartLog(); 58 StartLog();
59 59
60 m_networkServersInfo = new NetworkServersInfo( 1000, 1000 ); 60 m_networkServersInfo = new NetworkServersInfo(1000, 1000);
61 61
62 LocalAssetServer assetServer = new LocalAssetServer(); 62 LocalAssetServer assetServer = new LocalAssetServer();
63 63
64 m_assetCache = new AssetCache(assetServer); 64 m_assetCache = new AssetCache(assetServer);
65 } 65 }
66 66
67 public void Run() 67 public void Run()
68 { 68 {
69 base.StartUp(); 69 base.StartUp();
70 70
71 LocalInventoryService inventoryService = new LocalInventoryService(); 71 LocalInventoryService inventoryService = new LocalInventoryService();
72 LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); 72 LocalUserServices userService =
73 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
74 m_networkServersInfo.DefaultHomeLocY, inventoryService);
73 LocalBackEndServices backendService = new LocalBackEndServices(); 75 LocalBackEndServices backendService = new LocalBackEndServices();
74 76
75 CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, false); 77 CommunicationsLocal localComms =
78 new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService,
79 backendService, backendService, false);
76 m_commsManager = localComms; 80 m_commsManager = localComms;
77 81
78 LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); 82 LocalLoginService loginService =
83 new LocalLoginService(userService, "", localComms, m_networkServersInfo, false);
79 loginService.OnLoginToRegion += backendService.AddNewSession; 84 loginService.OnLoginToRegion += backendService.AddNewSession;
80 85
81 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod); 86 m_httpServer.AddXmlRPCHandler("login_to_simulator", loginService.XmlRpcLoginMethod);
82 87
83 m_log.Notice(m_log.LineInfo); 88 m_log.Notice(m_log.LineInfo);
84 89
85 IPEndPoint internalEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort); 90 IPEndPoint internalEndPoint =
91 new IPEndPoint(IPAddress.Parse("127.0.0.1"), m_networkServersInfo.HttpListenerPort);
86 92
87 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost"); 93 RegionInfo regionInfo = new RegionInfo(1000, 1000, internalEndPoint, "localhost");
88 regionInfo.DataStore = "simpleapp_datastore.yap"; 94 regionInfo.DataStore = "simpleapp_datastore.yap";
89 95
90 UDPServer udpServer; 96 UDPServer udpServer;
91 97
92 m_moduleLoader = new ModuleLoader( m_log, m_config ); 98 m_moduleLoader = new ModuleLoader(m_log, m_config);
93 m_moduleLoader.LoadDefaultSharedModules(); 99 m_moduleLoader.LoadDefaultSharedModules();
94 100
95 Scene scene = SetupScene(regionInfo, out udpServer); 101 Scene scene = SetupScene(regionInfo, out udpServer);
96 102
97 m_moduleLoader.InitialiseSharedModules(scene); 103 m_moduleLoader.InitialiseSharedModules(scene);
98 104
99 scene.SetModuleInterfaces(); 105 scene.SetModuleInterfaces();
100 106
101 scene.StartTimer(); 107 scene.StartTimer();
@@ -104,18 +110,22 @@ namespace SimpleApp
104 110
105 m_moduleLoader.PostInitialise(); 111 m_moduleLoader.PostInitialise();
106 m_moduleLoader.ClearCache(); 112 m_moduleLoader.ClearCache();
107 113
108 udpServer.ServerListener(); 114 udpServer.ServerListener();
109 115
110 LLVector3 pos = new LLVector3(110, 129, 27); 116 LLVector3 pos = new LLVector3(110, 129, 27);
111 117
112 SceneObjectGroup sceneObject = new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + new LLVector3( 1f, 1f, 1f )); 118 SceneObjectGroup sceneObject =
119 new CpuCounterObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
120 pos + new LLVector3(1f, 1f, 1f));
113 scene.AddEntity(sceneObject); 121 scene.AddEntity(sceneObject);
114 122
115 for (int i = 0; i < 27; i++) 123 for (int i = 0; i < 27; i++)
116 { 124 {
117 LLVector3 posOffset = new LLVector3( (i%3)*4, (i%9)/3 * 4, (i/9) * 4 ); 125 LLVector3 posOffset = new LLVector3((i%3)*4, (i%9)/3*4, (i/9)*4);
118 ComplexObject complexObject = new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(), pos + posOffset ); 126 ComplexObject complexObject =
127 new ComplexObject(scene, regionInfo.RegionHandle, LLUUID.Zero, scene.PrimIDAllocate(),
128 pos + posOffset);
119 scene.AddEntity(complexObject); 129 scene.AddEntity(complexObject);
120 } 130 }
121 131
@@ -128,45 +138,48 @@ namespace SimpleApp
128 List<ScenePresence> avatars = scene.GetAvatars(); 138 List<ScenePresence> avatars = scene.GetAvatars();
129 foreach (ScenePresence avatar in avatars) 139 foreach (ScenePresence avatar in avatars)
130 { 140 {
131 avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Util.RandomClass.Next(30, 200), 2); 141 avatar.AbsolutePosition =
142 new LLVector3((float) Util.RandomClass.Next(100, 200), (float) Util.RandomClass.Next(30, 200), 2);
132 } 143 }
133 144
134 145
135 146 DirectoryInfo dirInfo = new DirectoryInfo(".");
136 DirectoryInfo dirInfo = new DirectoryInfo( "." );
137 147
138 float x = 0; 148 float x = 0;
139 float z = 0; 149 float z = 0;
140 150
141 foreach( FileInfo fileInfo in dirInfo.GetFiles()) 151 foreach (FileInfo fileInfo in dirInfo.GetFiles())
142 { 152 {
143 LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z); 153 LLVector3 filePos = new LLVector3(100 + x, 129, 27 + z);
144 x = x + 2; 154 x = x + 2;
145 if( x > 50 ) 155 if (x > 50)
146 { 156 {
147 x = 0; 157 x = 0;
148 z = z + 2; 158 z = z + 2;
149 } 159 }
150 160
151 FileSystemObject fileObject = new FileSystemObject( scene, fileInfo, filePos ); 161 FileSystemObject fileObject = new FileSystemObject(scene, fileInfo, filePos);
152 scene.AddEntity(fileObject); 162 scene.AddEntity(fileObject);
153 } 163 }
154 164
155 m_log.Notice("Press enter to quit."); 165 m_log.Notice("Press enter to quit.");
156 m_log.ReadLine(); 166 m_log.ReadLine();
157 } 167 }
158 168
159 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) 169 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
170 AgentCircuitManager circuitManager)
160 { 171 {
161 return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config )); 172 return
173 new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer,
174 new ModuleLoader(m_log, m_config));
162 } 175 }
163 176
164 protected override StorageManager CreateStorageManager(RegionInfo regionInfo) 177 protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
165 { 178 {
166 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); 179 return new StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
167 } 180 }
168 181
169 protected override PhysicsScene GetPhysicsScene( ) 182 protected override PhysicsScene GetPhysicsScene()
170 { 183 {
171 return GetPhysicsScene("basicphysics"); 184 return GetPhysicsScene("basicphysics");
172 } 185 }
@@ -185,11 +198,11 @@ namespace SimpleApp
185 198
186 #endregion 199 #endregion
187 200
188 static void Main(string[] args) 201 private static void Main(string[] args)
189 { 202 {
190 Program app = new Program(); 203 Program app = new Program();
191 204
192 app.Run(); 205 app.Run();
193 } 206 }
194 } 207 }
195} 208} \ No newline at end of file