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