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


C# OSDMap.Clear方法代码示例

本文整理汇总了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);
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:31,代码来源:InventoryCAPS.cs

示例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);
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:45,代码来源:InventoryCAPS.cs

示例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);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:35,代码来源:InventoryCAPS.cs

示例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;
        }
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:21,代码来源:ComponentManager.cs

示例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;
        }
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:21,代码来源:ComponentManager.cs


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