本文整理汇总了C#中OpenSim.Region.Framework.Scenes.Scene.Backup方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.Backup方法的具体用法?C# Scene.Backup怎么用?C# Scene.Backup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Region.Framework.Scenes.Scene
的用法示例。
在下文中一共展示了Scene.Backup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RollbackRegion
/// <summary>
/// Retrieves the latest revision of a region in xml form,
/// converts it to scene object groups and scene presences,
/// swaps the current scene's entity list with the revision's list.
/// Note: Since deleted objects while
/// </summary>
public void RollbackRegion(Scene scene)
{
System.Collections.ArrayList xmllist = null;
SceneObjectGroup temp = null;
System.Collections.Hashtable deleteListUUIDs = new Hashtable();
// Dictionary<LLUUID, EntityBase> SearchList = new Dictionary<LLUUID,EntityBase>();
Dictionary<UUID, EntityBase> ReplacementList = new Dictionary<UUID,EntityBase>();
int revision = m_database.GetMostRecentRevision(scene.RegionInfo.RegionID);
// EntityBase[] searchArray;
xmllist = m_database.GetRegionObjectXMLList(scene.RegionInfo.RegionID, revision);
if (xmllist == null)
{
m_log.Info("[CMMODEL]: Region (" + scene.RegionInfo.RegionID + ") does not have given revision number (" + revision + ").");
return;
}
m_log.Info("[CMMODEL]: Region (" + scene.RegionInfo.RegionID + ") revision number (" + revision + ").");
m_log.Info("[CMMODEL]: Scene Objects = " + xmllist.Count);
m_log.Info("[CMMODEL]: Converting scene entities list to specified revision.");
m_log.ErrorFormat("[CMMODEL]: 1");
foreach (string xml in xmllist)
{
try
{
temp = SceneObjectSerializer.FromXml2Format(xml);
temp.SetScene(scene);
foreach (SceneObjectPart part in temp.Children.Values)
part.RegionHandle = scene.RegionInfo.RegionHandle;
ReplacementList.Add(temp.UUID, (EntityBase)temp);
}
catch (Exception e)
{
m_log.Info("[CMMODEL]: Error while creating replacement list for rollback: " + e);
}
}
//If in scene but not in revision and not a client, remove them
while (true)
{
try
{
foreach (EntityBase entity in scene.GetEntities())
{
if (entity == null)
continue;
if (entity is ScenePresence)
{
ReplacementList.Add(entity.UUID, entity);
continue;
}
else //if (!ReplacementList.ContainsKey(entity.UUID))
deleteListUUIDs.Add(entity.UUID, 0);
}
}
catch(Exception e)
{
m_log.ErrorFormat("[CMMODEL]: " + e);
deleteListUUIDs.Clear();
ReplacementList.Clear();
continue;
}
break;
}
foreach (UUID uuid in deleteListUUIDs.Keys)
{
try
{
// I thought that the DeleteGroup() function would handle all of this, but it doesn't. I'm not sure WHAT it handles.
((SceneObjectGroup)scene.Entities[uuid]).DetachFromBackup();
scene.PhysicsScene.RemovePrim(((SceneObjectGroup)scene.Entities[uuid]).RootPart.PhysActor);
scene.SendKillObject(scene.Entities[uuid].LocalId);
scene.SceneGraph.DeleteSceneObject(uuid, false);
((SceneObjectGroup)scene.Entities[uuid]).DeleteGroup(false);
}
catch(Exception e)
{
m_log.ErrorFormat("[CMMODEL]: Error while removing objects from scene: " + e);
}
}
lock (scene)
{
scene.Entities.Clear();
foreach (KeyValuePair<UUID,EntityBase> kvp in ReplacementList)
{
scene.Entities.Add(kvp.Value);
}
}
//.........这里部分代码省略.........