aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2010-05-31 17:57:48 +0100
committerMelanie2010-05-31 17:57:48 +0100
commit0526a91206a64cb43be29d61d472a98f5a031b74 (patch)
tree061ab41ebe056e48794de5fd296c8af576471c1e /OpenSim/Framework
parentFix casting in llParcelMediaCommandList so that it actually, you know, works (diff)
parentFix a nullref in EventManager caused by RegionReady not setting the scene (diff)
downloadopensim-SC-0526a91206a64cb43be29d61d472a98f5a031b74.zip
opensim-SC-0526a91206a64cb43be29d61d472a98f5a031b74.tar.gz
opensim-SC-0526a91206a64cb43be29d61d472a98f5a031b74.tar.bz2
opensim-SC-0526a91206a64cb43be29d61d472a98f5a031b74.tar.xz
Merge branch '0.6.9-post-fixes' into careminster
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/MainServer.cs8
-rw-r--r--OpenSim/Framework/SLUtil.cs282
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs4
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
5 files changed, 294 insertions, 6 deletions
diff --git a/OpenSim/Framework/MainServer.cs b/OpenSim/Framework/MainServer.cs
index 84cc05e..1f5f208 100644
--- a/OpenSim/Framework/MainServer.cs
+++ b/OpenSim/Framework/MainServer.cs
@@ -25,13 +25,17 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using OpenSim.Framework.Servers.HttpServer;
29using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
30using log4net;
31using OpenSim.Framework.Servers.HttpServer;
30 32
31namespace OpenSim.Framework 33namespace OpenSim.Framework
32{ 34{
33 public class MainServer 35 public class MainServer
34 { 36 {
37 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38
35 private static BaseHttpServer instance = null; 39 private static BaseHttpServer instance = null;
36 private static Dictionary<uint, BaseHttpServer> m_Servers = 40 private static Dictionary<uint, BaseHttpServer> m_Servers =
37 new Dictionary<uint, BaseHttpServer>(); 41 new Dictionary<uint, BaseHttpServer>();
@@ -53,6 +57,8 @@ namespace OpenSim.Framework
53 return m_Servers[port]; 57 return m_Servers[port];
54 58
55 m_Servers[port] = new BaseHttpServer(port); 59 m_Servers[port] = new BaseHttpServer(port);
60
61 m_log.InfoFormat("[MAIN HTTP SERVER]: Starting main http server on port {0}", port);
56 m_Servers[port].Start(); 62 m_Servers[port].Start();
57 63
58 return m_Servers[port]; 64 return m_Servers[port];
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
new file mode 100644
index 0000000..ff5f8b9
--- /dev/null
+++ b/OpenSim/Framework/SLUtil.cs
@@ -0,0 +1,282 @@
1using System;
2using System.Collections.Generic;
3using OpenMetaverse;
4
5namespace OpenSim.Framework
6{
7 public static class SLUtil
8 {
9 #region SL / file extension / content-type conversions
10
11 public static string SLAssetTypeToContentType(int assetType)
12 {
13 switch ((AssetType)assetType)
14 {
15 case AssetType.Texture:
16 return "image/x-j2c";
17 case AssetType.Sound:
18 return "application/ogg";
19 case AssetType.CallingCard:
20 return "application/vnd.ll.callingcard";
21 case AssetType.Landmark:
22 return "application/vnd.ll.landmark";
23 case AssetType.Clothing:
24 return "application/vnd.ll.clothing";
25 case AssetType.Object:
26 return "application/vnd.ll.primitive";
27 case AssetType.Notecard:
28 return "application/vnd.ll.notecard";
29 case AssetType.Folder:
30 return "application/vnd.ll.folder";
31 case AssetType.RootFolder:
32 return "application/vnd.ll.rootfolder";
33 case AssetType.LSLText:
34 return "application/vnd.ll.lsltext";
35 case AssetType.LSLBytecode:
36 return "application/vnd.ll.lslbyte";
37 case AssetType.TextureTGA:
38 case AssetType.ImageTGA:
39 return "image/tga";
40 case AssetType.Bodypart:
41 return "application/vnd.ll.bodypart";
42 case AssetType.TrashFolder:
43 return "application/vnd.ll.trashfolder";
44 case AssetType.SnapshotFolder:
45 return "application/vnd.ll.snapshotfolder";
46 case AssetType.LostAndFoundFolder:
47 return "application/vnd.ll.lostandfoundfolder";
48 case AssetType.SoundWAV:
49 return "audio/x-wav";
50 case AssetType.ImageJPEG:
51 return "image/jpeg";
52 case AssetType.Animation:
53 return "application/vnd.ll.animation";
54 case AssetType.Gesture:
55 return "application/vnd.ll.gesture";
56 case AssetType.Simstate:
57 return "application/x-metaverse-simstate";
58 case AssetType.Unknown:
59 default:
60 return "application/octet-stream";
61 }
62 }
63
64 public static sbyte ContentTypeToSLAssetType(string contentType)
65 {
66 switch (contentType)
67 {
68 case "image/x-j2c":
69 case "image/jp2":
70 return (sbyte)AssetType.Texture;
71 case "application/ogg":
72 return (sbyte)AssetType.Sound;
73 case "application/vnd.ll.callingcard":
74 case "application/x-metaverse-callingcard":
75 return (sbyte)AssetType.CallingCard;
76 case "application/vnd.ll.landmark":
77 case "application/x-metaverse-landmark":
78 return (sbyte)AssetType.Landmark;
79 case "application/vnd.ll.clothing":
80 case "application/x-metaverse-clothing":
81 return (sbyte)AssetType.Clothing;
82 case "application/vnd.ll.primitive":
83 case "application/x-metaverse-primitive":
84 return (sbyte)AssetType.Object;
85 case "application/vnd.ll.notecard":
86 case "application/x-metaverse-notecard":
87 return (sbyte)AssetType.Notecard;
88 case "application/vnd.ll.folder":
89 return (sbyte)AssetType.Folder;
90 case "application/vnd.ll.rootfolder":
91 return (sbyte)AssetType.RootFolder;
92 case "application/vnd.ll.lsltext":
93 case "application/x-metaverse-lsl":
94 return (sbyte)AssetType.LSLText;
95 case "application/vnd.ll.lslbyte":
96 case "application/x-metaverse-lso":
97 return (sbyte)AssetType.LSLBytecode;
98 case "image/tga":
99 // Note that AssetType.TextureTGA will be converted to AssetType.ImageTGA
100 return (sbyte)AssetType.ImageTGA;
101 case "application/vnd.ll.bodypart":
102 case "application/x-metaverse-bodypart":
103 return (sbyte)AssetType.Bodypart;
104 case "application/vnd.ll.trashfolder":
105 return (sbyte)AssetType.TrashFolder;
106 case "application/vnd.ll.snapshotfolder":
107 return (sbyte)AssetType.SnapshotFolder;
108 case "application/vnd.ll.lostandfoundfolder":
109 return (sbyte)AssetType.LostAndFoundFolder;
110 case "audio/x-wav":
111 return (sbyte)AssetType.SoundWAV;
112 case "image/jpeg":
113 return (sbyte)AssetType.ImageJPEG;
114 case "application/vnd.ll.animation":
115 case "application/x-metaverse-animation":
116 return (sbyte)AssetType.Animation;
117 case "application/vnd.ll.gesture":
118 case "application/x-metaverse-gesture":
119 return (sbyte)AssetType.Gesture;
120 case "application/x-metaverse-simstate":
121 return (sbyte)AssetType.Simstate;
122 case "application/octet-stream":
123 default:
124 return (sbyte)AssetType.Unknown;
125 }
126 }
127
128 public static sbyte ContentTypeToSLInvType(string contentType)
129 {
130 switch (contentType)
131 {
132 case "image/x-j2c":
133 case "image/jp2":
134 case "image/tga":
135 case "image/jpeg":
136 return (sbyte)InventoryType.Texture;
137 case "application/ogg":
138 case "audio/x-wav":
139 return (sbyte)InventoryType.Sound;
140 case "application/vnd.ll.callingcard":
141 case "application/x-metaverse-callingcard":
142 return (sbyte)InventoryType.CallingCard;
143 case "application/vnd.ll.landmark":
144 case "application/x-metaverse-landmark":
145 return (sbyte)InventoryType.Landmark;
146 case "application/vnd.ll.clothing":
147 case "application/x-metaverse-clothing":
148 case "application/vnd.ll.bodypart":
149 case "application/x-metaverse-bodypart":
150 return (sbyte)InventoryType.Wearable;
151 case "application/vnd.ll.primitive":
152 case "application/x-metaverse-primitive":
153 return (sbyte)InventoryType.Object;
154 case "application/vnd.ll.notecard":
155 case "application/x-metaverse-notecard":
156 return (sbyte)InventoryType.Notecard;
157 case "application/vnd.ll.folder":
158 return (sbyte)InventoryType.Folder;
159 case "application/vnd.ll.rootfolder":
160 return (sbyte)InventoryType.RootCategory;
161 case "application/vnd.ll.lsltext":
162 case "application/x-metaverse-lsl":
163 case "application/vnd.ll.lslbyte":
164 case "application/x-metaverse-lso":
165 return (sbyte)InventoryType.LSL;
166 case "application/vnd.ll.trashfolder":
167 case "application/vnd.ll.snapshotfolder":
168 case "application/vnd.ll.lostandfoundfolder":
169 return (sbyte)InventoryType.Folder;
170 case "application/vnd.ll.animation":
171 case "application/x-metaverse-animation":
172 return (sbyte)InventoryType.Animation;
173 case "application/vnd.ll.gesture":
174 case "application/x-metaverse-gesture":
175 return (sbyte)InventoryType.Gesture;
176 case "application/x-metaverse-simstate":
177 return (sbyte)InventoryType.Snapshot;
178 case "application/octet-stream":
179 default:
180 return (sbyte)InventoryType.Unknown;
181 }
182 }
183
184 #endregion SL / file extension / content-type conversions
185
186 /// <summary>
187 /// Parse a notecard in Linden format to a string of ordinary text.
188 /// </summary>
189 /// <param name="rawInput"></param>
190 /// <returns></returns>
191 public static string ParseNotecardToString(string rawInput)
192 {
193 return string.Join("\n", ParseNotecardToList(rawInput).ToArray());
194 }
195
196 /// <summary>
197 /// Parse a notecard in Linden format to a list of ordinary lines.
198 /// </summary>
199 /// <param name="rawInput"></param>
200 /// <returns></returns>
201 public static List<string> ParseNotecardToList(string rawInput)
202 {
203 string[] input = rawInput.Replace("\r", "").Split('\n');
204 int idx = 0;
205 int level = 0;
206 List<string> output = new List<string>();
207 string[] words;
208
209 while (idx < input.Length)
210 {
211 if (input[idx] == "{")
212 {
213 level++;
214 idx++;
215 continue;
216 }
217
218 if (input[idx]== "}")
219 {
220 level--;
221 idx++;
222 continue;
223 }
224
225 switch (level)
226 {
227 case 0:
228 words = input[idx].Split(' '); // Linden text ver
229 // Notecards are created *really* empty. Treat that as "no text" (just like after saving an empty notecard)
230 if (words.Length < 3)
231 return output;
232
233 int version = int.Parse(words[3]);
234 if (version != 2)
235 return output;
236 break;
237 case 1:
238 words = input[idx].Split(' ');
239 if (words[0] == "LLEmbeddedItems")
240 break;
241 if (words[0] == "Text")
242 {
243 int len = int.Parse(words[2]);
244 idx++;
245
246 int count = -1;
247
248 while (count < len)
249 {
250 // int l = input[idx].Length;
251 string ln = input[idx];
252
253 int need = len-count-1;
254 if (ln.Length > need)
255 ln = ln.Substring(0, need);
256
257 output.Add(ln);
258 count += ln.Length + 1;
259 idx++;
260 }
261
262 return output;
263 }
264 break;
265 case 2:
266 words = input[idx].Split(' '); // count
267 if (words[0] == "count")
268 {
269 int c = int.Parse(words[1]);
270 if (c > 0)
271 return output;
272 break;
273 }
274 break;
275 }
276 idx++;
277 }
278
279 return output;
280 }
281 }
282} \ No newline at end of file
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index 20d0f7e..0bd639f 100644
--- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -208,7 +208,9 @@ namespace OpenSim.Framework.Serialization
208 m_bw.Write(header); 208 m_bw.Write(header);
209 209
210 // Write out data 210 // Write out data
211 m_bw.Write(data); 211 // An IOException occurs if we try to write out an empty array in Mono 2.6
212 if (data.Length > 0)
213 m_bw.Write(data);
212 214
213 if (data.Length % 512 != 0) 215 if (data.Length % 512 != 0)
214 { 216 {
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 214f936..297d047 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -311,7 +311,7 @@ namespace OpenSim.Framework.Servers.HttpServer
311 } 311 }
312 catch (Exception e) 312 catch (Exception e)
313 { 313 {
314 m_log.ErrorFormat("[BASE HTTP SERVER]: OnRequest() failed with {0} {1}", e.Message, e.StackTrace); 314 m_log.Error(string.Format("[BASE HTTP SERVER]: OnRequest() failed with "), e);
315 } 315 }
316 } 316 }
317 317
@@ -1572,7 +1572,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1572 1572
1573 public void Start() 1573 public void Start()
1574 { 1574 {
1575 m_log.Info("[BASE HTTP SERVER]: Starting up HTTP Server");
1576 StartHTTP(); 1575 StartHTTP();
1577 } 1576 }
1578 1577
@@ -1580,7 +1579,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1580 { 1579 {
1581 try 1580 try
1582 { 1581 {
1583 m_log.Debug("[BASE HTTP SERVER]: Spawned main thread OK");
1584 //m_httpListener = new HttpListener(); 1582 //m_httpListener = new HttpListener();
1585 NotSocketErrors = 0; 1583 NotSocketErrors = 0;
1586 if (!m_ssl) 1584 if (!m_ssl)
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index cf417d7..cf3d6fa 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -30,7 +30,7 @@ namespace OpenSim
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.9CM"; 32 private const string VERSION_NUMBER = "0.6.9CM";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Post_Fixes;
34 34
35 public enum Flavour 35 public enum Flavour
36 { 36 {