/// <summary>
        /// Creates a new snapshot from the given group
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public static SceneObjectGroupSnapshot FromSceneObjectGroup(SceneObjectGroup sog, SerializationFlags flags)
        {
            SceneObjectGroupSnapshot snapshot = new SceneObjectGroupSnapshot
            {
                RootPart = SceneObjectPartSnapshot.FromSceneObjectPart(sog.RootPart, flags)
            };

            SceneObjectPart[]         parts = sog.GetParts();
            SceneObjectPartSnapshot[] partsSnap;

            //do we have more than just the root?
            if (parts.Length > 1)
            {
                List <SceneObjectPartSnapshot> partsCollect = new List <SceneObjectPartSnapshot>();

                for (int i = 0; i < parts.Length; i++)
                {
                    SceneObjectPart part = parts[i];

                    if (!part.IsRootPart())
                    {
                        partsCollect.Add(SceneObjectPartSnapshot.FromSceneObjectPart(parts[i], flags));
                    }
                }

                partsSnap = partsCollect.ToArray();
            }
            else
            {
                //nope, just the root
                partsSnap = new SceneObjectPartSnapshot[0];
            }

            snapshot.ChildParts = partsSnap;

            if (sog.IsAttachment && sog.HasGroupChanged)
            {
                snapshot.TaintedAttachment = true;
            }
            else
            {
                snapshot.TaintedAttachment = false;
            }

            if (sog.IsAttachment && sog.IsTempAttachment)
            {
                snapshot.TempAttachment = true;
            }
            else
            {
                snapshot.TempAttachment = false;
            }


            return(snapshot);
        }
예제 #2
0
        public static CoalescedObjectSnapshot FromCoalescedObject(CoalescedObject csog, SerializationFlags flags)
        {
            List <Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot> > snapGroups
                = new List <Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot> >();

            foreach (var group in csog.Groups)
            {
                snapGroups.Add(
                    new Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot>(
                        SceneObjectGroupSnapshot.FromSceneObjectGroup(group, flags),
                        ItemPermissionBlockSnapshot.FromItemPermissionBlock(csog.FindPermissions(group.UUID)))
                    );
            }

            return(new CoalescedObjectSnapshot {
                GroupsWithPermissions = snapGroups.ToArray()
            });
        }
예제 #3
0
        public static CoalescedObjectSnapshot FromGroups(IEnumerable <Tuple <SceneObjectGroup, ItemPermissionBlock> > groups, SerializationFlags flags)
        {
            List <Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot> > snapGroups
                = new List <Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot> >();

            foreach (var group in groups)
            {
                snapGroups.Add(
                    new Tuple <SceneObjectGroupSnapshot, ItemPermissionBlockSnapshot>(
                        SceneObjectGroupSnapshot.FromSceneObjectGroup(group.Item1, flags),
                        ItemPermissionBlockSnapshot.FromItemPermissionBlock(group.Item2))
                    );
            }

            return(new CoalescedObjectSnapshot {
                GroupsWithPermissions = snapGroups.ToArray()
            });
        }
예제 #4
0
        /// <summary>
        /// Creates a new snapshot from the given group
        /// </summary>
        /// <param name="sog"></param>
        /// <returns></returns>
        public static SceneObjectGroupSnapshot FromSceneObjectGroup(SceneObjectGroup sog, SerializationFlags flags)
        {
            SceneObjectGroupSnapshot snapshot = new SceneObjectGroupSnapshot
            {
                RootPart = SceneObjectPartSnapshot.FromSceneObjectPart(sog.RootPart, flags)
            };

            var parts = sog.GetParts();
            SceneObjectPartSnapshot[] partsSnap;

            //do we have more than just the root?
            if (parts.Count > 1)
            {
                List<SceneObjectPartSnapshot> partsCollect = new List<SceneObjectPartSnapshot>();

                foreach (SceneObjectPart part in parts)
                {
                    if (!part.IsRootPart())
                    {
                        partsCollect.Add(SceneObjectPartSnapshot.FromSceneObjectPart(part, flags));
                    }
                }

                partsSnap = partsCollect.ToArray();
            }
            else
            {
                //nope, just the root
                partsSnap = new SceneObjectPartSnapshot[0];
            }

            snapshot.ChildParts = partsSnap;

            if (sog.IsAttachment && sog.HasGroupChanged)
            {
                snapshot.TaintedAttachment = true;
            }
            else
            {
                snapshot.TaintedAttachment = false;
            }

            if (sog.IsAttachment && sog.IsTempAttachment)
            {
                snapshot.TempAttachment = true;
            }
            else
            {
                snapshot.TempAttachment = false;
            }


            return snapshot;
        }
        /// <summary>
        /// Deserializes an OpenSim Xml2 serialized SceneObjectGroup into a SceneObjectGroupSnapshot
        /// </summary>
        /// <param name="xml">The XML blob representing the serialized object</param>
        /// <returns></returns>
        public SceneObjectGroupSnapshot SOGSnapshotFromOpenSimXml2(string xml)
        {
            dynamic osSog = m_fromXml2Method.Invoke(null, new object[] { xml });
            dynamic osRootPart = osSog.RootPart;

            SceneObjectPartSnapshot rootPartSnap = ConvertOpenSimPartToPartSnapshot(osRootPart);
            
            SceneObjectGroupSnapshot sshot = new SceneObjectGroupSnapshot();
            sshot.TaintedAttachment = false;
            sshot.TempAttachment = false;

            sshot.RootPart = rootPartSnap;

            return sshot;
        }