当前位置: 首页>>代码示例>>C#>>正文


C# ISceneEntity.BackupPreparation方法代码示例

本文整理汇总了C#中ISceneEntity.BackupPreparation方法的典型用法代码示例。如果您正苦于以下问题:C# ISceneEntity.BackupPreparation方法的具体用法?C# ISceneEntity.BackupPreparation怎么用?C# ISceneEntity.BackupPreparation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISceneEntity的用法示例。


在下文中一共展示了ISceneEntity.BackupPreparation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateKnownItem

        /// <summary>
        /// Update the attachment asset for the new sog details if they have changed.
        /// </summary>
        /// 
        /// This is essential for preserving attachment attributes such as permission.  Unlike normal scene objects,
        /// these details are not stored on the region.
        /// 
        /// <param name="remoteClient"></param>
        /// <param name="grp"></param>
        /// <param name="itemID"></param>
        /// <param name="agentID"></param>
        protected void UpdateKnownItem (IClientAPI remoteClient, ISceneEntity grp, UUID itemID, UUID agentID)
        {
            if (grp != null)
            {
                if (!grp.HasGroupChanged)
                {
                    //m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
                    return;
                }

                //let things like state saves and another async things be performed before we serialize the object
                grp.BackupPreparation();

                m_log.InfoFormat(
                    "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
                    grp.UUID, grp.GetAttachmentPoint());

                string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat((SceneObjectGroup)grp);

                InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
                item = m_scene.InventoryService.GetItem(item);

                if (item != null)
                {
                    AssetBase asset = new AssetBase(UUID.Random(), grp.Name,
                        AssetType.Object, remoteClient.AgentId);
                    asset.Description = grp.RootChild.Description;
                    asset.Data = Utils.StringToBytes(sceneObjectXml);
                    asset.ID = m_scene.AssetService.Store(asset);

                    if (item.Folder == UUID.Zero)
                    {
                        InventoryFolderBase folder = m_scene.InventoryService.GetFolderForType (remoteClient.AgentId, InventoryType.Unknown, AssetType.Object);
                        if (folder == null)
                            return;//Probably a non user (bot)
                        item.Folder = folder.ID;
                    }

                    item.AssetID = asset.ID;
                    item.Description = asset.Description;
                    item.Name = asset.Name;
                    item.AssetType = asset.Type;
                    item.InvType = (int)InventoryType.Object;

                    m_scene.InventoryService.UpdateItem(item);

                    // this gets called when the agent logs off!
                    if (remoteClient != null)
                        remoteClient.SendInventoryItemCreateUpdate(item, 0);
                }
                else
                {
                    m_log.Warn("[AttachmentModule]: Could not find inventory item for attachment to update!");
                }
            }
        }
开发者ID:Krazy-Bish-Margie,项目名称:Aurora-Sim,代码行数:67,代码来源:AttachmentsModule.cs

示例2: UpdateKnownItem

        /// <summary>
        ///     Update the attachment asset for the new sog details if they have changed.
        /// </summary>
        /// This is essential for preserving attachment attributes such as permission.  Unlike normal scene objects,
        /// these details are not stored on the region.
        /// <param name="remoteClient"></param>
        /// <param name="grp"></param>
        /// <param name="itemID"></param>
        /// <param name="agentID"></param>
        protected UUID UpdateKnownItem(IClientAPI remoteClient, ISceneEntity grp, UUID itemID, UUID agentID)
        {
            if (grp != null)
            {
                if (!grp.HasGroupChanged)
                {
                    //MainConsole.Instance.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
                    return UUID.Zero;
                }

                //let things like state saves and another async things be performed before we serialize the object
                grp.BackupPreparation();

                MainConsole.Instance.InfoFormat(
                    "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
                    grp.UUID, grp.GetAttachmentPoint());

                string sceneObjectXml = SceneEntitySerializer.SceneObjectSerializer.ToOriginalXmlFormat(grp);

                AssetBase asset = new AssetBase(UUID.Random(), grp.Name,
                                                AssetType.Object, remoteClient.AgentId)
                                      {
                                          Description = grp.RootChild.Description,
                                          Data = Utils.StringToBytes(sceneObjectXml)
                                      };
                asset.ID = m_scene.AssetService.Store(asset);

                m_scene.InventoryService.UpdateAssetIDForItem(itemID, asset.ID);

                // this gets called when the agent logs off!
                //remoteClient.SendInventoryItemCreateUpdate(item, 0);

                return asset.ID;
            }
            return UUID.Zero;
        }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:45,代码来源:AttachmentsModule.cs


注:本文中的ISceneEntity.BackupPreparation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。