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