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

C# OSD类代码示例

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

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



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

示例1: SetEnvironment

        private byte[] SetEnvironment(Stream request, UUID agentID)
        {
            IScenePresence SP = m_scene.GetScenePresence(agentID);
            if (SP == null)
                return new byte[0]; //They don't exist
            bool success = false;
            string fail_reason = "";
            if (SP.Scene.Permissions.CanIssueEstateCommand(agentID, false))
            {
                m_info = OSDParser.DeserializeLLSDXml(request);
                IGenericsConnector gc = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
                if (gc != null)
                    gc.AddGeneric(m_scene.RegionInfo.RegionID, "EnvironmentSettings", "",
                                  (new DatabaseWrapper { Info = m_info }).ToOSD());
                success = true;
                SP.ControllingClient.SendAlertMessage("Windlight Settings saved successfully");
            }
            else
            {
                fail_reason = "You don't have permissions to set the windlight settings here.";
                SP.ControllingClient.SendAlertMessage(
                    "You don't have the correct permissions to set the Windlight Settings");
            }
            OSDMap result = new OSDMap()
            {
                new KeyValuePair<string, OSD>("success", success),
                new KeyValuePair<string, OSD>("regionID", SP.Scene.RegionInfo.RegionID)
            };
            if (fail_reason != "")
                result["fail_reason"] = fail_reason;

            return OSDParser.SerializeLLSDXmlBytes(result);
        }
开发者ID:JAllard,项目名称:Aurora-Sim,代码行数:33,代码来源:EnvironmentSettingsModule.cs


示例2: HandleLLSDLogin

        public OSD HandleLLSDLogin(string path, OSD request, IPEndPoint remoteClient)
        {
            if (request.Type == OSDType.Map)
            {
                OSDMap map = (OSDMap) request;

                if (map.ContainsKey("first") && map.ContainsKey("last") && map.ContainsKey("passwd"))
                {
                    string startLocation = string.Empty;

                    if (map.ContainsKey("start"))
                        startLocation = map["start"].AsString();

                    MainConsole.Instance.Info("[LOGIN]: LLSD Login Requested for: '" + map["first"].AsString() + "' '" +
                                              map["last"].AsString() + "' / " + startLocation);

                    LoginResponse reply = null;
                    string loginName = map["name"].AsString() == ""
                                           ? map["first"].AsString() + " " + map["last"].AsString()
                                           : map["name"].AsString();
                    reply = m_loginService.Login(UUID.Zero, loginName, "UserAccount", map["passwd"].AsString(),
                                                 startLocation,
                                                 "", "", "", "", remoteClient, new Hashtable());
                    return reply.ToOSDMap();
                }
            }

            return FailedOSDResponse();
        }
开发者ID:justasabc,项目名称:Aurora-Sim,代码行数:29,代码来源:LLLoginServiceInConnector.cs


示例3: TryEnqueue

 public override bool TryEnqueue(OSD ev, UUID avatarID, ulong RegionHandle)
 {
     if (!base.TryEnqueue(ev, avatarID, RegionHandle))
         if (!m_remoteService.TryEnqueue(ev, avatarID, RegionHandle))
             return false;
     return true;
 }
开发者ID:savino1976,项目名称:Aurora-Sim,代码行数:7,代码来源:IWCEventQueueServicesConnector.cs


示例4: ToIP

 public static IPAddress ToIP(OSD osd)
 {
     byte[] binary = osd.AsBinary();
     if (binary != null && binary.Length == 4)
         return new IPAddress(binary);
     else
         return IPAddress.Any;
 }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:8,代码来源:Messages.cs


示例5: BuildEvent

//        private static byte[] uintToByteArray(uint uIntValue)
//        {
//            byte[] result = new byte[4];
//            Utils.UIntToBytesBig(uIntValue, result, 0);
//            return result;
//        }

        public static OSD BuildEvent(string eventName, OSD eventBody)
        {
            OSDMap llsdEvent = new OSDMap(2);
            llsdEvent.Add("message", new OSDString(eventName));
            llsdEvent.Add("body", eventBody);

            return llsdEvent;
        }
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:15,代码来源:EventQueueHelper.cs


