本文整理汇总了C#中OSDArray.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# OSDArray.IndexOf方法的具体用法?C# OSDArray.IndexOf怎么用?C# OSDArray.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSDArray
的用法示例。
在下文中一共展示了OSDArray.IndexOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEvents
public Hashtable GetEvents(UUID requestID, UUID pAgentId, string request)
{
OSDMap events = new OSDMap();
try
{
OSD element;
lock (queue)
{
if (queue.Count == 0)
return NoEvents(requestID, pAgentId);
element = queue.Dequeue();
}
OSDArray array = new OSDArray();
if (element == null) // didn't have an event in 15s
{
//return NoEvents(requestID, pAgentId);
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
OSDMap keepAliveEvent = new OSDMap(2)
{{"body", new OSDMap()}, {"message", new OSDString("FAKEEVENT")}};
element = keepAliveEvent;
array.Add(keepAliveEvent);
//MainConsole.Instance.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
}
array.Add(element);
lock (queue)
{
while (queue.Count > 0)
{
array.Add(queue.Dequeue());
m_ids++;
}
}
int removeAt = -1;
//Look for disable Simulator EQMs so that we can disable ourselves safely
foreach (OSD ev in array)
{
try
{
if (ev.Type == OSDType.Map)
{
OSDMap map = (OSDMap) ev;
if (map.ContainsKey("message") && map["message"] == "DisableSimulator")
{
MainConsole.Instance.Debug("[EQService]: Sim Request to Disable Simulator " + m_service.RegionHandle);
removeAt = array.IndexOf(ev);
//This will be the last bunch of EQMs that go through, so we can safely die now
//Except that we can't do this, the client will freak if we do this
//m_service.ClientCaps.RemoveCAPS(m_service.RegionHandle);
}
}
}
catch
{
}
}
if (removeAt != -1)
array.RemoveAt(removeAt);
events.Add("events", array);
events.Add("id", new OSDInteger(m_ids));
m_ids++;
}
catch (Exception ex)
{
MainConsole.Instance.Warn("[EQS]: Exception! " + ex);
}
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200;
responsedata["content_type"] = "application/xml";
responsedata["keepalive"] = false;
responsedata["reusecontext"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//MainConsole.Instance.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata;
}