aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Examples/SimpleApp2/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Examples/SimpleApp2/Program.cs178
1 files changed, 0 insertions, 178 deletions
diff --git a/OpenSim/Examples/SimpleApp2/Program.cs b/OpenSim/Examples/SimpleApp2/Program.cs
deleted file mode 100644
index 85ce703..0000000
--- a/OpenSim/Examples/SimpleApp2/Program.cs
+++ /dev/null
@@ -1,178 +0,0 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim;
5using OpenSim.Servers;
6using OpenSim.GridInterfaces.Local;
7using OpenSim.Framework.Interfaces;
8using OpenSim.Framework.Types;
9using OpenSim.UserServer;
10using OpenSim.Framework.Console;
11using OpenSim.Assets;
12using libsecondlife;
13using OpenSim.Framework;
14using OpenSim.Caches;
15
16namespace SimpleApp2
17{
18 class Program : IWorld, IAssetReceiver, conscmd_callback
19 {
20 private ConsoleBase m_console;
21 private RegionInfo m_regionInfo;
22 private float[] m_map;
23 private AuthenticateSessionsBase m_circuitManager;
24
25 private void Run()
26 {
27 m_console = new ConsoleBase(null, "SimpleApp", this, false);
28 MainConsole.Instance = m_console;
29
30 m_map = CreateMap();
31
32 CheckSumServer checksumServer = new CheckSumServer(12036);
33 checksumServer.ServerListener();
34
35 string simAddr = "127.0.0.1";
36 int simPort = 9000;
37
38 m_circuitManager = new AuthenticateSessionsBase();
39
40 LoginServer loginServer = new LoginServer(simAddr, simPort, 0, 0, false);
41 loginServer.Startup();
42
43 loginServer.SetSessionHandler( AddNewSessionHandler );
44
45 InventoryCache inventoryCache = new InventoryCache();
46
47 LocalAssetServer assetServer = new LocalAssetServer();
48 assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
49 assetServer.SetReceiver(this);
50
51 AssetCache assetCache = new AssetCache(assetServer);
52
53 UDPServer udpServer = new UDPServer(simPort, assetCache, inventoryCache, m_console, m_circuitManager );
54 PacketServer packetServer = new MyPacketServer(m_map, udpServer, (uint) simPort );
55 udpServer.ServerListener();
56
57 ClientView.TerrainManager = new TerrainManager(new SecondLife());
58
59 m_regionInfo = new RegionInfo();
60
61 udpServer.LocalWorld = this;
62
63 // World world = new World(udpServer.PacketServer.ClientAPIs, regionInfo);
64 // PhysicsScene physicsScene = new NullPhysicsScene();
65 // world.PhysicsScene = physicsScene;
66 // udpServer.LocalWorld = world;
67
68 BaseHttpServer httpServer = new BaseHttpServer(simPort);
69 httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod);
70 httpServer.Start();
71
72 m_console.WriteLine(LogPriority.NORMAL, "Press enter to quit.");
73 m_console.ReadLine();
74 }
75
76 private float[] CreateMap()
77 {
78 float[] map = new float[65536];
79
80 for (int i = 0; i < 65536; i++)
81 {
82 int x = i % 256;
83 int y = i / 256;
84
85 map[i] = (float)(x + y / 2);
86 }
87
88 return map;
89 }
90
91 private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
92 {
93 m_console.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
94
95 AgentCircuitData agent = new AgentCircuitData();
96 agent.AgentID = loginData.Agent;
97 agent.firstname = loginData.First;
98 agent.lastname = loginData.Last;
99 agent.SessionID = loginData.Session;
100 agent.SecureSessionID = loginData.SecureSession;
101 agent.circuitcode = loginData.CircuitCode;
102 agent.BaseFolder = loginData.BaseFolder;
103 agent.InventoryFolder = loginData.InventoryFolder;
104 agent.startpos = new LLVector3(128, 128, 70);
105
106 m_circuitManager.AddNewCircuit(agent.circuitcode, agent);
107
108 return true;
109 }
110
111 static void Main(string[] args)
112 {
113 Program app = new Program();
114
115 app.Run();
116 }
117
118
119 #region IWorld Members
120
121 void IWorld.AddNewAvatar(IClientAPI remoteClient, LLUUID agentID, bool child)
122 {
123 remoteClient.SendRegionHandshake(m_regionInfo);
124 }
125
126 void IWorld.RemoveAvatar(LLUUID agentID)
127 {
128 throw new Exception("The method or operation is not implemented.");
129 }
130
131 RegionInfo IWorld.RegionInfo
132 {
133 get { return m_regionInfo; }
134 }
135
136 object IWorld.SyncRoot
137 {
138 get { return this; }
139 }
140
141 private uint m_nextLocalId = 1;
142
143 uint IWorld.NextLocalId
144 {
145 get { return m_nextLocalId++; }
146 }
147
148 #endregion
149
150 #region IAssetReceiver Members
151
152 public void AssetReceived(AssetBase asset, bool IsTexture)
153 {
154 throw new Exception("The method or operation is not implemented.");
155 }
156
157 public void AssetNotFound(AssetBase asset)
158 {
159 throw new Exception("The method or operation is not implemented.");
160 }
161
162 #endregion
163
164 #region conscmd_callback Members
165
166 public void RunCmd(string cmd, string[] cmdparams)
167 {
168 throw new Exception("The method or operation is not implemented.");
169 }
170
171 public void Show(string ShowWhat)
172 {
173 throw new Exception("The method or operation is not implemented.");
174 }
175
176 #endregion
177 }
178}