本文整理汇总了C#中OpenSim.Framework.AssetBase.Unpack方法的典型用法代码示例。如果您正苦于以下问题:C# AssetBase.Unpack方法的具体用法?C# AssetBase.Unpack怎么用?C# AssetBase.Unpack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Framework.AssetBase
的用法示例。
在下文中一共展示了AssetBase.Unpack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public override byte[] Handle(string path, Stream request,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
string body = GetBodyAsString(request);
OSDMap map = WebUtils.GetOSDMap(Util.Decompress(body));
IGridRegistrationService urlModule =
m_registry.RequestModuleInterface<IGridRegistrationService>();
if (m_SessionID != "" && urlModule != null)
if (!urlModule.CheckThreatLevel(m_SessionID, "Asset_Update", ThreatLevel.Full))
return new byte[0];
UUID newID;
if (map.ContainsKey("Method") && map["Method"] == "UpdateContent")
m_AssetService.UpdateContent(map["ID"].AsUUID(), map["Data"].AsBinary(), out newID);
else
{
AssetBase asset = new AssetBase();
asset = asset.Unpack(map);
newID = m_AssetService.Store(asset);
}
return Encoding.UTF8.GetBytes(newID.ToString());
}
示例2: LoadModuleFromArchive
//.........这里部分代码省略.........
else if (filePath.StartsWith ("newstylewater/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
terrainModule.TerrainWaterMap = ReadTerrain(data, scene);
}
else if (filePath.StartsWith ("newstylerevertwater/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
terrainModule.TerrainWaterRevertMap = ReadTerrain(data, scene);
}
#endregion
else if (filePath.StartsWith ("terrain/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
MemoryStream ms = new MemoryStream (data);
terrainModule.LoadFromStream (filePath, ms, 0, 0);
ms.Close ();
}
else if (filePath.StartsWith ("revertterrain/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
MemoryStream ms = new MemoryStream (data);
terrainModule.LoadRevertMapFromStream (filePath, ms, 0, 0);
ms.Close ();
}
else if (filePath.StartsWith ("water/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
MemoryStream ms = new MemoryStream (data);
terrainModule.LoadWaterFromStream (filePath, ms, 0, 0);
ms.Close ();
}
else if (filePath.StartsWith ("revertwater/"))
{
ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
MemoryStream ms = new MemoryStream (data);
terrainModule.LoadWaterRevertMapFromStream (filePath, ms, 0, 0);
ms.Close ();
}
else if (filePath.StartsWith ("entities/"))
{
MemoryStream ms = new MemoryStream (data);
SceneObjectGroup sceneObject = OpenSim.Region.Framework.Scenes.Serialization.SceneObjectSerializer.FromXml2Format (ref ms, scene);
ms.Close ();
ms = null;
data = null;
foreach(ISceneChildEntity part in sceneObject.ChildrenEntities())
{
if (!ResolveUserUuid (part.CreatorID))
part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (!ResolveUserUuid (part.OwnerID))
part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (!ResolveUserUuid (part.LastOwnerID))
part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
// Fix ownership/creator of inventory items
// Not doing so results in inventory items
// being no copy/no mod for everyone
lock (part.TaskInventory)
{
TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
{
if (!ResolveUserUuid (kvp.Value.OwnerID))
{
kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
}
if (!ResolveUserUuid (kvp.Value.CreatorID))
{
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
}
}
}
}
if(scene.SceneGraph.AddPrimToScene(sceneObject))
{
sceneObject.HasGroupChanged = true;
sceneObject.ScheduleGroupUpdate (PrimUpdateFlags.ForcedFullUpdate);
sceneObject.CreateScriptInstances(0, false, StateSource.RegionStart, UUID.Zero);
}
}
else if(filePath.StartsWith("assets/"))
{
if(m_loadAssets)
{
AssetBase asset = new AssetBase();
asset.Unpack(OSDParser.DeserializeJson(Encoding.UTF8.GetString(data)));
bool exists = scene.AssetService.Get(asset.IDString) != null;
if(!exists)
scene.AssetService.Store(asset);
}
}
}