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


C# StructuredData.OSDMap类代码示例

本文整理汇总了C#中OpenMetaverse.StructuredData.OSDMap的典型用法代码示例。如果您正苦于以下问题:C# OSDMap类的具体用法?C# OSDMap怎么用?C# OSDMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OSDMap类属于OpenMetaverse.StructuredData命名空间,在下文中一共展示了OSDMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParameterSet

 public ParameterSet()
 {
     m_params = new OMVSD.OSDMap();
     m_paramDescription = new OMVSD.OSDMap();
     ParamErrorMethod = paramErrorType.eNullValue;
     m_runtimeValues = new Dictionary<string, ParameterSetRuntimeValue>();
 }
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:7,代码来源:ParameterSet.cs

示例2: ProcessRequest

        protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
        {
//            m_log.DebugFormat("[GET_DISPLAY_NAMES]: called {0}", httpRequest.Url.Query);

            NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
            string[] ids = query.GetValues("ids");


            if (m_UserManagement == null)
            {
                m_log.Error("[GET_DISPLAY_NAMES]: Cannot fetch display names without a user management component");
                httpResponse.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
                return new byte[0];
            }

            OSDMap osdReply = new OSDMap();
            OSDArray agents = new OSDArray();

            osdReply["agents"] = agents;
            foreach (string id in ids)
            {
                UUID uuid = UUID.Zero;
                if (UUID.TryParse(id, out uuid))
                {
                    string name = m_UserManagement.GetUserName(uuid);
                    if (!string.IsNullOrEmpty(name))
                    {
                        string[] parts = name.Split(new char[] {' '});
                        OSDMap osdname = new OSDMap();
                        // a date that is valid
//                        osdname["display_name_next_update"] = OSD.FromDate(new DateTime(1970,1,1));
                        // but send one that blocks edition, since we actually don't suport this
                        osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));        
                        osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
                        osdname["display_name"] = OSD.FromString(name);
                        osdname["legacy_first_name"] = parts[0];
                        osdname["legacy_last_name"] = parts[1];
                        osdname["username"] = OSD.FromString(name);
                        osdname["id"] = OSD.FromUUID(uuid);
                        osdname["is_display_name_default"] = OSD.FromBoolean(true);

                        agents.Add(osdname);
                    }
                }
            }

            // Full content request
            httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
            //httpResponse.ContentLength = ??;
            httpResponse.ContentType = "application/llsd+xml";

            string reply = OSDParser.SerializeLLSDXmlString(osdReply);
            return System.Text.Encoding.UTF8.GetBytes(reply);

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:55,代码来源:GetDisplayNamesHandler.cs

