diff options
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/Program.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/Program.cs | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs new file mode 100644 index 0000000..87e877c --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs | |||
@@ -0,0 +1,130 @@ | |||
1 | using System; | ||
2 | using System.Net; | ||
3 | using libsecondlife; | ||
4 | using OpenSim.Assets; | ||
5 | using OpenSim.Framework; | ||
6 | using OpenSim.Framework.Console; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Servers; | ||
9 | using OpenSim.Framework.Types; | ||
10 | using OpenSim.Physics.Manager; | ||
11 | using OpenSim.Region.Caches; | ||
12 | using OpenSim.Region.Capabilities; | ||
13 | using OpenSim.Region.ClientStack; | ||
14 | using OpenSim.Region.Communications.Local; | ||
15 | using OpenSim.Region.GridInterfaces.Local; | ||
16 | |||
17 | namespace SimpleApp | ||
18 | { | ||
19 | class Program : IAssetReceiver, conscmd_callback | ||
20 | { | ||
21 | private LogBase m_log; | ||
22 | AuthenticateSessionsBase m_circuitManager; | ||
23 | uint m_localId; | ||
24 | |||
25 | private void Run() | ||
26 | { | ||
27 | m_log = new LogBase(null, "SimpleApp", this, false); | ||
28 | MainLog.Instance = m_log; | ||
29 | |||
30 | // CheckSumServer checksumServer = new CheckSumServer(12036); | ||
31 | // checksumServer.ServerListener(); | ||
32 | |||
33 | IPEndPoint internalEndPoint = new IPEndPoint( IPAddress.Parse( "127.0.0.1" ), 9000 ); | ||
34 | |||
35 | m_circuitManager = new AuthenticateSessionsBase(); | ||
36 | |||
37 | InventoryCache inventoryCache = new InventoryCache(); | ||
38 | |||
39 | LocalAssetServer assetServer = new LocalAssetServer(); | ||
40 | assetServer.SetServerInfo("http://127.0.0.1:8003/", ""); | ||
41 | assetServer.SetReceiver(this); | ||
42 | |||
43 | AssetCache assetCache = new AssetCache(assetServer); | ||
44 | |||
45 | UDPServer udpServer = new UDPServer( internalEndPoint.Port, assetCache, inventoryCache, m_log, m_circuitManager ); | ||
46 | PacketServer packetServer = new PacketServer(udpServer); | ||
47 | udpServer.ServerListener(); | ||
48 | |||
49 | ClientView.TerrainManager = new TerrainManager(new SecondLife()); | ||
50 | BaseHttpServer httpServer = new BaseHttpServer(internalEndPoint.Port); | ||
51 | |||
52 | NetworkServersInfo serverInfo = new NetworkServersInfo(); | ||
53 | CommunicationsLocal communicationsManager = new CommunicationsLocal(serverInfo, httpServer); | ||
54 | |||
55 | RegionInfo regionInfo = new RegionInfo( 1000, 1000, internalEndPoint, "127.0.0.1" ); | ||
56 | |||
57 | MyWorld world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, httpServer); | ||
58 | world.PhysScene = PhysicsScene.Null; | ||
59 | udpServer.LocalWorld = world; | ||
60 | |||
61 | httpServer.AddXmlRPCHandler("login_to_simulator", communicationsManager.UserServices.XmlRpcLoginMethod ); | ||
62 | |||
63 | httpServer.Start(); | ||
64 | |||
65 | m_log.WriteLine( LogPriority.NORMAL, "Press enter to quit."); | ||
66 | m_log.ReadLine(); | ||
67 | |||
68 | PrimData primData = new PrimData(); | ||
69 | primData.Scale = new LLVector3(1, 1, 1); | ||
70 | |||
71 | m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0); | ||
72 | |||
73 | } | ||
74 | |||
75 | private bool AddNewSessionHandler(ulong regionHandle, Login loginData) | ||
76 | { | ||
77 | m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last); | ||
78 | |||
79 | AgentCircuitData agent = new AgentCircuitData(); | ||
80 | agent.AgentID = loginData.Agent; | ||
81 | agent.firstname = loginData.First; | ||
82 | agent.lastname = loginData.Last; | ||
83 | agent.SessionID = loginData.Session; | ||
84 | agent.SecureSessionID = loginData.SecureSession; | ||
85 | agent.circuitcode = loginData.CircuitCode; | ||
86 | agent.BaseFolder = loginData.BaseFolder; | ||
87 | agent.InventoryFolder = loginData.InventoryFolder; | ||
88 | agent.startpos = new LLVector3(128, 128, 70); | ||
89 | |||
90 | m_circuitManager.AddNewCircuit(agent.circuitcode, agent); | ||
91 | |||
92 | return true; | ||
93 | } | ||
94 | |||
95 | #region IAssetReceiver Members | ||
96 | |||
97 | public void AssetReceived( AssetBase asset, bool IsTexture) | ||
98 | { | ||
99 | throw new Exception("The method or operation is not implemented."); | ||
100 | } | ||
101 | |||
102 | public void AssetNotFound( AssetBase asset) | ||
103 | { | ||
104 | throw new Exception("The method or operation is not implemented."); | ||
105 | } | ||
106 | |||
107 | #endregion | ||
108 | |||
109 | #region conscmd_callback Members | ||
110 | |||
111 | public void RunCmd(string cmd, string[] cmdparams) | ||
112 | { | ||
113 | throw new Exception("The method or operation is not implemented."); | ||
114 | } | ||
115 | |||
116 | public void Show(string ShowWhat) | ||
117 | { | ||
118 | throw new Exception("The method or operation is not implemented."); | ||
119 | } | ||
120 | |||
121 | #endregion | ||
122 | |||
123 | static void Main(string[] args) | ||
124 | { | ||
125 | Program app = new Program(); | ||
126 | |||
127 | app.Run(); | ||
128 | } | ||
129 | } | ||
130 | } | ||