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


C# OSDMap.ContainsKey方法代码示例

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


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

示例1: UnpackData

        protected override void UnpackData(OSDMap args, AgentDestinationData d, Hashtable request)
        {
            base.UnpackData(args, d, request);
            ExtendedAgentDestinationData data = (ExtendedAgentDestinationData)d;
            try
            {
                if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
                    data.host = args["gatekeeper_host"].AsString();
                if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
                    Int32.TryParse(args["gatekeeper_port"].AsString(), out data.port);
                if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] != null)
                    data.gatekeeperServerURI = args["gatekeeper_serveruri"];
                if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] != null)
                    data.destinationServerURI = args["destination_serveruri"];

            }
            catch (InvalidCastException)
            {
                m_log.ErrorFormat("[HOME AGENT HANDLER]: Bad cast in UnpackData");
            }

            string callerIP = GetCallerIP(request);
            // Verify if this call came from the login server
            if (callerIP == m_LoginServerIP)
                data.fromLogin = true;

        }
开发者ID:AkiraSonoda,项目名称:akisim,代码行数:27,代码来源:HomeAgentHandlers.cs

示例2: Unpack

        public void Unpack(OSDMap args)
        {
            if (args["point"] != null)
                AttachPoint = args["point"].AsInteger();

            ItemID = args.ContainsKey("item") ? args["item"].AsUUID() : UUID.Zero;
            AssetID = args.ContainsKey("asset") ? args["asset"].AsUUID() : UUID.Zero;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:8,代码来源:AvatarAttachment.cs

示例3: FromOSD

        public override void FromOSD(OSDMap map)
        {
            AgentInfo = new IAgentInfo();
            AgentInfo.FromOSD((OSDMap) (map["AgentInfo"]));
            UserAccount = new UserAccount();
            UserAccount.FromOSD((OSDMap)(map["UserAccount"]));
            if (!map.ContainsKey("ActiveGroup"))
                ActiveGroup = null;
            else
            {
                ActiveGroup = new GroupMembershipData();
                ActiveGroup.FromOSD((OSDMap)(map["ActiveGroup"]));
            }

            GroupMemberships = ((OSDArray) map["GroupMemberships"]).ConvertAll<GroupMembershipData>((o) =>
                                                                                                        {
                                                                                                            GroupMembershipData
                                                                                                                group =
                                                                                                                    new GroupMembershipData
                                                                                                                        ();
                                                                                                            group
                                                                                                                .FromOSD
                                                                                                                ((OSDMap
                                                                                                                 ) o);
                                                                                                            return group;
                                                                                                        });
            OfflineMessages = ((OSDArray) map["OfflineMessages"]).ConvertAll<GridInstantMessage>((o) =>
                                                                                                     {
                                                                                                         GridInstantMessage
                                                                                                             group =
                                                                                                                 new GridInstantMessage
                                                                                                                     ();
                                                                                                         group.FromOSD(
                                                                                                             (OSDMap) o);
                                                                                                         return group;
                                                                                                     });
            MuteList = ((OSDArray) map["MuteList"]).ConvertAll<MuteList>((o) =>
                                                                             {
                                                                                 MuteList group = new MuteList();
                                                                                 group.FromOSD((OSDMap) o);
                                                                                 return group;
                                                                             });

            if (map.ContainsKey("Appearance"))
            {
                Appearance = new AvatarAppearance();
                Appearance.FromOSD((OSDMap)map["Appearance"]);
            }

            if (map.ContainsKey("FriendOnlineStatuses"))
                FriendOnlineStatuses = ((OSDArray)map["FriendOnlineStatuses"]).ConvertAll<UUID>((o) => { return o; });

            if (map.ContainsKey("Friends"))
                Friends = ((OSDArray)map["Friends"]).ConvertAll<FriendInfo>((o) =>
                { 
                    FriendInfo f = new FriendInfo();
                    f.FromOSD((OSDMap)o);
                    return f; 
                });
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:60,代码来源:ISimulationService.cs

示例4: OnMessageReceived

        /// <summary>
        ///     Region side
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an AgentStatusChange
            if (message.ContainsKey("Method") && message["Method"] == "UpdateAvatarAppearance")
            {
                var appearance = new AvatarAppearance(message["AgentID"], (OSDMap)message["Appearance"]);
                ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();

                if (manager != null)
                {
                    foreach (IScene scene in manager.Scenes)
                    {
                        IScenePresence sp = scene.GetScenePresence(appearance.Owner);
                        if (sp != null && !sp.IsChildAgent)
                        {
                            var avappmodule = sp.RequestModuleInterface<IAvatarAppearanceModule>();
                            if (avappmodule != null)
                            {
                                avappmodule.Appearance = appearance;
                                avappmodule.SendAppearanceToAgent(sp);
                                avappmodule.SendAppearanceToAllOtherAgents();
                            }
                        }
                    }
                }
            }

            return null;
        }
开发者ID:VirtualReality,项目名称:Universe,代码行数:34,代码来源:AppearanceProcessing.cs

示例5: GetParcelsByRegion

        OSDMap GetParcelsByRegion (OSDMap map)
        {
            var resp = new OSDMap ();
            resp ["Parcels"] = new OSDArray ();
            resp ["Total"] = OSD.FromInteger (0);

            var directory = DataPlugins.RequestPlugin<IDirectoryServiceConnector> ();

            if (directory != null && map.ContainsKey ("Region") == true) {
                UUID regionID = UUID.Parse (map ["Region"]);
                UUID scopeID = map.ContainsKey ("ScopeID") ? UUID.Parse (map ["ScopeID"].ToString ()) : UUID.Zero;
                UUID owner = map.ContainsKey ("Owner") ? UUID.Parse (map ["Owner"].ToString ()) : UUID.Zero;
                uint start = map.ContainsKey ("Start") ? uint.Parse (map ["Start"].ToString ()) : 0;
                uint count = map.ContainsKey ("Count") ? uint.Parse (map ["Count"].ToString ()) : 10;
                ParcelFlags flags = map.ContainsKey ("Flags") ? (ParcelFlags)int.Parse (map ["Flags"].ToString ()) : ParcelFlags.None;
                ParcelCategory category = map.ContainsKey ("Category") ? (ParcelCategory)uint.Parse (map ["Flags"].ToString ()) : ParcelCategory.Any;
                uint total = directory.GetNumberOfParcelsByRegion (regionID, owner, flags, category);

                if (total > 0) {
                    resp ["Total"] = OSD.FromInteger ((int)total);
                    if (count == 0) {
                        return resp;
                    }
                    List<LandData> regionParcels = directory.GetParcelsByRegion (start, count, regionID, owner, flags, category);
                    OSDArray parcels = new OSDArray (regionParcels.Count);
                    regionParcels.ForEach (delegate (LandData parcel) {
                        parcels.Add (LandData2WebOSD (parcel));
                    });
                    resp ["Parcels"] = parcels;
                }
            }

            return resp;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:34,代码来源:ParcelAPI.cs

示例6: UnpackUpdateMessage

 public void UnpackUpdateMessage(OSDMap args)
 {
     if (args.ContainsKey("animation"))
         animID = args["animation"].AsUUID();
     if (args.ContainsKey("object_id"))
         objectID = args["object_id"].AsUUID();
     if (args.ContainsKey("seq_num"))
         sequenceNum = args["seq_num"].AsInteger();
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:9,代码来源:Animation.cs

示例7: GetGroups

        OSDMap GetGroups (OSDMap map)
        {
            var resp = new OSDMap ();
            var start = map.ContainsKey ("Start") ? map ["Start"].AsUInteger () : 0;
            resp ["Start"] = start;
            resp ["Total"] = 0;

            var groups = DataPlugins.RequestPlugin<IGroupsServiceConnector> ();
            var Groups = new OSDArray ();

            if (groups != null) {
                var sort = new Dictionary<string, bool> ();
                var boolFields = new Dictionary<string, bool> ();

                if (map.ContainsKey ("Sort") && map ["Sort"].Type == OSDType.Map) {
                    var fields = (OSDMap)map ["Sort"];
                    foreach (string field in fields.Keys) {
                        sort [field] = int.Parse (fields [field]) != 0;
                    }
                }
                if (map.ContainsKey ("BoolFields") && map ["BoolFields"].Type == OSDType.Map) {
                    var fields = (OSDMap)map ["BoolFields"];
                    foreach (string field in fields.Keys) {
                        boolFields [field] = int.Parse (fields [field]) != 0;
                    }
                }
                var reply = groups.GetGroupRecords (
                    AdminAgentID,
                    start,
                    map.ContainsKey ("Count") ? map ["Count"].AsUInteger () : 10,
                    sort,
                    boolFields
                );
                if (reply.Count > 0) {
                    foreach (GroupRecord groupReply in reply) {
                        Groups.Add (GroupRecord2OSDMap (groupReply));
                    }
                }
                resp ["Total"] = groups.GetNumberOfGroups (AdminAgentID, boolFields);
            }

            resp ["Groups"] = Groups;
            return resp;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:44,代码来源:GroupAPI.cs

示例8: LocalSimulationServiceConnector_OnMessageReceived

 OSDMap LocalSimulationServiceConnector_OnMessageReceived(OSDMap message)
 {
     if (!message.ContainsKey("Method"))
         return null;
     switch (message["Method"].AsString())
     {
         case "CreateAgentRequest":
             CreateAgentRequest createAgentRequest = new CreateAgentRequest();
             createAgentRequest.FromOSD(message);
             CreateAgentResponse createAgentResponse = new CreateAgentResponse();
             createAgentResponse.Success = CreateAgent(createAgentRequest.Destination, createAgentRequest.CircuitData, createAgentRequest.TeleportFlags, out createAgentResponse);
             return createAgentResponse.ToOSD();
         case "UpdateAgentPositionRequest":
             UpdateAgentPositionRequest updateAgentPositionRequest = new UpdateAgentPositionRequest();
             updateAgentPositionRequest.FromOSD(message);
             return new OSDMap() { new KeyValuePair<string, OSD>("Success", UpdateAgent(updateAgentPositionRequest.Destination, updateAgentPositionRequest.Update)) };
         case "UpdateAgentDataRequest":
             UpdateAgentDataRequest updateAgentDataRequest = new UpdateAgentDataRequest();
             updateAgentDataRequest.FromOSD(message);
             return new OSDMap() { new KeyValuePair<string, OSD>("Success", UpdateAgent(updateAgentDataRequest.Destination, updateAgentDataRequest.Update)) };
         case "FailedToMoveAgentIntoNewRegionRequest":
             FailedToMoveAgentIntoNewRegionRequest failedToMoveAgentIntoNewRegionRequest = new FailedToMoveAgentIntoNewRegionRequest();
             failedToMoveAgentIntoNewRegionRequest.FromOSD(message);
             FailedToMoveAgentIntoNewRegion(failedToMoveAgentIntoNewRegionRequest.AgentID, failedToMoveAgentIntoNewRegionRequest.RegionID);
             break;
         case "CloseAgentRequest":
             CloseAgentRequest closeAgentRequest = new CloseAgentRequest();
             closeAgentRequest.FromOSD(message);
             CloseAgent(closeAgentRequest.Destination, closeAgentRequest.AgentID);
             break;
         case "MakeChildAgentRequest":
             MakeChildAgentRequest makeChildAgentRequest = new MakeChildAgentRequest();
             makeChildAgentRequest.FromOSD(message);
             MakeChildAgent(makeChildAgentRequest.AgentID, makeChildAgentRequest.Destination, makeChildAgentRequest.IsCrossing);
             break;
         case "FailedToTeleportAgentRequest":
             FailedToTeleportAgentRequest failedToTeleportAgentRequest = new FailedToTeleportAgentRequest();
             failedToTeleportAgentRequest.FromOSD(message);
             FailedToTeleportAgent(failedToTeleportAgentRequest.Destination, failedToTeleportAgentRequest.FailedRegionID,
                 failedToTeleportAgentRequest.AgentID, failedToTeleportAgentRequest.Reason, failedToTeleportAgentRequest.IsCrossing);
             break;
         case "RetrieveAgentRequest":
             RetrieveAgentRequest retrieveAgentRequest = new RetrieveAgentRequest();
             retrieveAgentRequest.FromOSD(message);
             RetrieveAgentResponse retrieveAgentResponse = new RetrieveAgentResponse();
             retrieveAgentResponse.Success = RetrieveAgent(retrieveAgentRequest.Destination, retrieveAgentRequest.AgentID, retrieveAgentRequest.AgentIsLeaving,
                 out retrieveAgentResponse.AgentData, out retrieveAgentResponse.CircuitData);
             return retrieveAgentResponse.ToOSD();
         case "CreateObjectRequest":
             CreateObjectRequest createObjectRequest = new CreateObjectRequest();
             createObjectRequest.Scene = Scene;
             createObjectRequest.FromOSD(message);
             return new OSDMap() { new KeyValuePair<string, OSD>("Success", CreateObject(createObjectRequest.Destination, createObjectRequest.Object)) };
     }
     return null;
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:56,代码来源:LocalSimulationServiceConnector.cs

示例9: BuildPacket

        /// <summary>
        /// Attempts to convert an LLSD structure to a known Packet type
        /// </summary>
        /// <param name="capsEventName">Event name, this must match an actual
        /// packet name for a Packet to be successfully built</param>
        /// <param name="body">LLSD to convert to a Packet</param>
        /// <returns>A Packet on success, otherwise null</returns>
        public static Packet BuildPacket(string capsEventName, OSDMap body)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            // Check if we have a subclass of packet with the same name as this event
            Type type = assembly.GetType("OpenMetaverse.Packets." + capsEventName + "Packet", false);
            if (type == null)
                return null;

            Packet packet = null;

            try
            {
                // Create an instance of the object
                packet = (Packet)Activator.CreateInstance(type);

                // Iterate over all of the fields in the packet class, looking for matches in the LLSD
                foreach (FieldInfo field in type.GetFields())
                {
                    if (body.ContainsKey(field.Name))
                    {
                        Type blockType = field.FieldType;

                        if (blockType.IsArray)
                        {
                            OSDArray array = (OSDArray)body[field.Name];
                            Type elementType = blockType.GetElementType();
                            object[] blockArray = (object[])Array.CreateInstance(elementType, array.Count);

                            for (int i = 0; i < array.Count; i++)
                            {
                                OSDMap map = (OSDMap)array[i];
                                blockArray[i] = ParseLLSDBlock(map, elementType);
                            }

                            field.SetValue(packet, blockArray);
                        }
                        else
                        {
                            OSDMap map = (OSDMap)((OSDArray)body[field.Name])[0];
                            field.SetValue(packet, ParseLLSDBlock(map, blockType));
                        }
                    }
                }
            }
            catch (Exception)
            {
                //FIXME Logger.Log(e.Message, Helpers.LogLevel.Error, e);
            }

            return packet;
        }
开发者ID:TooheyPaneer,项目名称:libopenmetaverse,代码行数:59,代码来源:CapsToPacket.cs

示例10: OnMessageReceived

        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //If it is an async message request, make sure that the request is valid and check it
            if (message["Method"] == "AsyncMessageRequest")
            {
                try
                {
                    ICapsService service = m_registry.RequestModuleInterface<ICapsService>();
                    OSDMap response = new OSDMap();
                    OSDMap mapresponse = new OSDMap();

                    if (message.ContainsKey("RegionHandles"))
                    {
                        OSDArray handles = (OSDArray)message["RegionHandles"];

                        for (int i = 0; i < handles.Count; i += 2)
                        {
                            ulong regionHandle = handles[i].AsULong();
                            IRegionCapsService region = service.GetCapsForRegion(regionHandle);
                            if (region != null)
                            {
                                bool verified = (region.Region.SessionID == handles[i + 1].AsUUID());
                                if (verified)
                                {
                                    if (m_regionMessages.ContainsKey(regionHandle))
                                    {
                                        //Get the array, then remove it
                                        OSDArray array = m_regionMessages[regionHandle];
                                        m_regionMessages.Remove(regionHandle);
                                        mapresponse[regionHandle.ToString()] = array;
                                    }
                                }
                            }
                        }
                    }

                    response["Messages"] = mapresponse;
                    return response;
                }
                catch
                {
                }
            }
            return null;
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:45,代码来源:RemoteAsyncMessagePostService.cs

示例11: AvatarClassifiedsRequest

 /// <summary>
 /// Request avatar's classified ads.
 /// </summary>
 /// <returns>
 /// An array containing all the calassified uuid and it's name created by the creator id
 /// </returns>
 /// <param name='json'>
 /// Our parameters are in the OSDMap json["params"]
 /// </param>
 /// <param name='response'>
 /// If set to <c>true</c> response.
 /// </param>
 public bool AvatarClassifiedsRequest(OSDMap json, ref JsonRpcResponse response)
 {
     if(!json.ContainsKey("params"))
     {
         response.Error.Code = ErrorCode.ParseError;
         m_log.DebugFormat ("Classified Request");
         return false;
     }
     
     OSDMap request = (OSDMap)json["params"];
     UUID creatorId = new UUID(request["creatorId"].AsString());
     
     
     OSDArray data = (OSDArray) Service.AvatarClassifiedsRequest(creatorId);
     response.Result = data;
     
     return true;
 }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:30,代码来源:UserProfilesHandlers.cs

示例12: FromOSD

 public override void FromOSD (OSDMap map)
 {
     State = map["State"].AsString ();
     Source = map["Source"].AsString ();
     ItemID = map["ItemID"].AsUUID ();
     Running = map["Running"].AsBoolean ();
     Disabled = map["Disabled"].AsBoolean ();
     Variables = map["Variables"].AsString ();
     Plugins = (OSDMap)map["Plugins"];
     PermsGranter = map["PermsGranter"].AsUUID ();
     PermsMask = map["PermsMask"].AsInteger ();
     MinEventDelay = map["MinEventDelay"].AsReal ();
     AssemblyName = map["AssemblyName"].AsString ();
     UserInventoryID = map["UserInventoryID"].AsUUID ();
     TargetOmegaWasSet = map["TargetOmegaWasSet"].AsBoolean ();
     if(map.ContainsKey("Compiled"))
         Compiled = map["Compiled"].AsBoolean ();
 }
开发者ID:RevolutionSmythe,项目名称:Aurora-Sim,代码行数:18,代码来源:StateSave.cs

示例13: OnMessageReceived

 /// <summary>
 ///     Region side
 /// </summary>
 /// <param name="message"></param>
 /// <returns></returns>
 protected OSDMap OnMessageReceived(OSDMap message)
 {
     //We need to check and see if this is an AgentStatusChange
     if (message.ContainsKey("Method") && message["Method"] == "UpdateAvatarAppearance")
     {
         AvatarAppearance appearance = new AvatarAppearance(message["AgentID"], (OSDMap)message["Appearance"]);
         ISceneManager manager = m_registry.RequestModuleInterface<ISceneManager>();
         if (manager != null && manager.Scene != null)
         {
             IAvatarFactory factory = manager.Scene.RequestModuleInterface<IAvatarFactory>();
             IScenePresence sp = manager.Scene.GetScenePresence(appearance.Owner);
             sp.RequestModuleInterface<IAvatarAppearanceModule>().Appearance = appearance;
             sp.RequestModuleInterface<IAvatarAppearanceModule>().SendAppearanceToAgent(sp);
             sp.RequestModuleInterface<IAvatarAppearanceModule>().SendAppearanceToAllOtherAgents();
         }
     }
     return null;
 }
开发者ID:samiam123,项目名称:sam2Aurora,代码行数:23,代码来源:AppearanceProcessing.cs

示例14: GetRegions

        OSDMap GetRegions (OSDMap map)
        {
            OSDMap resp = new OSDMap ();
            RegionFlags type = map.Keys.Contains ("RegionFlags") ? (RegionFlags)map ["RegionFlags"].AsInteger () : RegionFlags.RegionOnline;
            int start = map.Keys.Contains ("Start") ? map ["Start"].AsInteger () : 0;
            if (start < 0) {
                start = 0;
            }
            int count = map.Keys.Contains ("Count") ? map ["Count"].AsInteger () : 10;
            if (count < 0) {
                count = 1;
            }

            var regiondata = DataPlugins.RequestPlugin<IRegionData> ();

            Dictionary<string, bool> sort = new Dictionary<string, bool> ();

            string [] supportedSort = {
                "SortRegionName",
                "SortLocX",
                "SortLocY"
            };

            foreach (string sortable in supportedSort) {
                if (map.ContainsKey (sortable)) {
                    sort [sortable.Substring (4)] = map [sortable].AsBoolean ();
                }
            }

            List<GridRegion> regions = regiondata.Get (type, sort);
            OSDArray Regions = new OSDArray ();
            if (start < regions.Count) {
                int i = 0;
                int j = regions.Count <= (start + count) ? regions.Count : (start + count);
                for (i = start; i < j; ++i) {
                    Regions.Add (regions [i].ToOSD ());
                }
            }
            resp ["Start"] = OSD.FromInteger (start);
            resp ["Count"] = OSD.FromInteger (count);
            resp ["Total"] = OSD.FromInteger (regions.Count);
            resp ["Regions"] = Regions;
            return resp;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:44,代码来源:RegionAPI.cs

示例15: FromOSD

 public override void FromOSD(OSDMap map)
 {
     AgentInfo = new IAgentInfo();
     AgentInfo.FromOSD((OSDMap)(map["AgentInfo"]));
     UserAccount = new UserAccount();
     UserAccount.FromOSD((OSDMap)(map["UserAccount"]));
     if (!map.ContainsKey("ActiveGroup"))
         ActiveGroup = null;
     else
     {
         ActiveGroup = new GroupMembershipData();
         ActiveGroup.FromOSD((OSDMap)(map["ActiveGroup"]));
     }
     GroupMemberships = ((OSDArray)map["GroupMemberships"]).ConvertAll<GroupMembershipData>((o) => 
         {
             GroupMembershipData group = new GroupMembershipData();
             group.FromOSD((OSDMap)o);
             return group;
         });
 }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:20,代码来源:ISimulationService.cs


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