当前位置: 首页>>代码示例>>C#>>正文


C# OSDArray.IndexOf方法代码示例

本文整理汇总了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;
        }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:79,代码来源:EventQueueService.cs


注:本文中的OSDArray.IndexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。