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