本文整理汇总了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!");
}
}
}
示例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;
}