示例3: DecodeMeshLODArray

        private static OSDArray DecodeMeshLODArray(byte[] data, long start, OSDMap meshMap)
        {
            int offset = meshMap["offset"].AsInteger() + (int)start;
            int size = meshMap["size"].AsInteger();

            if (offset < 0 || size == 0)
                return null; // no mesh data in asset

            try
            {
                using (MemoryStream inMs = new MemoryStream(data, offset, size))
                {
                    /*
                     * Skipping past the first two bytes, which are part of the zlib specification 
                     * (RFC 1950), not the deflate specification (RFC 1951). Those bytes contain 
                     * information about the compression method and flags.
                     */
                    int streamType = inMs.ReadByte();
                    int streamFlags = inMs.ReadByte();

                    using (MemoryStream outMs = new MemoryStream())
                    {
                        using (DeflateStream zOut = new DeflateStream(inMs, CompressionMode.Decompress))
                        {
                            zOut.CopyTo(outMs);
                            byte[] decompressedBuf = outMs.ToArray();
                            return OSDParser.DeserializeLLSDBinary(decompressedBuf) as OSDArray;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[MESH]: exception decoding OSD: {0}", e);
            }

            return null;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:38,代码来源:SceneObjectPartMeshCost.cs

示例4: GetDisplayable

 /// <summary>
 /// A statistics collection returns an OSD structure which is a map
 /// of maps. The top level map are the individual counters and
 /// their value is a map of the variables that make up the counter.
 /// </summary>
 /// <returns></returns>
 public OMVSD.OSDMap GetDisplayable()
 {
     OMVSD.OSDMap values = new OMVSD.OSDMap();
     foreach (ICounter cntr in m_counters) {
     try {
         OMVSD.OSDMap ivals = new OMVSD.OSDMap();
         ivals.Add("count", new OMVSD.OSDInteger((int)cntr.Count));
         if (cntr is IIntervalCounter) {
             IIntervalCounter icntr = (IIntervalCounter)cntr;
             ivals.Add("average", new OMVSD.OSDInteger((int)icntr.Average));
             ivals.Add("low", new OMVSD.OSDInteger((int)icntr.Low));
             ivals.Add("high", new OMVSD.OSDInteger((int)icntr.High));
             ivals.Add("last", new OMVSD.OSDInteger((int)icntr.Last));
             ivals.Add("total", new OMVSD.OSDInteger((int)icntr.Total));
         }
         values.Add(cntr.Name, ivals);
     }
     catch (Exception e) {
         Logging.LogManager.Log.Log(LookingGlass.Framework.Logging.LogLevel.DBADERROR,
             "FAILURE getting Displayable value: n={0}, {1}", cntr.Name, e.ToString());
     }
     }
     return values;
 }
开发者ID:Misterblue,项目名称:LookingGlass-Viewer,代码行数:30,代码来源:StatisticManager.cs

示例5: RequestMapItemsAsync

        /// <summary>
        /// Does the actual remote mapitem request
        /// This should be called from an asynchronous thread
        /// Request failures get blacklisted until region restart so we don't
        /// continue to spend resources trying to contact regions that are down.
        /// </summary>
        /// <param name="httpserver">blank string, we discover this in the process</param>
        /// <param name="id">Agent ID that we are making this request on behalf</param>
        /// <param name="flags">passed in from packet</param>
        /// <param name="EstateID">passed in from packet</param>
        /// <param name="godlike">passed in from packet</param>
        /// <param name="itemtype">passed in from packet</param>
        /// <param name="regionhandle">Region we're looking up</param>
        /// <returns></returns>
        private OSDMap RequestMapItemsAsync(UUID id, uint flags,
            uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
        {
//            m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype);

            string httpserver = "";
            bool blacklisted = false;
            lock (m_blacklistedregions)
            {
                if (m_blacklistedregions.ContainsKey(regionhandle))
                {
                    if (Environment.TickCount > (m_blacklistedregions[regionhandle] + blacklistTimeout))
                    {
                        m_log.DebugFormat("[WORLD MAP]: Unblock blacklisted region {0}", regionhandle);

                        m_blacklistedregions.Remove(regionhandle);
                    }
                    else
                        blacklisted = true;
                }
            }

            if (blacklisted)
                return new OSDMap();

            UUID requestID = UUID.Random();
            lock (m_cachedRegionMapItemsAddress)
            {
                if (m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                    httpserver = m_cachedRegionMapItemsAddress[regionhandle];
            }
            if (httpserver.Length == 0)
            {
                uint x = 0, y = 0;
                Util.RegionHandleToWorldLoc(regionhandle, out x, out y);
                GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);

                if (mreg != null)
                {
                    httpserver = mreg.ServerURI + "MAP/MapItems/" + regionhandle.ToString();
                    lock (m_cachedRegionMapItemsAddress)
                    {
                        if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                            m_cachedRegionMapItemsAddress.Add(regionhandle, httpserver);
                    }
                }
                else
                {
                    lock (m_blacklistedregions)
                    {
                        if (!m_blacklistedregions.ContainsKey(regionhandle))
                            m_blacklistedregions.Add(regionhandle, Environment.TickCount);
                    }
                    //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
                }
            }

            blacklisted = false;
            lock (m_blacklistedurls)
            {
                if (m_blacklistedurls.ContainsKey(httpserver))
                {
                    if (Environment.TickCount > (m_blacklistedurls[httpserver] + blacklistTimeout))
                    {
                        m_log.DebugFormat("[WORLD MAP]: Unblock blacklisted URL {0}", httpserver);

                        m_blacklistedurls.Remove(httpserver);
                    }
                    else
                        blacklisted = true;
                }
            }

            // Can't find the http server
            if (httpserver.Length == 0 || blacklisted)
                return new OSDMap();

            MapRequestState mrs = new MapRequestState();
            mrs.agentID = id;
            mrs.EstateID = EstateID;
            mrs.flags = flags;
            mrs.godlike = godlike;
            mrs.itemtype=itemtype;
            mrs.regionhandle = regionhandle;

            lock (m_openRequests)
//.........这里部分代码省略.........
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:101,代码来源:WorldMapModule.cs

示例6: UpdateAgentInformation

        public string UpdateAgentInformation(string request, string path,
                string param, IOSHttpRequest httpRequest,
                IOSHttpResponse httpResponse)
        {
//            OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
            OSDMap resp = new OSDMap();

            OSDMap accessPrefs = new OSDMap();
            accessPrefs["max"] = "A";

            resp["access_prefs"] = accessPrefs;

            string response = OSDParser.SerializeLLSDXmlString(resp);
            return response; 
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:15,代码来源:BunchOfCaps.cs

示例7: ResourceCostSelected

        public string ResourceCostSelected(string request, string path,
                string param, IOSHttpRequest httpRequest,
                IOSHttpResponse httpResponse)
        {
            OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
            OSDMap resp = new OSDMap();


            float phys=0;
            float stream=0;
            float simul=0;

            if (req.ContainsKey("selected_roots"))
            {
                OSDArray object_ids = (OSDArray)req["selected_roots"];

                // should go by SOG suming costs for all parts
                // ll v3 works ok with several objects select we get the list and adds ok
                // FS calls per object so results are wrong guess fs bug
                for (int i = 0; i < object_ids.Count; i++)
                {
                    UUID uuid = object_ids[i].AsUUID();
                    float Physc;
                    float simulc;
                    float streamc;

                    SceneObjectGroup grp = m_Scene.GetGroupByPrim(uuid);
                    if (grp != null)
                    {
                        grp.GetSelectedCosts(out Physc, out streamc, out simulc);
                        phys += Physc;
                        stream += streamc;
                        simul += simulc;
                    }
                }
            }
            else if (req.ContainsKey("selected_prims"))
            {
                OSDArray object_ids = (OSDArray)req["selected_prims"];

                // don't see in use in any of the 2 viewers
                // guess it should be for edit linked but... nothing
                // should go to SOP per part
                for (int i = 0; i < object_ids.Count; i++)
                {
                    UUID uuid = object_ids[i].AsUUID();

                    SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
                    if (part != null)
                    {
                        phys += part.PhysicsCost;
                        stream += part.StreamingCost;
                        simul += part.SimulationCost;
                    }
                }
            }

            OSDMap object_data = new OSDMap();

            object_data["physics"] = phys;
            object_data["streaming"] = stream;
            object_data["simulation"] = simul;

            resp["selected"] = object_data;
//            resp["transaction_id"] = "undef";
            string response = OSDParser.SerializeLLSDXmlString(resp);
            return response; 
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:68,代码来源:BunchOfCaps.cs

示例8: GetObjectCost

        public string GetObjectCost(string request, string path,
                string param, IOSHttpRequest httpRequest,
                IOSHttpResponse httpResponse)
        {          
            OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
            OSDMap resp = new OSDMap();

            OSDArray object_ids = (OSDArray)req["object_ids"];

            for (int i = 0; i < object_ids.Count; i++)
            {
                UUID uuid = object_ids[i].AsUUID();
                                
                SceneObjectPart part = m_Scene.GetSceneObjectPart(uuid);
                SceneObjectGroup grp = null;
                if (part != null)
                    grp = part.ParentGroup;
                if (grp != null)
                {
                    float linksetCost;
                    float linksetPhysCost;
                    float partCost;
                    float partPhysCost;

                    grp.GetResourcesCosts(part,out linksetCost,out linksetPhysCost,out partCost,out partPhysCost);

                    OSDMap object_data = new OSDMap();
                    object_data["linked_set_resource_cost"] = linksetCost;
                    object_data["resource_cost"] = partCost;
                    object_data["physics_cost"] = partPhysCost;
                    object_data["linked_set_physics_cost"] = linksetPhysCost;
                    object_data["resource_limiting_type"] = "legacy";
                    resp[uuid.ToString()] = object_data;
                }
            }
            if(resp.Count == 0)
            {
                OSDMap object_data = new OSDMap();
                object_data["linked_set_resource_cost"] = 0;
                object_data["resource_cost"] = 0;
                object_data["physics_cost"] = 0;
                object_data["linked_set_physics_cost"] = 0;
                resp[UUID.Zero.ToString()] = object_data;
            }
            string response = OSDParser.SerializeLLSDXmlString(resp);
            return response; 
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:47,代码来源:BunchOfCaps.cs

示例9: RequestMapItemsAsync

        /// <summary>
        /// Does the actual remote mapitem request
        /// This should be called from an asynchronous thread
        /// Request failures get blacklisted until region restart so we don't
        /// continue to spend resources trying to contact regions that are down.
        /// </summary>
        /// <param name="httpserver">blank string, we discover this in the process</param>
        /// <param name="id">Agent ID that we are making this request on behalf</param>
        /// <param name="flags">passed in from packet</param>
        /// <param name="EstateID">passed in from packet</param>
        /// <param name="godlike">passed in from packet</param>
        /// <param name="itemtype">passed in from packet</param>
        /// <param name="regionhandle">Region we're looking up</param>
        /// <returns></returns>
        private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags,
            uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
        {
            bool blacklisted = false;
            lock (m_blacklistedregions)
            {
                if (m_blacklistedregions.ContainsKey(regionhandle))
                    blacklisted = true;
            }

            if (blacklisted)
                return new OSDMap();

            UUID requestID = UUID.Random();
            lock (m_cachedRegionMapItemsAddress)
            {
                if (m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                    httpserver = m_cachedRegionMapItemsAddress[regionhandle];
            }
            if (httpserver.Length == 0)
            {
                uint x = 0, y = 0;
                Utils.LongToUInts(regionhandle, out x, out y);
                GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); 

                if (mreg != null)
                {
                    httpserver = "http://" + mreg.ExternalEndPoint.Address.ToString() + ":" + mreg.HttpPort + "/MAP/MapItems/" + regionhandle.ToString();
                    lock (m_cachedRegionMapItemsAddress)
                    {
                        if (!m_cachedRegionMapItemsAddress.ContainsKey(regionhandle))
                            m_cachedRegionMapItemsAddress.Add(regionhandle, httpserver);
                    }
                }
                else
                {
                    lock (m_blacklistedregions)
                    {
                        if (!m_blacklistedregions.ContainsKey(regionhandle))
                            m_blacklistedregions.Add(regionhandle, Environment.TickCount);
                    }
                    m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
                }
            }

            blacklisted = false;
            lock (m_blacklistedurls)
            {
                if (m_blacklistedurls.ContainsKey(httpserver))
                    blacklisted = true;
            }

            // Can't find the http server
            if (httpserver.Length == 0 || blacklisted)
                return new OSDMap();

            MapRequestState mrs = new MapRequestState();
            mrs.agentID = id;
            mrs.EstateID = EstateID;
            mrs.flags = flags;
            mrs.godlike = godlike;
            mrs.itemtype=itemtype;
            mrs.regionhandle = regionhandle;

            lock (m_openRequests)
                m_openRequests.Add(requestID, mrs);

            WebRequest mapitemsrequest = WebRequest.Create(httpserver);
            mapitemsrequest.Method = "POST";
            mapitemsrequest.ContentType = "application/xml+llsd";
            OSDMap RAMap = new OSDMap();

            // string RAMapString = RAMap.ToString();
            OSD LLSDofRAMap = RAMap; // RENAME if this works

            byte[] buffer = OSDParser.SerializeLLSDXmlBytes(LLSDofRAMap);
            OSDMap responseMap = new OSDMap();
            responseMap["requestID"] = OSD.FromUUID(requestID);

            Stream os = null;
            try
            { // send the Post
                mapitemsrequest.ContentLength = buffer.Length;   //Count bytes to send
                os = mapitemsrequest.GetRequestStream();
                os.Write(buffer, 0, buffer.Length);         //Send it
                os.Close();
//.........这里部分代码省略.........
开发者ID:gumho,项目名称:diva-distribution,代码行数:101,代码来源:WorldMapModule.cs

示例10: OnSimulatorFeaturesRequest

        private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
        {
            m_log.DebugFormat("[SPECIAL UI]: OnSimulatorFeaturesRequest in {0}", m_scene.RegionInfo.RegionName);
            if (m_Helper.ShouldSend(agentID) && m_Helper.UserLevel(agentID) <= m_UserLevel)
            {
                OSDMap extrasMap;
                OSDMap specialUI = new OSDMap();
                using (StreamReader s = new StreamReader(Path.Combine(VIEWER_SUPPORT_DIR, "panel_toolbar.xml")))
                {
                    if (features.ContainsKey("OpenSimExtras"))
                        extrasMap = (OSDMap)features["OpenSimExtras"];
                    else
                    {
                        extrasMap = new OSDMap();
                        features["OpenSimExtras"] = extrasMap;
                    }

                    specialUI["toolbar"] = OSDMap.FromString(s.ReadToEnd());
                    extrasMap["special-ui"] = specialUI;
                }
                m_log.DebugFormat("[SPECIAL UI]: Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);

                if (Directory.Exists(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters")))
                {
                    OSDMap floaters = new OSDMap();
                    uint n = 0;
                    foreach (String name in Directory.GetFiles(Path.Combine(VIEWER_SUPPORT_DIR, "Floaters"), "*.xml"))
                    {
                        using (StreamReader s = new StreamReader(name))
                        {
                            string simple_name = Path.GetFileNameWithoutExtension(name);
                            OSDMap floater = new OSDMap();
                            floaters[simple_name] = OSDMap.FromString(s.ReadToEnd());
                            n++;
                        }
                    }
                    specialUI["floaters"] = floaters;
                    m_log.DebugFormat("[SPECIAL UI]: Sending {0} floaters", n);
                }
            }
            else
                m_log.DebugFormat("[SPECIAL UI]: NOT Sending panel_toolbar.xml in {0}", m_scene.RegionInfo.RegionName);

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:44,代码来源:SpecialUIModule.cs

示例11: HandleRemoteMapItemRequest

        public OSD HandleRemoteMapItemRequest(string path, OSD request, IPEndPoint endpoint)
        {
            uint xstart = 0;
            uint ystart = 0;

            Utils.LongToUInts(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);

            OSDMap responsemap = new OSDMap();
            OSDMap responsemapdata = new OSDMap();
            int tc = Environment.TickCount;

            List<ScenePresence> avatars = m_scene.GetAvatars();
            OSDArray responsearr = new OSDArray(avatars.Count);

            if (avatars.Count == 0)
            {
                responsemapdata = new OSDMap();
                responsemapdata["X"] = OSD.FromInteger((int)(xstart + 1));
                responsemapdata["Y"] = OSD.FromInteger((int)(ystart + 1));
                responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
                responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
                responsemapdata["Extra"] = OSD.FromInteger(0);
                responsemapdata["Extra2"] = OSD.FromInteger(0);
                responsearr.Add(responsemapdata);

                responsemap["6"] = responsearr;
            }
            else
            {
                responsearr = new OSDArray(avatars.Count);
                foreach (ScenePresence av in avatars)
                {
                    Vector3 avpos;
                    if (av.HasSafePosition(out avpos))
                    {
                        responsemapdata = new OSDMap();
                        responsemapdata["X"] = OSD.FromInteger((int)(xstart + avpos.X));
                        responsemapdata["Y"] = OSD.FromInteger((int)(ystart + avpos.Y));
                        responsemapdata["ID"] = OSD.FromUUID(UUID.Zero);
                        responsemapdata["Name"] = OSD.FromString(Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()));
                        responsemapdata["Extra"] = OSD.FromInteger(1);
                        responsemapdata["Extra2"] = OSD.FromInteger(0);
                        responsearr.Add(responsemapdata);
                    }
                }
                responsemap["6"] = responsearr;
            }
            return responsemap;
        }
开发者ID:BogusCurry,项目名称:halcyon,代码行数:49,代码来源:WorldMapModule.cs

示例12: OnSimulatorFeaturesRequest

        private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features)
        {
            OSD menus = new OSDMap();
            if (features.ContainsKey("menus"))
                menus = features["menus"];

            OSDMap agent = new OSDMap();
            OSDMap world = new OSDMap();
            OSDMap tools = new OSDMap();
            OSDMap advanced = new OSDMap();
            OSDMap admin = new OSDMap();
            if (((OSDMap)menus).ContainsKey("agent"))
                agent = (OSDMap)((OSDMap)menus)["agent"];
            if (((OSDMap)menus).ContainsKey("world"))
                world = (OSDMap)((OSDMap)menus)["world"];
            if (((OSDMap)menus).ContainsKey("tools"))
                tools = (OSDMap)((OSDMap)menus)["tools"];
            if (((OSDMap)menus).ContainsKey("advanced"))
                advanced = (OSDMap)((OSDMap)menus)["advanced"];
            if (((OSDMap)menus).ContainsKey("admin"))
                admin = (OSDMap)((OSDMap)menus)["admin"];

            if (m_menuItems.ContainsKey(UUID.Zero))
            {
                foreach (MenuItemData d in m_menuItems[UUID.Zero])
                {
                    if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID)))
                        continue;

                    OSDMap loc = null;
                    switch (d.Location)
                    {
                    case InsertLocation.Agent:
                        loc = agent;
                        break;
                    case InsertLocation.World:
                        loc = world;
                        break;
                    case InsertLocation.Tools:
                        loc = tools;
                        break;
                    case InsertLocation.Advanced:
                        loc = advanced;
                        break;
                    case InsertLocation.Admin:
                        loc = admin;
                        break;
                    }

                    if (loc == null)
                        continue;
                    
                    loc[d.Title] = OSD.FromString(d.Title);
                }
            }

            if (m_menuItems.ContainsKey(agentID))
            {
                foreach (MenuItemData d in m_menuItems[agentID])
                {
                    if (d.Mode == UserMode.God && (!m_scene.Permissions.IsGod(agentID)))
                        continue;

                    OSDMap loc = null;
                    switch (d.Location)
                    {
                    case InsertLocation.Agent:
                        loc = agent;
                        break;
                    case InsertLocation.World:
                        loc = world;
                        break;
                    case InsertLocation.Tools:
                        loc = tools;
                        break;
                    case InsertLocation.Advanced:
                        loc = advanced;
                        break;
                    case InsertLocation.Admin:
                        loc = admin;
                        break;
                    }

                    if (loc == null)
                        continue;
                    
                    loc[d.Title] = OSD.FromString(d.Title);
                }
            }


            ((OSDMap)menus)["agent"] = agent;
            ((OSDMap)menus)["world"] = world;
            ((OSDMap)menus)["tools"] = tools;
            ((OSDMap)menus)["advanced"] = advanced;
            ((OSDMap)menus)["admin"] = admin;

            features["menus"] = menus;
        }
开发者ID:RadaSangOn,项目名称:workCore2,代码行数:99,代码来源:DynamicMenuModule.cs

示例13: PrimListToOSD

        /// <summary>
        /// Converts a list of primitives to an object that can be serialized
        /// with the LLSD system
        /// </summary>
        /// <param name="prims">Primitives to convert to a serializable object</param>
        /// <returns>An object that can be serialized with LLSD</returns>
        public static StructuredData.OSD PrimListToOSD(List<Primitive> prims)
        {
            StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(prims.Count);

            for (int i = 0; i < prims.Count; i++)
                map.Add(prims[i].LocalID.ToString(), prims[i].GetOSD());

            return map;
        }
开发者ID:TooheyPaneer,项目名称:libopenmetaverse,代码行数:15,代码来源:Helpers.cs

示例14: invokeRezAvatarCap

        private OSDMap invokeRezAvatarCap(OSDMap responseMap, string CapAddress, OGPState userState)
        {
            Scene reg = GetRootScene();

            WebRequest DeRezRequest = WebRequest.Create(CapAddress);
            DeRezRequest.Method = "POST";
            DeRezRequest.ContentType = "application/xml+llsd";

            OSDMap RAMap = new OSDMap();
            OSDMap AgentParms = new OSDMap();
            OSDMap RegionParms = new OSDMap();

            OSDArray Parameter = new OSDArray(2);

            OSDMap version = new OSDMap();
            version["version"] = OSD.FromInteger(userState.src_version);
            Parameter.Add(version);

            OSDMap SrcData = new OSDMap();
            SrcData["estate_id"] = OSD.FromInteger(reg.RegionInfo.EstateSettings.EstateID);
            SrcData["parent_estate_id"] = OSD.FromInteger((reg.RegionInfo.EstateSettings.ParentEstateID == 100 ? 1 : reg.RegionInfo.EstateSettings.ParentEstateID));
            SrcData["region_id"] = OSD.FromUUID(reg.RegionInfo.originRegionID);
            SrcData["visible_to_parent"] = OSD.FromBoolean(userState.visible_to_parent);
            Parameter.Add(SrcData);

            AgentParms["first_name"] = OSD.FromString(userState.first_name);
            AgentParms["last_name"] = OSD.FromString(userState.last_name);
            AgentParms["agent_id"] = OSD.FromUUID(userState.agent_id);
            RegionParms["region_id"] = OSD.FromUUID(userState.region_id);
            AgentParms["circuit_code"] = OSD.FromInteger(userState.circuit_code);
            AgentParms["secure_session_id"] = OSD.FromUUID(userState.secure_session_id);
            AgentParms["session_id"] = OSD.FromUUID(userState.session_id);
            AgentParms["agent_access"] = OSD.FromBoolean(userState.agent_access);
            AgentParms["god_level"] = OSD.FromInteger(userState.god_level);
            AgentParms["god_overide"] = OSD.FromBoolean(userState.god_overide);
            AgentParms["identified"] = OSD.FromBoolean(userState.identified);
            AgentParms["transacted"] = OSD.FromBoolean(userState.transacted);
            AgentParms["age_verified"] = OSD.FromBoolean(userState.age_verified);
            AgentParms["limited_to_estate"] = OSD.FromInteger(userState.limited_to_estate);
            AgentParms["inventory_host"] = OSD.FromString(userState.inventory_host);

            // version 1
            RAMap = AgentParms;

            // Planned for version 2
            // RAMap["agent_params"] = AgentParms;

            RAMap["region_params"] = RegionParms;
            RAMap["parameter"] = Parameter;

            string RAMapString = RAMap.ToString();
            m_log.InfoFormat("[OGP] RAMap string {0}", RAMapString);
            OSD LLSDofRAMap = RAMap; // RENAME if this works

            m_log.InfoFormat("[OGP]: LLSD of map as string  was {0}", LLSDofRAMap.ToString());
            //m_log.InfoFormat("[OGP]: LLSD+XML: {0}", LLSDParser.SerializeXmlString(LLSDofRAMap));
            byte[] buffer = OSDParser.SerializeLLSDXmlBytes(LLSDofRAMap);

            //string bufferDump = System.Text.Encoding.ASCII.GetString(buffer);
            //m_log.InfoFormat("[OGP]: buffer form is {0}",bufferDump);
            //m_log.InfoFormat("[OGP]: LLSD of map was {0}",buffer.Length);

            Stream os = null;
            try
            { // send the Post
                DeRezRequest.ContentLength = buffer.Length;   //Count bytes to send
                os = DeRezRequest.GetRequestStream();
                os.Write(buffer, 0, buffer.Length);         //Send it
                os.Close();
                m_log.InfoFormat("[OGP]: Derez Avatar Posted Rez Avatar request to remote sim {0}", CapAddress);
            }
            catch (WebException ex)
            {
                m_log.InfoFormat("[OGP] Bad send on de_rez_avatar {0}", ex.Message);
                responseMap["connect"] = OSD.FromBoolean(false);

                return responseMap;
            }

            m_log.Info("[OGP] waiting for a reply after rez avatar send");
            string rez_avatar_reply = null;
            { // get the response
                try
                {
                    WebResponse webResponse = DeRezRequest.GetResponse();
                    if (webResponse == null)
                    {
                        m_log.Info("[OGP:] Null reply on rez_avatar post");
                    }

                    StreamReader sr = new StreamReader(webResponse.GetResponseStream());
                    rez_avatar_reply = sr.ReadToEnd().Trim();
                    m_log.InfoFormat("[OGP]: rez_avatar reply was {0} ", rez_avatar_reply);

                }
                catch (WebException ex)
                {
                    m_log.InfoFormat("[OGP]: exception on read after send of rez avatar {0}", ex.Message);
                    responseMap["connect"] = OSD.FromBoolean(false);

//.........这里部分代码省略.........
开发者ID:N3X15,项目名称:VoxelSim,代码行数:101,代码来源:OpenGridProtocolModule.cs

示例15: DerezAvatarMethod

        public OSD DerezAvatarMethod(string path, OSD request)
        {
            m_log.ErrorFormat("DerezPath: {0}, Request: {1}", path, request.ToString());

            //LLSD llsdResponse = null;
            OSDMap responseMap = new OSDMap();

            string[] PathArray = path.Split('/');
            m_log.InfoFormat("[OGP]: prefix {0}, uuid {1}, suffix {2}", PathArray[1], PathArray[2], PathArray[3]);
            string uuidString = PathArray[2];
            m_log.InfoFormat("[OGP]: Request to Derez avatar with UUID {0}", uuidString);
            UUID userUUID = UUID.Zero;
            if (UUID.TryParse(uuidString, out userUUID))
            {
                UUID RemoteID = (UUID)uuidString;
                UUID LocalID = RemoteID;
                // FIXME: TODO: Routine to map RemoteUUIDs to LocalUUIds
                //         would be done already..  but the client connects with the Aditi UUID
                //         regardless over the UDP stack

                OGPState userState = GetOGPState(LocalID);
                if (userState.agent_id != UUID.Zero)
                {
                    //OSDMap outboundRequestMap = new OSDMap();
                    OSDMap inboundRequestMap = (OSDMap)request;
                    string rezAvatarString = inboundRequestMap["rez_avatar"].AsString();
                    if (rezAvatarString.Length == 0)
                    {
                        rezAvatarString = inboundRequestMap["rez_avatar/rez"].AsString();
                    }
                    OSDArray LookAtArray = new OSDArray();
                    LookAtArray.Add(OSD.FromInteger(1));
                    LookAtArray.Add(OSD.FromInteger(1));
                    LookAtArray.Add(OSD.FromInteger(1));

                    OSDArray PositionArray = new OSDArray();
                    PositionArray.Add(OSD.FromInteger(128));
                    PositionArray.Add(OSD.FromInteger(128));
                    PositionArray.Add(OSD.FromInteger(40));

                    OSDArray lookArray = new OSDArray();
                    lookArray.Add(OSD.FromInteger(128));
                    lookArray.Add(OSD.FromInteger(128));
                    lookArray.Add(OSD.FromInteger(40));

                    responseMap["connect"] = OSD.FromBoolean(true);// it's okay to give this user up
                    responseMap["look_at"] = LookAtArray;

                    m_log.WarnFormat("[OGP]: Invoking rez_avatar on host:{0} for avatar: {1} {2}", rezAvatarString, userState.first_name, userState.last_name);

                    OSDMap rezResponseMap = invokeRezAvatarCap(responseMap, rezAvatarString,userState);

                    // If invoking it returned an error, parse and end
                    if (rezResponseMap.ContainsKey("connect"))
                    {
                        if (rezResponseMap["connect"].AsBoolean() == false)
                        {
                            return responseMap;
                        }
                    }

                    string rezRespSeedCap = "";

                    // DEPRECATED
                    if (rezResponseMap.ContainsKey("seed_capability"))
                        rezRespSeedCap = rezResponseMap["seed_capability"].AsString();
                    
                    // REPLACEMENT
                    if (rezResponseMap.ContainsKey("region_seed_capability"))
                        rezRespSeedCap = rezResponseMap["region_seed_capability"].AsString();

                    // REPLACEMENT
                    if (rezResponseMap.ContainsKey("rez_avatar/rez"))
                        rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString();

                    // DEPRECATED
                    string rezRespSim_ip = rezResponseMap["sim_ip"].AsString();
                    
                    string rezRespSim_host = rezResponseMap["sim_host"].AsString();

                    int rrPort = rezResponseMap["sim_port"].AsInteger();
                    int rrX = rezResponseMap["region_x"].AsInteger();
                    int rrY = rezResponseMap["region_y"].AsInteger();
                    m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY);
                    UUID rrRID = rezResponseMap["region_id"].AsUUID();
                    OSDArray RezResponsePositionArray = null;
                    string rrAccess = rezResponseMap["sim_access"].AsString();
                    if (rezResponseMap.ContainsKey("position"))
                    {
                        RezResponsePositionArray = (OSDArray)rezResponseMap["position"];
                    }
                    // DEPRECATED
                    responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap);
                    
                    // REPLACEMENT r3
                    responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap);

                    // DEPRECATED
                    responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString());
                    
//.........这里部分代码省略.........
开发者ID:N3X15,项目名称:VoxelSim,代码行数:101,代码来源:OpenGridProtocolModule.cs


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