• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OSDMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Charge

 public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately)
 {
     IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
     if (moneyModule != null)
     {
         if (chargeImmediately)
         {
             bool success = moneyModule.Charge(agentID, amount, text, type);
             if (!success)
                 return false;
         }
         IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
         if (scheduler != null)
         {
             OSDMap itemInfo = new OSDMap();
             itemInfo.Add("AgentID", agentID);
             itemInfo.Add("Amount", amount);
             itemInfo.Add("Text", text);
             itemInfo.Add("Type", (int)type);
             SchedulerItem item = new SchedulerItem("ScheduledPayment " + identifer,
                                                    OSDParser.SerializeJsonString(itemInfo), false,
                                                    DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID);
             itemInfo.Add("SchedulerID", item.id);
             scheduler.Save(item);
         }
     }
     return true;
 }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:28,代码来源:ScheduledPayments.cs


示例2: Charge

        public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge)
        {
            IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
            if (moneyModule != null)
            {
                bool success = moneyModule.Charge(agentID, amount, text);
                if (!success)
                    return false;
                IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
                if (scheduler != null)
                {
                    OSDMap itemInfo = new OSDMap();
                    itemInfo.Add("AgentID", agentID);
                    itemInfo.Add("Amount", amount);
                    itemInfo.Add("Text", text);
                    SchedulerItem item = new SchedulerItem("ScheduledPayment",
                        OSDParser.SerializeJsonString(itemInfo), false,
                        DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now);
                    itemInfo.Add("SchedulerID", item.id);
                    scheduler.Save(item);

                }
            }
            return true;
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:25,代码来源:ScheduledCurrencyTransferModule.cs


示例3: GetAbuseReports

        OSDMap GetAbuseReports (OSDMap map)
        {
            var resp = new OSDMap ();
            var areports = m_registry.RequestModuleInterface<IAbuseReports> ();

            int start = map ["Start"].AsInteger ();
            int count = map ["Count"].AsInteger ();
            bool active = map ["Active"].AsBoolean ();

            List<AbuseReport> arList = areports.GetAbuseReports (start, count, active);
            var AbuseReports = new OSDArray ();

            if (arList != null) {
                foreach (AbuseReport rpt in arList) {
                    AbuseReports.Add (rpt.ToOSD ());
                }
            }

            resp ["AbuseReports"] = AbuseReports;
            resp ["Start"] = OSD.FromInteger (start);
            resp ["Count"] = OSD.FromInteger (count); 
            resp ["Active"] = OSD.FromBoolean (active);

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


示例4: AddNewUrls

        public virtual void AddNewUrls(string key, OSDMap urls)
        {
            m_autoConfig.Remove("ServerURI");
            foreach (KeyValuePair<string, OSD> kvp in urls)
            {
                if (kvp.Value == "" && kvp.Value.Type != OSDType.Array)
                    continue;
                if (!m_autoConfig.ContainsKey(kvp.Key))
                {
                    if (kvp.Value.Type == OSDType.String)
                        m_autoConfig[kvp.Key] = kvp.Value;
                    else if (kvp.Value.Type != OSDType.Boolean) // "Success" coming from IWC
                        m_autoConfig[kvp.Key] = string.Join(",", ((OSDArray)kvp.Value).ConvertAll<string>((osd) => osd).ToArray());
                }
                else
                {
                    List<string> keys = kvp.Value.Type == OSDType.Array ? ((OSDArray)kvp.Value).ConvertAll<string>((osd) => osd) : new List<string>(new string[1] { kvp.Value.AsString() });

                    foreach (string url in keys)
                    {
                        //Check to see whether the base URLs are the same (removes the UUID at the end)
                        if (url.Length < 36)
                            continue; //Not a URL
                        string u = url.Remove(url.Length - 36, 36);
                        if (!m_autoConfig[kvp.Key].AsString().Contains(u))
                            m_autoConfig[kvp.Key] = m_autoConfig[kvp.Key] + "," + kvp.Value;
                    }
                }
            }
            m_allConfigs[key] = urls;
        }
开发者ID:andsim,项目名称:Aurora-Sim,代码行数:31,代码来源:ConfigurationService.cs


示例5: PostToService

 /// <summary>
 ///     POST URL-encoded form data to a web service that returns LLSD or
 ///     JSON data
 /// </summary>
 public static string PostToService (string url, OSDMap data)
 {
     byte [] buffer = data != null ? Encoding.UTF8.GetBytes (OSDParser.SerializeJsonString (data, true)) : null;
     Task<byte []> t = ServiceOSDRequest (url, buffer, "POST", m_defaultTimeout);
     t.Wait ();
     return t.Result == null ? null : Encoding.UTF8.GetString (t.Result);
 }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:11,代码来源:WebUtils.cs


示例6: SimulatorFeaturesCAP

        private Hashtable SimulatorFeaturesCAP(Hashtable mDhttpMethod)
        {
            OSDMap data = new OSDMap();
            data["MeshRezEnabled"] = true;
            data["MeshUploadEnabled"] = true;
            data["MeshXferEnabled"] = true;
            data["PhysicsMaterialsEnabled"] = true;


            OSDMap typesMap = new OSDMap();

            typesMap["convex"] = true;
            typesMap["none"] = true;
            typesMap["prim"] = true;

            data["PhysicsShapeTypes"] = typesMap;


            //Data URLS need sent as well
            //Not yet...
            //data["DataUrls"] = m_service.Registry.RequestModuleInterface<IGridRegistrationService> ().GetUrlForRegisteringClient (m_service.AgentID + "|" + m_service.RegionHandle);

            //Send back data
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
            return responsedata;
        }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:30,代码来源:SimulatorFeatures.cs


示例7: AddGeneric

        public static bool AddGeneric(UUID ownerID, string type, string key, OSDMap map, string m_ServerURI)
        {
            string value = OSDParser.SerializeJsonString(map);

            NameValueCollection RequestArgs = new NameValueCollection
            {
                { "RequestMethod", "AddGeneric" },
                { "OwnerID", ownerID.ToString() },
                { "Type", type },
                { "Key", key },
                { "Value", value}
            };


            OSDMap Response = CachedPostRequest(RequestArgs, m_ServerURI);
            if (Response["Success"].AsBoolean())
            {
                return true;
            }
            else
            {
                //m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: Error {0}, {1}, {2}, {3}", ownerID, type, key, Response["Message"]);
                return false;
            }
        }
开发者ID:WordfromtheWise,项目名称:Aurora,代码行数:25,代码来源:SimianUtils.cs


示例8: FireMessageReceived

        public OSDMap FireMessageReceived(string SessionID, OSDMap message)
        {
            OSDMap result = null;
            ulong reg;
            if (ulong.TryParse(SessionID, out reg)) //Local region
            {
                if (OnMessageReceived != null)
                {
                    MessageReceived eventCopy = OnMessageReceived;
                    foreach (OSDMap r in from MessageReceived messagedelegate in eventCopy.GetInvocationList() select messagedelegate(message) into r where r != null select r)
                    {
                        result = r;
                    }
                }
            }
            else //IWC
            {
                /*string[] session = SessionID.Split('|');
                ISyncMessagePosterService smps = m_registry.RequestModuleInterface<ISyncMessagePosterService>();
                //Forward it on
                result = smps.Get(message, UUID.Parse(session[0]), ulong.Parse(session[1]));*/
            }

            return result;
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:25,代码来源:IWCMessagingServiceInHandler.cs


示例9: PostInternal

 public void PostInternal(bool remote, string url, OSDMap request)
 {
     if (remote)
         DoRemoteCallPost(true, url + "/syncmessage/", false, url + "/syncmessage/", request);
     else
         m_registry.RequestModuleInterface<ISyncMessageRecievedService>().FireMessageReceived(request);
 }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:7,代码来源:LocalSyncMessagePosterService.cs


示例10: GetExternalCaps

        public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
        {
            if (m_registry == null) return new OSDMap();
            OSDMap resp = new OSDMap();
            if (m_registry.RequestModuleInterface<IGridServerInfoService>() != null)
            {
                m_servers = m_registry.RequestModuleInterface<IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
                OSDMap req = new OSDMap();
                req["AgentID"] = agentID;
                req["Region"] = region.ToOSD();
                req["Method"] = "GetCaps";

                List<ManualResetEvent> events = new List<ManualResetEvent>();
                foreach (string uri in m_servers)
                {
                    ManualResetEvent even = new ManualResetEvent(false);
                    m_syncPoster.Get(uri, req, (r) =>
                    {
                        if (r == null)
                            return;
                        foreach (KeyValuePair<string, OSD> kvp in r)
                            resp.Add(kvp.Key, kvp.Value);
                        even.Set();
                    });
                    events.Add(even);
                }
                ManualResetEvent.WaitAll(events.ToArray());
            }
            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                    h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref resp);
            }
            return resp;
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:35,代码来源:ExternalCapsHandler.cs


示例11: SimulatorFeaturesCAP

        byte [] SimulatorFeaturesCAP (string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
        {
            OSDMap data = new OSDMap ();
            // AvatarHoverHeight enabled
            data ["AvatarHoverHeightEnabled"] = true;

            // MaxMaterialsPerTransaction enabled
            data ["MaxMaterialsPerTransaction"] = 50;

            data ["MeshRezEnabled"] = true;
            data ["MeshUploadEnabled"] = true;
            data ["MeshXferEnabled"] = true;
            data ["PhysicsMaterialsEnabled"] = true;

            OSDMap typesMap = new OSDMap ();

            typesMap ["convex"] = true;
            typesMap ["none"] = true;
            typesMap ["prim"] = true;

            data ["PhysicsShapeTypes"] = typesMap;

            // some additional features
            data ["god_names"] = GodNames (httpRequest);

            //Send back data
            return OSDParser.SerializeLLSDXmlBytes (data);
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:28,代码来源:SimulatorFeatures.cs


示例12: SimulatorFeaturesCAP

        private byte[] SimulatorFeaturesCAP(string path, Stream request,
                                  OSHttpRequest httpRequest, OSHttpResponse httpResponse)
        {
            OSDMap data = new OSDMap();
            data["MeshRezEnabled"] = true;
            data["MeshUploadEnabled"] = true;
            data["MeshXferEnabled"] = true;
            data["PhysicsMaterialsEnabled"] = true;


            OSDMap typesMap = new OSDMap();

            typesMap["convex"] = true;
            typesMap["none"] = true;
            typesMap["prim"] = true;

            data["PhysicsShapeTypes"] = typesMap;


            //Data URLS need sent as well
            //Not yet...
            //data["DataUrls"] = m_service.Registry.RequestModuleInterface<IGridRegistrationService> ().GetUrlForRegisteringClient (m_service.AgentID + "|" + m_service.RegionHandle);

            //Send back data
            return OSDParser.SerializeLLSDXmlBytes(data);
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:26,代码来源:SimulatorFeatures.cs


示例13: Pack

        public OSDMap Pack()
        {
            OSDMap args = new OSDMap();
            args["message_type"] = OSD.FromString("AgentPosition");

            args["region_handle"] = OSD.FromString(RegionHandle.ToString());
            args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
            args["agent_uuid"] = OSD.FromUUID(AgentID);
            args["session_uuid"] = OSD.FromUUID(SessionID);

            args["position"] = OSD.FromString(Position.ToString());
            args["velocity"] = OSD.FromString(Velocity.ToString());
            args["center"] = OSD.FromString(Center.ToString());
            args["size"] = OSD.FromString(Size.ToString());
            args["at_axis"] = OSD.FromString(AtAxis.ToString());
            args["left_axis"] = OSD.FromString(LeftAxis.ToString());
            args["up_axis"] = OSD.FromString(UpAxis.ToString());

            args["far"] = OSD.FromReal(Far);
            args["changed_grid"] = OSD.FromBoolean(ChangedGrid);

            if ((Throttles != null) && (Throttles.Length > 0))
                args["throttles"] = OSD.FromBinary(Throttles);

            return args;
        }
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:26,代码来源:ChildAgentDataUpdate.cs


示例14: GetInternal

        public OSDMap GetInternal(bool remote, string url, OSDMap request)
        {
            try
            {
                LogMessage(remote, url, request);

                if (remote)
                {
                    if (url != "")
                    {
                        url = (url.EndsWith("/syncmessage/", StringComparison.Ordinal) ? url : (url + "/syncmessage/"));
                        return DoRemoteCallGet(true, url, false, url, request) as OSDMap;
                    }
                    else
                        return DoRemoteCallGet(true, "SyncMessageServerURI", false, url, request) as OSDMap;
                }

                return m_registry.RequestModuleInterface<ISyncMessageRecievedService>().FireMessageReceived(request);
            }
            catch (Exception ex)
            {
                MainConsole.Instance.WarnFormat("[Sync Message Poster Service]: Caught exception when attempting to post to {0}: {1}",
                                                                      url, ex.ToString());
            }

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


示例15: GetEmails

        public List<Email> GetEmails(UUID objectID)
        {
            OSDMap map = new OSDMap();

            map["ObjectID"] = objectID;
            map["Method"] = "getemails";

            List<Email> Messages = new List<Email>();
            try
            {
                List<string> urls =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string url in urls)
                {
                    OSDMap result = WebUtils.PostToService(url + "osd", map, true, false);
                    OSDArray array = (OSDArray) OSDParser.DeserializeJson(result["_RawResult"]);
                    foreach (OSD o in array)
                    {
                        Email message = new Email();
                        message.FromOSD((OSDMap) o);
                        Messages.Add(message);
                    }
                }
                return Messages;
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteEmailConnector]: Exception when contacting server: {0}", e);
            }
            return Messages;
        }
开发者ID:satlanski2,项目名称:Aurora-Sim,代码行数:31,代码来源:RemoteEmailConnector.cs


示例16: AvatarAppearance

        public AvatarAppearance(UUID avatarID, OSDMap map)
        {
            //            MainConsole.Instance.WarnFormat("[AVATAR APPEARANCE]: create appearance for {0} from OSDMap",avatarID);

            m_owner = avatarID;
            Unpack(map);
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:7,代码来源:AvatarAppearance.cs


示例17: Unpack

 public void Unpack(OSDMap args)
 {
     if (args["point"] != null)
         AttachPoint = args["point"].AsInteger();
     ItemID = (args["item"] != null) ? args["item"].AsUUID() : UUID.Zero;
     AssetID = (args["asset"] != null) ? args["asset"].AsUUID() : UUID.Zero;
 }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:7,代码来源:AvatarAttachment.cs


示例18: CheckForBannedViewer

 /// <summary>
 /// Check to see if the client has baked textures that belong to banned clients
 /// </summary>
 /// <param name="client"></param>
 /// <param name="textureEntry"></param>
 public void CheckForBannedViewer(IClientAPI client, Primitive.TextureEntry textureEntry)
 {
     try
     {
         //Read the website once!
         if (m_map == null)
             m_map = (OSDMap)OSDParser.Deserialize(Utilities.ReadExternalWebsite("http://auroraserver.ath.cx:8080/client_tags.xml"));
         
         //This is the givaway texture!
         for (int i = 0; i < textureEntry.FaceTextures.Length; i++)
         {
             if (textureEntry.FaceTextures[i] != null)
             {
                 if (m_map.ContainsKey(textureEntry.FaceTextures[i].TextureID.ToString()))
                 {
                     OSDMap viewerMap = (OSDMap)m_map[textureEntry.FaceTextures[i].TextureID.ToString()];
                     //Check the names
                     if (BannedViewers.Contains(viewerMap["name"].ToString()))
                     {
                         client.Kick("You cannot use " + viewerMap["name"] + " in this sim.");
                         ((Scene)client.Scene).IncomingCloseAgent(client.AgentId);
                     }
                     else if (m_banEvilViewersByDefault && viewerMap.ContainsKey("evil") && (viewerMap["evil"].AsBoolean() == true))
                     {
                         client.Kick("You cannot use " + viewerMap["name"] + " in this sim.");
                         ((Scene)client.Scene).IncomingCloseAgent(client.AgentId);
                     }
                 }
             }
         }
     }
     catch { }
 }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:38,代码来源:BannedViewersModule.cs


示例19: GetUserInfo

 public UserInfo GetUserInfo(string userID)
 {
     List<string> urls = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(userID,
                                                                                                "AgentInfoServerURI");
     foreach (string url in urls)
     {
         try
         {
             OSDMap request = new OSDMap();
             request["userID"] = userID;
             request["Method"] = "GetUserInfo";
             OSDMap result = WebUtils.PostToService(url, request, true, false);
             OSD r = OSDParser.DeserializeJson(result["_RawResult"]);
             if (r is OSDMap)
             {
                 OSDMap innerresult = (OSDMap) r;
                 UserInfo info = new UserInfo();
                 if (innerresult["Result"].AsString() == "null")
                     return null;
                 info.FromOSD((OSDMap) innerresult["Result"]);
                 return info;
             }
         }
         catch (Exception)
         {
         }
     }
     return null;
 }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:29,代码来源:AgentInfoConnector.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OSGeo类代码示例发布时间:2022-05-24
下一篇:
C# OSDArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap