aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2009-11-26 12:08:20 +0000
committerMelanie2009-11-26 12:08:20 +0000
commit88842edc95bafeb9f3b2f2ea0ab09394028a0916 (patch)
tree17e8b01bf61004627c551345e9980cc6e4e27520 /OpenSim/Region/Framework
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC_OLD-88842edc95bafeb9f3b2f2ea0ab09394028a0916.zip
opensim-SC_OLD-88842edc95bafeb9f3b2f2ea0ab09394028a0916.tar.gz
opensim-SC_OLD-88842edc95bafeb9f3b2f2ea0ab09394028a0916.tar.bz2
opensim-SC_OLD-88842edc95bafeb9f3b2f2ea0ab09394028a0916.tar.xz
Remove GetAssemblyName and friends from the SE interface. It's now handled
internally
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScriptModule.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs93
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs30
4 files changed, 5 insertions, 125 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2c906a2..2998f45 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -185,12 +185,6 @@ namespace OpenSim.Region.Framework.Interfaces
185 List<UUID> GetInventoryList(); 185 List<UUID> GetInventoryList();
186 186
187 /// <summary> 187 /// <summary>
188 /// Get the names of the assemblies associated with scripts in this inventory.
189 /// </summary>
190 /// <returns></returns>
191 string[] GetScriptAssemblies();
192
193 /// <summary>
194 /// Get the xml representing the saved states of scripts in this inventory. 188 /// Get the xml representing the saved states of scripts in this inventory.
195 /// </summary> 189 /// </summary>
196 /// <returns> 190 /// <returns>
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 10835b9..72bb0f0 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -34,7 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces
34 { 34 {
35 string ScriptEngineName { get; } 35 string ScriptEngineName { get; }
36 36
37 string GetAssemblyName(UUID itemID);
38 string GetXMLState(UUID itemID); 37 string GetXMLState(UUID itemID);
39 bool CanBeDeleted(UUID itemID); 38 bool CanBeDeleted(UUID itemID);
40 39
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 3cec77f..9a6f2b8 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes
309 309
310 public string GetStateSnapshot() 310 public string GetStateSnapshot()
311 { 311 {
312 //m_log.Debug(" >>> GetStateSnapshot <<<");
313
314 List<string> assemblies = new List<string>();
315 Dictionary<UUID, string> states = new Dictionary<UUID, string>(); 312 Dictionary<UUID, string> states = new Dictionary<UUID, string>();
316 313
317 foreach (SceneObjectPart part in m_parts.Values) 314 foreach (SceneObjectPart part in m_parts.Values)
318 { 315 {
319 foreach (string a in part.Inventory.GetScriptAssemblies())
320 {
321 if (a != "" && !assemblies.Contains(a))
322 assemblies.Add(a);
323 }
324
325 foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) 316 foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates())
326 {
327 states[s.Key] = s.Value; 317 states[s.Key] = s.Value;
328 }
329 } 318 }
330 319
331 if (states.Count < 1 || assemblies.Count < 1) 320 if (states.Count < 1)
332 return ""; 321 return "";
333 322
334 XmlDocument xmldoc = new XmlDocument(); 323 XmlDocument xmldoc = new XmlDocument();
@@ -342,94 +331,21 @@ namespace OpenSim.Region.Framework.Scenes
342 331
343 xmldoc.AppendChild(rootElement); 332 xmldoc.AppendChild(rootElement);
344 333
345 XmlElement wrapper = xmldoc.CreateElement("", "Assemblies",
346 "");
347 334
348 rootElement.AppendChild(wrapper); 335 XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
349
350 foreach (string assembly in assemblies)
351 {
352 string fn = Path.GetFileName(assembly);
353 if (fn == String.Empty)
354 continue;
355
356 String filedata = String.Empty;
357
358 if (File.Exists(assembly+".text"))
359 {
360 FileInfo tfi = new FileInfo(assembly+".text");
361
362 if (tfi == null)
363 continue;
364
365 Byte[] tdata = new Byte[tfi.Length];
366
367 try
368 {
369 FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read);
370 tfs.Read(tdata, 0, tdata.Length);
371 tfs.Close();
372 }
373 catch (Exception e)
374 {
375 m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message);
376 }
377
378 filedata = new System.Text.ASCIIEncoding().GetString(tdata);
379 }
380 else
381 {
382 FileInfo fi = new FileInfo(assembly);
383
384 if (fi == null)
385 continue;
386
387 Byte[] data = new Byte[fi.Length];
388
389 try
390 {
391 FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read);
392 fs.Read(data, 0, data.Length);
393 fs.Close();
394 }
395 catch (Exception e)
396 {
397 m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message);
398 }
399
400 filedata = System.Convert.ToBase64String(data);
401 }
402 XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", "");
403 XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", "");
404 assemblyName.Value = fn;
405 assemblyData.Attributes.Append(assemblyName);
406
407 assemblyData.InnerText = filedata;
408
409 wrapper.AppendChild(assemblyData);
410 }
411
412 wrapper = xmldoc.CreateElement("", "ScriptStates",
413 ""); 336 "");
414 337
415 rootElement.AppendChild(wrapper); 338 rootElement.AppendChild(wrapper);
416 339
417 foreach (KeyValuePair<UUID, string> state in states) 340 foreach (KeyValuePair<UUID, string> state in states)
418 { 341 {
419 XmlElement stateData = xmldoc.CreateElement("", "State", "");
420
421 XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", "");
422 stateID.Value = state.Key.ToString();
423 stateData.Attributes.Append(stateID);
424
425 XmlDocument sdoc = new XmlDocument(); 342 XmlDocument sdoc = new XmlDocument();
426 sdoc.LoadXml(state.Value); 343 sdoc.LoadXml(state.Value);
427 XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); 344 XmlNodeList rootL = sdoc.GetElementsByTagName("State");
428 XmlNode rootNode = rootL[0]; 345 XmlNode rootNode = rootL[0];
429 346
430 XmlNode newNode = xmldoc.ImportNode(rootNode, true); 347 XmlNode newNode = xmldoc.ImportNode(rootNode, true);
431 stateData.AppendChild(newNode); 348 wrapper.AppendChild(newNode);
432 wrapper.AppendChild(stateData);
433 } 349 }
434 350
435 return xmldoc.InnerXml; 351 return xmldoc.InnerXml;
@@ -437,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes
437 353
438 public void SetState(string objXMLData, UUID RegionID) 354 public void SetState(string objXMLData, UUID RegionID)
439 { 355 {
356m_log.Debug("SetState called with " + objXMLData);
440 if (objXMLData == String.Empty) 357 if (objXMLData == String.Empty)
441 return; 358 return;
442 359
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index f4ca877..7f49ced 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -857,36 +857,6 @@ namespace OpenSim.Region.Framework.Scenes
857 return ret; 857 return ret;
858 } 858 }
859 859
860 public string[] GetScriptAssemblies()
861 {
862 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
863
864 List<string> ret = new List<string>();
865 if (engines == null) // No engine at all
866 return new string[0];
867
868 foreach (TaskInventoryItem item in m_items.Values)
869 {
870 if (item.InvType == (int)InventoryType.LSL)
871 {
872 foreach (IScriptModule e in engines)
873 {
874 if (e != null)
875 {
876 string n = e.GetAssemblyName(item.ItemID);
877 if (n != String.Empty)
878 {
879 if (!ret.Contains(n))
880 ret.Add(n);
881 break;
882 }
883 }
884 }
885 }
886 }
887 return ret.ToArray();
888 }
889
890 public Dictionary<UUID, string> GetScriptStates() 860 public Dictionary<UUID, string> GetScriptStates()
891 { 861 {
892 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 862 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();