示例6: SendAlertToUser

 public void SendAlertToUser(UUID agentID, string message, string infoMessage, OSD extraParams)
 {
     ScenePresence sp = m_scene.GetScenePresence(agentID);
     
     if (sp != null)
     {
         sp.ControllingClient.SendAlertMessage(message, infoMessage, extraParams);
     }
 }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:9,代码来源:DialogModule.cs


示例7: Hotkeyable

 public Hotkeyable(OSD osd, string name, string tempDisableDefault, string toggleDefault, bool state)
 {
     _config = HotkeyManager.Instance.Config;
     _osd = osd;
     _name = name;
     _tempDisable = new Hotkey("Disable " + name, tempDisableDefault);
     _toggle = new Hotkey("Toggle " + name, toggleDefault);
     _state = state;
     Load();
 }
开发者ID:Wercho,项目名称:TweakScale,代码行数:10,代码来源:HotkeyAble.cs


示例8: Unpack

        public void Unpack(OSD data)
        {
            OSDMap map = (OSDMap)data;

            if (map.ContainsKey("InboundVersion"))
                InboundVersion = (float)map["InboundVersion"].AsReal();
            if (map.ContainsKey("OutboundVersion"))
                OutboundVersion = (float)map["OutboundVersion"].AsReal();
            if (map.ContainsKey("WearablesCount"))
                WearablesCount = map["WearablesCount"].AsInteger();
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:11,代码来源:EntityTransferContext.cs


示例9: FromOSD

        public void FromOSD(OSD osd)
        {
            OSDArray array = osd as OSDArray;

            RegionID = (array[0] as OSDMap)["regionID"];
            Cycle = new DayCycle();
            Cycle.FromOSD(array);

            Water = new WaterData();
            Water.FromOSD(array[3]);
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:11,代码来源:RegionLightShare.cs


示例10: Enqueue

        public virtual bool Enqueue(OSD o, UUID agentID, ulong regionHandle)
        {
            //Find the CapsService for the user and enqueue the event
            IRegionClientCapsService service = GetRegionClientCapsService(agentID, regionHandle);
            if (service == null)
                return false;
            RegionClientEventQueueService eventQueueService = FindEventQueueConnector(service);
            if (eventQueueService == null)
                return false;

            return eventQueueService.Enqueue(o);
        }
开发者ID:Gnu32,项目名称:Silverfin,代码行数:12,代码来源:EventQueueService.cs


示例11: ToDictionaryString

        public static Dictionary<string, string> ToDictionaryString(OSD osd)
        {
            if (osd.Type == OSDType.Map)
            {
                OSDMap map = (OSDMap)osd;
                Dictionary<string, string> dict = new Dictionary<string, string>(map.Count);
                foreach (KeyValuePair<string, OSD> entry in map)
                    dict.Add(entry.Key, entry.Value.AsString());
                return dict;
            }

            return new Dictionary<string, string>(0);
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:13,代码来源:Messages.cs


示例12: ToDictionaryUri

        public static Dictionary<Uri, Uri> ToDictionaryUri(OSD osd)
        {
            if (osd.Type == OSDType.Map)
            {
                OSDMap map = (OSDMap)osd;
                Dictionary<Uri, Uri> dict = new Dictionary<Uri, Uri>(map.Count);
                foreach (KeyValuePair<string, OSD> entry in map)
                    dict.Add(new Uri(entry.Key), entry.Value.AsUri());
                return dict;
            }

            return new Dictionary<Uri, Uri>(0);
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:13,代码来源:Messages.cs


示例13: Start

        public void Start()
        {
            _Dead = false;

            // Create an EventQueueGet request
            OSDMap request = new OSDMap();
            request["ack"] = new OSD();
            request["done"] = OSD.FromBoolean(false);

            byte[] postData = OSDParser.SerializeLLSDXmlBytes(request);

            _Request = CapsBase.UploadDataAsync(_Address, null, "application/xml", postData, REQUEST_TIMEOUT, OpenWriteHandler, null, RequestCompletedHandler);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:EventQueueClient.cs


示例14: SerializeJson

        public static JsonData SerializeJson(OSD osd, bool preserveDefaults)
        {
            switch (osd.Type)
            {
                case OSDType.Boolean:
                    return new JsonData(osd.AsBoolean());
                case OSDType.Integer:
                    return new JsonData(osd.AsInteger());
                case OSDType.Real:
                    return new JsonData(osd.AsReal());
                case OSDType.String:
                case OSDType.Date:
                case OSDType.URI:
                case OSDType.UUID:
                    return new JsonData(osd.AsString());
                case OSDType.Binary:
                    byte[] binary = osd.AsBinary();
                    JsonData jsonbinarray = new JsonData();
                    jsonbinarray.SetJsonType(JsonType.Array);
                    for (int i = 0; i < binary.Length; i++)
                        jsonbinarray.Add(new JsonData(binary[i]));
                    return jsonbinarray;
                case OSDType.Array:
                    JsonData jsonarray = new JsonData();
                    jsonarray.SetJsonType(JsonType.Array);
                    OSDArray array = (OSDArray)osd;
                    for (int i = 0; i < array.Count; i++)
                        jsonarray.Add(SerializeJson(array[i], preserveDefaults));
                    return jsonarray;
                case OSDType.Map:
                    JsonData jsonmap = new JsonData();
                    jsonmap.SetJsonType(JsonType.Object);
                    OSDMap map = (OSDMap)osd;
                    foreach (KeyValuePair<string, OSD> kvp in map)
                    {
                        JsonData data;

                        if (preserveDefaults)
                            data = SerializeJson(kvp.Value, preserveDefaults);
                        else
                            data = SerializeJsonNoDefaults(kvp.Value);

                        if (data != null)
                            jsonmap[kvp.Key] = data;
                    }
                    return jsonmap;
                case OSDType.Unknown:
                default:
                    return new JsonData(null);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:51,代码来源:OSDJson.cs


示例15: FromOSD

        public static WearableCacheItem[] FromOSD(OSD pInput, IImprovedAssetCache dataCache)
        {
            List<WearableCacheItem> ret = new List<WearableCacheItem>();
            if (pInput.Type == OSDType.Array)
            {
                OSDArray itemarray = (OSDArray) pInput;
                foreach (OSDMap item in itemarray)
                {
                    ret.Add(new WearableCacheItem()
                                {
                                    TextureIndex = item["textureindex"].AsUInteger(),
                                    CacheId = item["cacheid"].AsUUID(),
                                    TextureID = item["textureid"].AsUUID()
                                });
                    
                    if (dataCache != null && item.ContainsKey("assetdata"))
                    {
                        AssetBase asset = new AssetBase(item["textureid"].AsUUID(),"BakedTexture",(sbyte)AssetType.Texture,UUID.Zero.ToString());
                        asset.Temporary = true;
                        asset.Data = item["assetdata"].AsBinary();
                        dataCache.Cache(asset);
                    }
                }
            }
            else if (pInput.Type == OSDType.Map)
            {
                OSDMap item = (OSDMap) pInput;
                ret.Add(new WearableCacheItem(){
                                    TextureIndex = item["textureindex"].AsUInteger(),
                                    CacheId = item["cacheid"].AsUUID(),
                                    TextureID = item["textureid"].AsUUID()
                                });
                if (dataCache != null && item.ContainsKey("assetdata"))
                {
                    string assetCreator = item["assetcreator"].AsString();
                    string assetName = item["assetname"].AsString();
                    AssetBase asset = new AssetBase(item["textureid"].AsUUID(), assetName, (sbyte)AssetType.Texture, assetCreator);
                    asset.Temporary = true;
                    asset.Data = item["assetdata"].AsBinary();
                    dataCache.Cache(asset);
                }
            }
            else
            {
                return new WearableCacheItem[0];
            }
            return ret.ToArray();

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


示例16: FromOSD

        /// <summary>
        /// Creates AgentDisplayName object from OSD
        /// </summary>
        /// <param name="data">Incoming OSD data</param>
        /// <returns>AgentDisplayName object</returns>
        public static AgentDisplayName FromOSD(OSD data)
        {
            AgentDisplayName ret = new AgentDisplayName();

            OSDMap map = (OSDMap)data;
            ret.ID = map["id"];
            ret.UserName = map["username"];
            ret.DisplayName = map["display_name"];
            ret.LegacyFirstName = map["legacy_first_name"];
            ret.LegacyLastName = map["legacy_last_name"];
            ret.IsDefaultDisplayName = map["is_display_name_default"];
            ret.NextUpdate = map["display_name_next_update"];
            ret.Updated = map["last_updated"];

            return ret;
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:21,代码来源:AvatarManager.cs


示例17: ZCompressOSD

        public static OSD ZCompressOSD(OSD inOsd, bool useHeader)
        {
            OSD osd = null;

            using (MemoryStream msSinkCompressed = new MemoryStream())
            {
                using (ZOutputStream zOut = new ZOutputStream(msSinkCompressed,1))
                {
                    CopyStream(new MemoryStream(OSDParser.SerializeLLSDBinary(inOsd, useHeader)), zOut);
                    msSinkCompressed.Seek(0L, SeekOrigin.Begin);
                    osd = OSD.FromBinary(msSinkCompressed.ToArray());
                    zOut.Close();
                }

            }

            return osd;
        }
开发者ID:emperorstarfinder,项目名称:Virtual-Universe,代码行数:18,代码来源:RenderMaterials.cs


示例18: FromOSD

        public static Grid FromOSD(OSD data)
        {
            if (data == null || data.Type != OSDType.Map) return null;
            Grid grid = new Grid();
            OSDMap map = (OSDMap)data;

            grid.ID = map["gridnick"].AsString();
            grid.Name = map["gridname"].AsString();
            grid.Platform = map["platform"].AsString();
            grid.LoginURI = map["loginuri"].AsString();
            grid.LoginPage = map["loginpage"].AsString();
            grid.HelperURI = map["helperuri"].AsString();
            grid.Website = map["website"].AsString();
            grid.Support = map["support"].AsString();
            grid.Register = map["register"].AsString();
            grid.PasswordURL = map["password"].AsString();
            grid.Version = map["version"].AsString();

            return grid;
        }
开发者ID:Nuriat,项目名称:radegast,代码行数:20,代码来源:GridManager.cs


示例19: SetEnvironment

        private Hashtable SetEnvironment (Hashtable m_dhttpMethod, UUID agentID)
        {
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = "";

            IScenePresence SP = m_scene.GetScenePresence(agentID);
            if(SP == null)
                return responsedata; //They don't exist
            if(SP.Scene.Permissions.CanIssueEstateCommand(agentID, false))
            {
                m_info = OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);
                IGenericsConnector gc = DataManager.DataManager.RequestPlugin<IGenericsConnector>();
                if(gc != null)
                    gc.AddGeneric(m_scene.RegionInfo.RegionID, "EnvironmentSettings", "", (new DatabaseWrapper() { Info=m_info }).ToOSD());
                SP.ControllingClient.SendAlertMessage("Windlight Settings saved successfully");
            }
            else
                SP.ControllingClient.SendAlertMessage("You don't have the correct permissions to set the Windlight Settings");
            return responsedata;
        }
开发者ID:kchi059,项目名称:Aurora-Sim,代码行数:23,代码来源:EnvironmentSettingsModule.cs


示例20: BeginGetResponse

        public void BeginGetResponse(OSD data, OSDFormat format, int millisecondsTimeout)
        {
            byte[] postData;
            string contentType;

            switch (format)
            {
                case OSDFormat.Xml:
                    postData = OSDParser.SerializeLLSDXmlBytes(data);
                    contentType = "application/llsd+xml";
                    break;
                case OSDFormat.Binary:
                    postData = OSDParser.SerializeLLSDBinary(data);
                    contentType = "application/llsd+binary";
                    break;
                case OSDFormat.Json:
                default:
                    postData = System.Text.Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(data));
                    contentType = "application/llsd+json";
                    break;
            }

            BeginGetResponse(postData, contentType, millisecondsTimeout);
        }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:24,代码来源:CapsClient.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# OSDArray类代码示例发布时间:2022-05-24
下一篇:
C# OSAEMethod类代码示例发布时间: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