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


C# OSD类代码示例

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


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


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