/// <summary>
        /// Move the next object in the queue to inventory.  Then delete it properly from the scene.
        /// </summary>
        /// <returns></returns>
        public bool InventoryDeQueueAndDelete()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                lock (m_inventoryDeletes)
                {
                    int left = m_inventoryDeletes.Count;
                    if (left > 0)
                    {
                        x = m_inventoryDeletes.Dequeue();
                    }
                }

                if (x != null)
                {
                    try
                    {
                        m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient);

                        if (x.permissionToDelete)
                        {
                            m_scene.DeleteSceneObjects(x.objectGroups, false);
                        }
                    }
                    catch (Exception e)
                    {
                        System.Text.StringBuilder objectNames = new System.Text.StringBuilder();
                        foreach (var obj in x.objectGroups)
                        {
                            objectNames.Append(obj.Name);
                            objectNames.Append(", ");
                        }

                        m_log.DebugFormat("[SCENE] Exception background sending object(s) {0}: {1}", objectNames.ToString(), e);
                    }

                    return(true);
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                m_log.ErrorFormat(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Move the next object in the queue to inventory.  Then delete it properly from the scene.
        /// </summary>
        /// <returns></returns>
        public bool InventoryDeQueueAndDelete()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                lock (m_inventoryDeletes)
                {
                    int left = m_inventoryDeletes.Count;
                    if (left > 0)
                    {
                        m_log.DebugFormat(
                            "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);

                        x = m_inventoryDeletes.Dequeue();

                        try
                        {
                            m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
                            if (x.permissionToDelete)
                            {
                                m_scene.DeleteSceneObject(x.objectGroup, false);
                            }
                        }
                        catch (Exception e)
                        {
                            m_log.DebugFormat("Exception background sending object: " + e);
                        }

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                // We can't put the object group details in here since the root part may have disappeared (which is where these sit).
                // FIXME: This needs to be fixed.
                m_log.ErrorFormat(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.remoteClient.Name : "unavailable"), (x != null ? x.remoteClient.AgentId.ToString() : "unavailable"), e.ToString());
            }

            m_log.Debug("[SCENE]: No objects left in inventory send queue.");
            return(false);
        }