aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
diff options
context:
space:
mode:
authorCharles Krinke2008-04-07 13:50:05 +0000
committerCharles Krinke2008-04-07 13:50:05 +0000
commit927003de3364ac05a958a377d212ae0be82cc4a2 (patch)
tree5fa16fe74f73f877ef13692a92d36785edfa394f /OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
parent* I XmlIgnored the TaskInventory Property as a temporary measure. Taking th... (diff)
downloadopensim-SC_OLD-927003de3364ac05a958a377d212ae0be82cc4a2.zip
opensim-SC_OLD-927003de3364ac05a958a377d212ae0be82cc4a2.tar.gz
opensim-SC_OLD-927003de3364ac05a958a377d212ae0be82cc4a2.tar.bz2
opensim-SC_OLD-927003de3364ac05a958a377d212ae0be82cc4a2.tar.xz
Thank you kindly Diva & KMeisthax for adding the beginnings
of search capability to OpenSim in the form of a configurable module.
Diffstat (limited to 'OpenSim/Region/DataSnapshot/ObjectSnapshot.cs')
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
new file mode 100644
index 0000000..9222b48
--- /dev/null
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Xml;
5using System.Reflection;
6using OpenSim.Region.Environment.Scenes;
7using OpenSim.Framework;
8using libsecondlife;
9
10namespace OpenSim.Region.DataSnapshot
11{
12 public class ObjectSnapshot : IDataSnapshotProvider
13 {
14 private Scene m_scene = null;
15 private DataSnapshotManager m_parent = null;
16 private log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
17
18 public void Initialize(Scene scene, DataSnapshotManager parent)
19 {
20 m_scene = scene;
21 m_parent = parent;
22 }
23
24 public Scene GetParentScene
25 {
26 get { return m_scene; }
27 }
28
29 public XmlNode RequestSnapshotData(XmlDocument nodeFactory)
30 {
31 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
32 XmlNode node;
33#if LIBSL_IS_FIXED
34 foreach (EntityBase entity in m_scene.Entities.Values)
35 {
36 // only objects, not avatars
37 if (entity is SceneObjectGroup)
38 {
39 SceneObjectGroup obj = (SceneObjectGroup)entity;
40
41 XmlNode xmlobject = nodeFactory.CreateNode(XmlNodeType.Element, "object", "");
42
43 node = nodeFactory.CreateNode(XmlNodeType.Element, "uuid", "");
44 node.InnerText = obj.UUID.ToString();
45 xmlobject.AppendChild(node);
46
47 SceneObjectPart m_rootPart = null;
48 try
49 {
50 Type sog = typeof(SceneObjectGroup);
51 FieldInfo rootField = sog.GetField("m_rootPart", BindingFlags.NonPublic | BindingFlags.Instance);
52 if (rootField != null)
53 {
54 m_rootPart = (SceneObjectPart)rootField.GetValue(obj);
55 }
56 }
57 catch (Exception e)
58 {
59 Console.WriteLine("[DATASNAPSHOT] couldn't access field reflectively\n" + e.ToString());
60 }
61 if (m_rootPart != null)
62 {
63 node = nodeFactory.CreateNode(XmlNodeType.Element, "title", "");
64 node.InnerText = m_rootPart.Name;
65 xmlobject.AppendChild(node);
66
67 node = nodeFactory.CreateNode(XmlNodeType.Element, "description", "");
68 node.InnerText = m_rootPart.Description;
69 xmlobject.AppendChild(node);
70
71 node = nodeFactory.CreateNode(XmlNodeType.Element, "flags", "");
72 node.InnerText = String.Format("{0:x}", m_rootPart.ObjectFlags);
73 xmlobject.AppendChild(node);
74 }
75 parent.AppendChild(xmlobject);
76 }
77 }
78#endif
79 return parent;
80
81 }
82 }
83}