diff options
author | mingchen | 2007-06-27 19:43:46 +0000 |
---|---|---|
committer | mingchen | 2007-06-27 19:43:46 +0000 |
commit | 0232f01a58a3c0a88e95c22589efec21f502f081 (patch) | |
tree | ff210fa6750c23972086ebbf816ead0a0a2f412a /OpenSim/Region/Simulation | |
parent | *Moved VersionInfo.cs to its correct place in OpenSim.csproj (diff) | |
download | opensim-SC-0232f01a58a3c0a88e95c22589efec21f502f081.zip opensim-SC-0232f01a58a3c0a88e95c22589efec21f502f081.tar.gz opensim-SC-0232f01a58a3c0a88e95c22589efec21f502f081.tar.bz2 opensim-SC-0232f01a58a3c0a88e95c22589efec21f502f081.tar.xz |
*Moved all the classes into their own file from LLSDHelpers.cs
*Some folder renaming to follow project Name
*Updated prebuild.xml
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/EstateManager.cs (renamed from OpenSim/Region/Simulation/EstateManager.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/OpenSim.Region.Environment.csproj (renamed from OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj) | 15 | ||||
-rw-r--r-- | OpenSim/Region/Environment/ParcelManager.cs (renamed from OpenSim/Region/Simulation/ParcelManager.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/RegionManager.cs (renamed from OpenSim/Region/Simulation/RegionManager.cs) | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Entity.cs (renamed from OpenSim/Region/Simulation/Scenes/Entity.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs (renamed from OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Primitive.cs (renamed from OpenSim/Region/Simulation/Scenes/Primitive.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs (renamed from OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Scripting.cs (renamed from OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs (renamed from OpenSim/Region/Simulation/Scenes/Scene.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneBase.cs (renamed from OpenSim/Region/Simulation/Scenes/SceneBase.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneEvents.cs (renamed from OpenSim/Region/Simulation/Scenes/SceneEvents.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObject.cs (renamed from OpenSim/Region/Simulation/Scenes/SceneObject.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs (renamed from OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs (renamed from OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs (renamed from OpenSim/Region/Simulation/Scenes/ScenePresence.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/Script.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/Script.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs (renamed from OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Simulation/Caps.cs | 258 |
23 files changed, 12 insertions, 266 deletions
diff --git a/OpenSim/Region/Simulation/EstateManager.cs b/OpenSim/Region/Environment/EstateManager.cs index c2c1ecf..c2c1ecf 100644 --- a/OpenSim/Region/Simulation/EstateManager.cs +++ b/OpenSim/Region/Environment/EstateManager.cs | |||
diff --git a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj index 3f8b60d..6f07969 100644 --- a/OpenSim/Region/Simulation/OpenSim.Region.Environment.csproj +++ b/OpenSim/Region/Environment/OpenSim.Region.Environment.csproj | |||
@@ -120,6 +120,12 @@ | |||
120 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 120 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
121 | <Private>False</Private> | 121 | <Private>False</Private> |
122 | </ProjectReference> | 122 | </ProjectReference> |
123 | <ProjectReference Include="..\Capabilities\OpenSim.Region.Capabilities.csproj"> | ||
124 | <Name>OpenSim.Region.Capabilities</Name> | ||
125 | <Project>{39038E85-0000-0000-0000-000000000000}</Project> | ||
126 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
127 | <Private>False</Private> | ||
128 | </ProjectReference> | ||
123 | <ProjectReference Include="..\Physics\Manager\OpenSim.Region.Physics.Manager.csproj"> | 129 | <ProjectReference Include="..\Physics\Manager\OpenSim.Region.Physics.Manager.csproj"> |
124 | <Name>OpenSim.Region.Physics.Manager</Name> | 130 | <Name>OpenSim.Region.Physics.Manager</Name> |
125 | <Project>{F4FF31EB-0000-0000-0000-000000000000}</Project> | 131 | <Project>{F4FF31EB-0000-0000-0000-000000000000}</Project> |
@@ -134,16 +140,13 @@ | |||
134 | </ProjectReference> | 140 | </ProjectReference> |
135 | </ItemGroup> | 141 | </ItemGroup> |
136 | <ItemGroup> | 142 | <ItemGroup> |
137 | <Compile Include="RegionManager.cs"> | ||
138 | <SubType>Code</SubType> | ||
139 | </Compile> | ||
140 | <Compile Include="EstateManager.cs"> | 143 | <Compile Include="EstateManager.cs"> |
141 | <SubType>Code</SubType> | 144 | <SubType>Code</SubType> |
142 | </Compile> | 145 | </Compile> |
143 | <Compile Include="ParcelManager.cs"> | 146 | <Compile Include="ParcelManager.cs"> |
144 | <SubType>Code</SubType> | 147 | <SubType>Code</SubType> |
145 | </Compile> | 148 | </Compile> |
146 | <Compile Include="Caps.cs"> | 149 | <Compile Include="RegionManager.cs"> |
147 | <SubType>Code</SubType> | 150 | <SubType>Code</SubType> |
148 | </Compile> | 151 | </Compile> |
149 | <Compile Include="Scenes\Entity.cs"> | 152 | <Compile Include="Scenes\Entity.cs"> |
@@ -176,10 +179,10 @@ | |||
176 | <Compile Include="Scenes\IScenePresenceBody.cs"> | 179 | <Compile Include="Scenes\IScenePresenceBody.cs"> |
177 | <SubType>Code</SubType> | 180 | <SubType>Code</SubType> |
178 | </Compile> | 181 | </Compile> |
179 | <Compile Include="Scenes\Scene.cs"> | 182 | <Compile Include="Scenes\SceneBase.cs"> |
180 | <SubType>Code</SubType> | 183 | <SubType>Code</SubType> |
181 | </Compile> | 184 | </Compile> |
182 | <Compile Include="Scenes\SceneBase.cs"> | 185 | <Compile Include="Scenes\Scene.cs"> |
183 | <SubType>Code</SubType> | 186 | <SubType>Code</SubType> |
184 | </Compile> | 187 | </Compile> |
185 | <Compile Include="Scenes\scripting\IScriptHandler.cs"> | 188 | <Compile Include="Scenes\scripting\IScriptHandler.cs"> |
diff --git a/OpenSim/Region/Simulation/ParcelManager.cs b/OpenSim/Region/Environment/ParcelManager.cs index 1cab4ab..1cab4ab 100644 --- a/OpenSim/Region/Simulation/ParcelManager.cs +++ b/OpenSim/Region/Environment/ParcelManager.cs | |||
diff --git a/OpenSim/Region/Simulation/RegionManager.cs b/OpenSim/Region/Environment/RegionManager.cs index 17d9aad..4ff55a8 100644 --- a/OpenSim/Region/Simulation/RegionManager.cs +++ b/OpenSim/Region/Environment/RegionManager.cs | |||
@@ -5,6 +5,7 @@ using OpenSim.Framework.Communications; | |||
5 | using OpenSim.Framework; | 5 | using OpenSim.Framework; |
6 | using OpenSim.Framework.Types; | 6 | using OpenSim.Framework.Types; |
7 | using OpenSim.Framework.Servers; | 7 | using OpenSim.Framework.Servers; |
8 | using OpenSim.Region.Capabilities; | ||
8 | 9 | ||
9 | namespace OpenSim.Region.Environment | 10 | namespace OpenSim.Region.Environment |
10 | { | 11 | { |
diff --git a/OpenSim/Region/Simulation/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index bbba34d..bbba34d 100644 --- a/OpenSim/Region/Simulation/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs index 36023d0..36023d0 100644 --- a/OpenSim/Region/Simulation/Scenes/IScenePresenceBody.cs +++ b/OpenSim/Region/Environment/Scenes/IScenePresenceBody.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 0f649b2..0f649b2 100644 --- a/OpenSim/Region/Simulation/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1d55c4d..1d55c4d 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs b/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs index 2249c3d..2249c3d 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.Scripting.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Scripting.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e71f601..ff54efa 100644 --- a/OpenSim/Region/Simulation/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
68 | protected RegionCommsListener regionCommsHost; | 68 | protected RegionCommsListener regionCommsHost; |
69 | protected CommunicationsManager commsManager; | 69 | protected CommunicationsManager commsManager; |
70 | 70 | ||
71 | protected Dictionary<LLUUID, Caps> capsHandlers = new Dictionary<LLUUID, Caps>(); | 71 | protected Dictionary<LLUUID, Capabilities.Caps> capsHandlers = new Dictionary<LLUUID, Capabilities.Caps>(); |
72 | protected BaseHttpServer httpListener; | 72 | protected BaseHttpServer httpListener; |
73 | 73 | ||
74 | public ParcelManager parcelManager; | 74 | public ParcelManager parcelManager; |
@@ -672,7 +672,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
672 | if (agent.CapsPath != "") | 672 | if (agent.CapsPath != "") |
673 | { | 673 | { |
674 | //Console.WriteLine("new user, so creating caps handler for it"); | 674 | //Console.WriteLine("new user, so creating caps handler for it"); |
675 | Caps cap = new Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); | 675 | Capabilities.Caps cap = new Capabilities.Caps(this.assetCache, httpListener, this.m_regInfo.CommsIPListenAddr, 9000, agent.CapsPath, agent.AgentID); |
676 | cap.RegisterHandlers(); | 676 | cap.RegisterHandlers(); |
677 | this.capsHandlers.Add(agent.AgentID, cap); | 677 | this.capsHandlers.Add(agent.AgentID, cap); |
678 | } | 678 | } |
diff --git a/OpenSim/Region/Simulation/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 3d8f522..3d8f522 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs b/OpenSim/Region/Environment/Scenes/SceneEvents.cs index fa1bacb..fa1bacb 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneEvents.cs +++ b/OpenSim/Region/Environment/Scenes/SceneEvents.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 88fb160..88fb160 100644 --- a/OpenSim/Region/Simulation/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs index 2caabc2..2caabc2 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Animations.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Animations.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs index 2c81d2a..2c81d2a 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.Body.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.Body.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 96e5c94..96e5c94 100644 --- a/OpenSim/Region/Simulation/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs index eb8a117..eb8a117 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptContext.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptContext.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs index e813626..e813626 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptEntity.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptEntity.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs b/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs index 115b4f4..115b4f4 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/IScriptHandler.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/IScriptHandler.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs b/OpenSim/Region/Environment/Scenes/scripting/Script.cs index 5d398b0..5d398b0 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/Script.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Script.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs b/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs index 0ce65ea..0ce65ea 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/ScriptFactory.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/ScriptFactory.cs | |||
diff --git a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs b/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs index 90c79e3..90c79e3 100644 --- a/OpenSim/Region/Simulation/Scenes/scripting/Scripts/FollowRandomAvatar.cs +++ b/OpenSim/Region/Environment/Scenes/scripting/Scripts/FollowRandomAvatar.cs | |||
diff --git a/OpenSim/Region/Simulation/Caps.cs b/OpenSim/Region/Simulation/Caps.cs deleted file mode 100644 index 9edbd54..0000000 --- a/OpenSim/Region/Simulation/Caps.cs +++ /dev/null | |||
@@ -1,258 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using System.IO; | ||
6 | using System.Xml; | ||
7 | using OpenSim.Framework.Servers; | ||
8 | using OpenSim.Framework; | ||
9 | using OpenSim.Framework.Utilities; | ||
10 | using OpenSim.Framework.Types; | ||
11 | using OpenSim.Region.Caches; | ||
12 | using libsecondlife; | ||
13 | |||
14 | namespace OpenSim.Region.Environment | ||
15 | { | ||
16 | public delegate void UpLoadedTexture(LLUUID assetID, LLUUID inventoryItem, byte[] data); | ||
17 | |||
18 | public class Caps | ||
19 | { | ||
20 | private string httpListenerAddress; | ||
21 | private uint httpListenPort; | ||
22 | private string capsObjectPath = "00001-"; | ||
23 | private string requestPath = "0000/"; | ||
24 | private string mapLayerPath = "0001/"; | ||
25 | private string newInventory = "0002/"; | ||
26 | private string requestTexture = "0003/"; | ||
27 | private string eventQueue = "0100/"; | ||
28 | private BaseHttpServer httpListener; | ||
29 | private LLUUID agentID; | ||
30 | private AssetCache assetCache; | ||
31 | private int eventQueueCount = 1; | ||
32 | private Queue<string> CapsEventQueue = new Queue<string>(); | ||
33 | |||
34 | public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, LLUUID agent) | ||
35 | { | ||
36 | assetCache = assetCach; | ||
37 | capsObjectPath = capsPath; | ||
38 | httpListener = httpServer; | ||
39 | httpListenerAddress = httpListen; | ||
40 | httpListenPort = httpPort; | ||
41 | agentID = agent; | ||
42 | } | ||
43 | |||
44 | /// <summary> | ||
45 | /// | ||
46 | /// </summary> | ||
47 | public void RegisterHandlers() | ||
48 | { | ||
49 | Console.WriteLine("registering CAPS handlers"); | ||
50 | httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + requestPath, CapsRequest); | ||
51 | httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + mapLayerPath, MapLayer); | ||
52 | httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + newInventory, NewAgentInventory); | ||
53 | httpListener.AddRestHandler("POST", "/CAPS/" + capsObjectPath + eventQueue, ProcessEventQueue); | ||
54 | } | ||
55 | |||
56 | /// <summary> | ||
57 | /// | ||
58 | /// </summary> | ||
59 | /// <param name="request"></param> | ||
60 | /// <param name="path"></param> | ||
61 | /// <param name="param"></param> | ||
62 | /// <returns></returns> | ||
63 | public string CapsRequest(string request, string path, string param) | ||
64 | { | ||
65 | // Console.WriteLine("Caps Request " + request); | ||
66 | string result = ""; | ||
67 | result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); | ||
68 | return result; | ||
69 | } | ||
70 | |||
71 | /// <summary> | ||
72 | /// | ||
73 | /// </summary> | ||
74 | /// <returns></returns> | ||
75 | protected LLSDCapsDetails GetCapabilities() | ||
76 | { | ||
77 | /* string capURLS = ""; | ||
78 | capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>"; | ||
79 | capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>"; | ||
80 | //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>"; | ||
81 | //capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>"; | ||
82 | return capURLS;*/ | ||
83 | |||
84 | LLSDCapsDetails caps = new LLSDCapsDetails(); | ||
85 | caps.MapLayer = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath; | ||
86 | caps.NewFileAgentInventory = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory; | ||
87 | return caps; | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// | ||
92 | /// </summary> | ||
93 | /// <param name="request"></param> | ||
94 | /// <param name="path"></param> | ||
95 | /// <param name="param"></param> | ||
96 | /// <returns></returns> | ||
97 | public string MapLayer(string request, string path, string param) | ||
98 | { | ||
99 | Encoding _enc = System.Text.Encoding.UTF8; | ||
100 | Hashtable hash =(Hashtable) LLSD.LLSDDeserialize(_enc.GetBytes(request)); | ||
101 | LLSDMapRequest mapReq = new LLSDMapRequest(); | ||
102 | LLSDHelpers.DeserialiseLLSDMap(hash, mapReq ); | ||
103 | |||
104 | LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); | ||
105 | mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); | ||
106 | string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); | ||
107 | |||
108 | //Console.WriteLine(" Maplayer response is " + res); | ||
109 | |||
110 | return res; | ||
111 | } | ||
112 | |||
113 | /// <summary> | ||
114 | /// | ||
115 | /// </summary> | ||
116 | /// <returns></returns> | ||
117 | protected LLSDMapLayer BuildLLSDMapLayerResponse() | ||
118 | { | ||
119 | LLSDMapLayer mapLayer = new LLSDMapLayer(); | ||
120 | mapLayer.Right = 5000; | ||
121 | mapLayer.Top = 5000; | ||
122 | mapLayer.ImageID = new LLUUID("00000000-0000-0000-9999-000000000006"); | ||
123 | |||
124 | return mapLayer; | ||
125 | } | ||
126 | |||
127 | public string ProcessEventQueue(string request, string path, string param) | ||
128 | { | ||
129 | // Console.WriteLine("event queue request " + request); | ||
130 | string res = ""; | ||
131 | int timer = 0; | ||
132 | |||
133 | /*while ((timer < 200) || (this.CapsEventQueue.Count < 1)) | ||
134 | { | ||
135 | timer++; | ||
136 | }*/ | ||
137 | if (this.CapsEventQueue.Count > 0) | ||
138 | { | ||
139 | lock (this.CapsEventQueue) | ||
140 | { | ||
141 | string item = CapsEventQueue.Dequeue(); | ||
142 | res = item; | ||
143 | } | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | res = this.CreateEmptyEventResponse(); | ||
148 | } | ||
149 | return res; | ||
150 | } | ||
151 | |||
152 | public string CreateEstablishAgentComms(string caps, string ipAddressPort) | ||
153 | { | ||
154 | string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>"; | ||
155 | res += "<key>events</key><array><map>"; | ||
156 | res += "<key>message</key><string>EstablishAgentCommunication</string>"; | ||
157 | res += "<key>body</key><map>"; | ||
158 | res += "<key>sim-ip-and-port</key><string>" + ipAddressPort + "</string>"; | ||
159 | res += "<key>seed-capability</key><string>" + caps + "</string>"; | ||
160 | res += "<key>agent-id</key><uuid>" + this.agentID.ToStringHyphenated() + "</uuid>"; | ||
161 | res += "</map>"; | ||
162 | res += "</map></array>"; | ||
163 | res += "</map></llsd>"; | ||
164 | eventQueueCount++; | ||
165 | this.CapsEventQueue.Enqueue(res); | ||
166 | return res; | ||
167 | } | ||
168 | |||
169 | public string CreateEmptyEventResponse() | ||
170 | { | ||
171 | string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>"; | ||
172 | res += "<key>events</key><array><map>"; | ||
173 | res += "</map></array>"; | ||
174 | res += "</map></llsd>"; | ||
175 | eventQueueCount++; | ||
176 | return res; | ||
177 | } | ||
178 | |||
179 | public string NewAgentInventory(string request, string path, string param) | ||
180 | { | ||
181 | //Console.WriteLine("received upload request:"+ request); | ||
182 | string res = ""; | ||
183 | LLUUID newAsset = LLUUID.Random(); | ||
184 | LLUUID newInvItem = LLUUID.Random(); | ||
185 | string uploaderPath = capsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000"); | ||
186 | AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); | ||
187 | httpListener.AddRestHandler("POST", "/CAPS/" + uploaderPath, uploader.uploaderCaps); | ||
188 | string uploaderURL = "http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + uploaderPath; | ||
189 | //Console.WriteLine("uploader url is " + uploaderURL); | ||
190 | res += "<llsd><map>"; | ||
191 | res += "<key>uploader</key><string>" + uploaderURL + "</string>"; | ||
192 | //res += "<key>success</key><boolean>true</boolean>"; | ||
193 | res += "<key>state</key><string>upload</string>"; | ||
194 | res += "</map></llsd>"; | ||
195 | uploader.OnUpLoad += this.UploadHandler; | ||
196 | return res; | ||
197 | } | ||
198 | |||
199 | public void UploadHandler(LLUUID assetID, LLUUID inventoryItem, byte[] data) | ||
200 | { | ||
201 | // Console.WriteLine("upload handler called"); | ||
202 | AssetBase asset; | ||
203 | asset = new AssetBase(); | ||
204 | asset.FullID = assetID; | ||
205 | asset.Type = 0; | ||
206 | asset.InvType = 0; | ||
207 | asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000"); | ||
208 | asset.Data = data; | ||
209 | this.assetCache.AddAsset(asset); | ||
210 | } | ||
211 | |||
212 | public class AssetUploader | ||
213 | { | ||
214 | public event UpLoadedTexture OnUpLoad; | ||
215 | |||
216 | private string uploaderPath = ""; | ||
217 | private LLUUID newAssetID; | ||
218 | private LLUUID inventoryItemID; | ||
219 | private BaseHttpServer httpListener; | ||
220 | public AssetUploader(LLUUID assetID, LLUUID inventoryItem, string path, BaseHttpServer httpServer) | ||
221 | { | ||
222 | newAssetID = assetID; | ||
223 | inventoryItemID = inventoryItem; | ||
224 | uploaderPath = path; | ||
225 | httpListener = httpServer; | ||
226 | |||
227 | } | ||
228 | |||
229 | public string uploaderCaps(string request, string path, string param) | ||
230 | { | ||
231 | Encoding _enc = System.Text.Encoding.UTF8; | ||
232 | byte[] data = _enc.GetBytes(request); | ||
233 | //Console.WriteLine("recieved upload " + Util.FieldToString(data)); | ||
234 | LLUUID inv = this.inventoryItemID; | ||
235 | string res = ""; | ||
236 | res += "<llsd><map>"; | ||
237 | res += "<key>new_asset</key><string>" + newAssetID.ToStringHyphenated() + "</string>"; | ||
238 | res += "<key>new_inventory_item</key><uuid>" + inv.ToStringHyphenated() + "</uuid>"; | ||
239 | res += "<key>state</key><string>complete</string>"; | ||
240 | res += "</map></llsd>"; | ||
241 | |||
242 | // Console.WriteLine("asset " + newAssetID.ToStringHyphenated() + " , inventory item " + inv.ToStringHyphenated()); | ||
243 | httpListener.RemoveRestHandler("POST", "/CAPS/" + uploaderPath); | ||
244 | if (OnUpLoad != null) | ||
245 | { | ||
246 | OnUpLoad(newAssetID, inv, data); | ||
247 | } | ||
248 | |||
249 | /*FileStream fs = File.Create("upload.jp2"); | ||
250 | BinaryWriter bw = new BinaryWriter(fs); | ||
251 | bw.Write(data); | ||
252 | bw.Close(); | ||
253 | fs.Close();*/ | ||
254 | return res; | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | } | ||