本文整理汇总了C#中OSDMap.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# OSDMap.Clear方法的具体用法?C# OSDMap.Clear怎么用?C# OSDMap.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSDMap
的用法示例。
在下文中一共展示了OSDMap.Clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleFetchLib
public byte[] HandleFetchLib(Stream request, UUID AgentID)
{
try
{
//MainConsole.Instance.DebugFormat("[InventoryCAPS]: Received FetchLib request for {0}", AgentID);
OSDMap requestmap = (OSDMap) OSDParser.DeserializeLLSDXml(request);
OSDArray foldersrequested = (OSDArray) requestmap["items"];
OSDMap map = new OSDMap {{"agent_id", OSD.FromUUID(AgentID)}};
OSDArray items = new OSDArray();
foreach (OSDArray item in foldersrequested.Cast<OSDMap>().Select(requestedFolders => requestedFolders["item_id"].AsUUID()).Select(item_id => m_inventoryService.GetItem(UUID.Zero, item_id)).Where(item => item != null && item.Count > 0))
{
items.Add(item[0]);
}
map.Add("items", items);
byte[] response = OSDParser.SerializeLLSDXmlBytes(map);
map.Clear();
return response;
}
catch (Exception ex)
{
MainConsole.Instance.Warn("[InventoryCaps]: SERIOUS ISSUE! " + ex);
}
OSDMap rmap = new OSDMap();
rmap["items"] = new OSDArray();
return OSDParser.SerializeLLSDXmlBytes(rmap);
}
示例2: HandleFetchInventory
public byte[] HandleFetchInventory(Stream request, UUID AgentID)
{
try
{
//MainConsole.Instance.DebugFormat("[InventoryCAPS]: Received FetchInventory request for {0}", AgentID);
OSDMap requestmap = (OSDMap) OSDParser.DeserializeLLSDXml(request);
if (requestmap["items"].Type == OSDType.Unknown)
return MainServer.BadRequest;
OSDArray foldersrequested = (OSDArray) requestmap["items"];
OSDMap map = new OSDMap {{"agent_id", OSD.FromUUID(AgentID)}};
//We have to send the agent_id in the main map as well as all the items
OSDArray items = new OSDArray();
#if (!ISWIN)
foreach (OSDMap requestedFolders in foldersrequested)
{
UUID itemId = requestedFolders["item_id"].AsUUID();
OSDArray item = m_inventoryService.GetItem(itemId);
if (item != null && item.Count > 0)
{
items.Add(item[0]);
}
}
#else
foreach (OSDArray item in foldersrequested.Cast<OSDMap>().Select(requestedFolders => requestedFolders["item_id"].AsUUID()).Select(item_id => m_inventoryService.GetItem(item_id)).Where(item => item != null && item.Count > 0))
{
items.Add(item[0]);
}
#endif
map.Add("items", items);
byte[] response = OSDParser.SerializeLLSDXmlBytes(map);
map.Clear();
return response;
}
catch (Exception ex)
{
MainConsole.Instance.Warn("[InventoryCaps]: SERIOUS ISSUE! " + ex);
}
OSDMap rmap = new OSDMap();
rmap["items"] = new OSDArray();
return OSDParser.SerializeLLSDXmlBytes(rmap);
}
示例3: HandleFetchLib
public byte [] HandleFetchLib (Stream request, UUID agentID)
{
try {
//MainConsole.Instance.DebugFormat("[InventoryCAPS]: Received FetchLib request for {0}", agentID);
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml (HttpServerHandlerHelpers.ReadFully (request));
if (requestmap ["items"].Type == OSDType.Unknown) {
MainConsole.Instance.Error ("[InventoryCAPS]: Call to 'FetchLib' with missing 'items' parameter");
return MainServer.BadRequest;
}
OSDArray foldersrequested = (OSDArray)requestmap ["items"];
OSDMap map = new OSDMap { { "agent_id", OSD.FromUUID (agentID) } };
OSDArray items = new OSDArray ();
foreach (
OSDArray item in
foldersrequested.Cast<OSDMap> ()
.Select (requestedFolders => requestedFolders ["item_id"].AsUUID ())
.Select (item_id => m_inventoryService.GetOSDItem (UUID.Zero, item_id))
.Where (item => item != null && item.Count > 0)) {
items.Add (item [0]);
}
map.Add ("items", items);
byte [] response = OSDParser.SerializeLLSDXmlBytes (map);
map.Clear ();
return response;
} catch (Exception ex) {
MainConsole.Instance.Warn ("[InventoryCAPS]: SERIOUS ISSUE! " + ex);
}
OSDMap rmap = new OSDMap ();
rmap ["items"] = new OSDArray ();
return OSDParser.SerializeLLSDXmlBytes (rmap);
}
示例4: SerializeComponents
/// <summary>
/// Serialize all the registered Components into a string to be saved later
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>The serialized string</returns>
public string SerializeComponents (ISceneChildEntity obj)
{
OSDMap ComponentsBody = new OSDMap();
//Run through the list of components and serialize them
foreach (IComponent component in m_components.Values)
{
//Add the componet to the map by its name
OSD o = component.GetState(obj.UUID, true);
if(o != null && o.Type != OSDType.Unknown)
ComponentsBody.Add(component.Name, o);
}
string result = OSDParser.SerializeJsonString(ComponentsBody);
ComponentsBody.Clear();
return result;
}
示例5: SerializeComponents
/// <summary>
/// Serialize all the registered Components into a string to be saved later
/// </summary>
/// <param name="obj">The object to serialize</param>
/// <returns>The serialized string</returns>
public string SerializeComponents(SceneObjectPart obj)
{
OSDMap ComponentsBody = new OSDMap();
//Run through the list of components and serialize them
foreach (IComponent component in m_components.Values)
{
//Add the componet to the map by its name
OSD o = component.GetState(obj.UUID);
if(o != null)
ComponentsBody.Add(component.Name, o);
}
string result = OSDParser.SerializeJsonString(ComponentsBody);
ComponentsBody.Clear();
return result;
}