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


C# LLSDMap.TryGetValue方法代码示例

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


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

示例1: ParseMappedUUID

        public static UUID ParseMappedUUID(string key, string key2, LLSDMap reply)
        {
            LLSD folderLLSD;
            if (reply.TryGetValue(key, out folderLLSD) && folderLLSD.Type == LLSDType.Array)
            {
                LLSDArray array = (LLSDArray)folderLLSD;
                if (array.Count == 1 && array[0].Type == LLSDType.Map)
                {
                    LLSDMap map = (LLSDMap)array[0];
                    LLSD folder;
                    if (map.TryGetValue(key2, out folder))
                        return folder.AsUUID();
                }
            }

            return UUID.Zero;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:17,代码来源:Login.cs

示例2: ParseInventoryFolders

        public static FolderData[] ParseInventoryFolders(string key, UUID owner, LLSDMap reply)
        {
            List<FolderData> folders = new List<FolderData>();

            LLSD skeleton;
            if (reply.TryGetValue(key, out skeleton) && skeleton.Type == LLSDType.Array)
            {
                LLSDArray array = (LLSDArray)skeleton;

                for (int i = 0; i < array.Count; i++)
                {
                    if (array[i].Type == LLSDType.Map)
                    {
                        LLSDMap map = (LLSDMap)array[i];
                        FolderData folder = new FolderData(map["folder_id"].AsUUID());
                        folder.PreferredType = (AssetType)map["type_default"].AsInteger();
                        folder.Version = map["version"].AsInteger();
                        folder.OwnerID = owner;
                        folder.ParentUUID = map["parent_id"].AsUUID();
                        folder.Name = map["name"].AsString();

                        folders.Add(folder);
                    }
                }
            }

            return folders.ToArray();
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:28,代码来源:Login.cs

示例3: ParseString

 public static string ParseString(string key, LLSDMap reply)
 {
     LLSD llsd;
     if (reply.TryGetValue(key, out llsd))
         return llsd.AsString();
     else
         return String.Empty;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:8,代码来源:Login.cs

示例4: ParseVector3

        public static Vector3 ParseVector3(string key, LLSDMap reply)
        {
            LLSD llsd;
            if (reply.TryGetValue(key, out llsd))
            {
                if (llsd.Type == LLSDType.Array)
                {
                    Vector3 vec = new Vector3();
                    vec.FromLLSD(llsd);
                    return vec;
                }
                else if (llsd.Type == LLSDType.String)
                {
                    LLSDArray array = (LLSDArray)LLSDParser.DeserializeNotation(llsd.AsString());
                    Vector3 vec = new Vector3();
                    vec.FromLLSD(array);
                    return vec;
                }
            }

            return Vector3.Zero;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:22,代码来源:Login.cs

示例5: ParseUUID

 public static UUID ParseUUID(string key, LLSDMap reply)
 {
     LLSD llsd;
     if (reply.TryGetValue(key, out llsd))
         return llsd.AsUUID();
     else
         return UUID.Zero;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:8,代码来源:Login.cs

示例6: ParseUInt

 public static uint ParseUInt(string key, LLSDMap reply)
 {
     LLSD llsd;
     if (reply.TryGetValue(key, out llsd))
         return (uint)llsd.AsInteger();
     else
         return 0;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:8,代码来源:Login.cs

示例7: Parse

        public void Parse(LLSDMap reply)
        {
            try
            {
                AgentID = ParseUUID("agent_id", reply);
                SessionID = ParseUUID("session_id", reply);
                SecureSessionID = ParseUUID("secure_session_id", reply);
                FirstName = ParseString("first_name", reply).Trim('"');
                LastName = ParseString("last_name", reply).Trim('"');
                StartLocation = ParseString("start_location", reply);
                AgentAccess = ParseString("agent_access", reply);
                LookAt = ParseVector3("look_at", reply); 
            }
            catch (LLSDException e)
            {
                // FIXME: sometimes look_at comes back with invalid values e.g: 'look_at':'[r1,r2.0193899999999998204e-06,r0]'
                // need to handle that somehow
                Logger.DebugLog("login server returned (some) invalid data: " + e.Message);
            }

            // Home
            LLSDMap home = null;
            LLSD llsdHome = LLSDParser.DeserializeNotation(reply["home"].AsString());

            if (llsdHome.Type == LLSDType.Map)
            {
                home = (LLSDMap)llsdHome;

                LLSD homeRegion;
                if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == LLSDType.Array)
                {
                    LLSDArray homeArray = (LLSDArray)homeRegion;
                    if (homeArray.Count == 2)
                        HomeRegion = Helpers.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
                    else
                        HomeRegion = 0;
                }

                HomePosition = ParseVector3("position", home);
                HomeLookAt = ParseVector3("look_at", home);
            }
            else
            {
                HomeRegion = 0;
                HomePosition = Vector3.Zero;
                HomeLookAt = Vector3.Zero;
            }

            CircuitCode = ParseUInt("circuit_code", reply);
            RegionX = ParseUInt("region_x", reply);
            RegionY = ParseUInt("region_y", reply);
            SimPort = (ushort)ParseUInt("sim_port", reply);
            string simIP = ParseString("sim_ip", reply);
            IPAddress.TryParse(simIP, out SimIP);
            SeedCapability = ParseString("seed_capability", reply);

            // Buddy list
            LLSD buddyLLSD;
            if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == LLSDType.Array)
            {
                LLSDArray buddyArray = (LLSDArray)buddyLLSD;
                BuddyList = new FriendInfo[buddyArray.Count];

                for (int i = 0; i < buddyArray.Count; i++)
                {
                    if (buddyArray[i].Type == LLSDType.Map)
                    {
                        LLSDMap buddy = (LLSDMap)buddyArray[i];
                        BuddyList[i] = new FriendInfo(
                            ParseUUID("buddy_id", buddy),
                            (FriendRights)ParseUInt("buddy_rights_given", buddy),
                            (FriendRights)ParseUInt("buddy_rights_has", buddy));
                    }
                }
            }

            SecondsSinceEpoch = Helpers.UnixTimeToDateTime(ParseUInt("seconds_since_epoch", reply));
            InventoryRoot = ParseMappedUUID("inventory-root", "folder_id", reply);
            InventoryFolders = ParseInventoryFolders("inventory-skeleton", AgentID, reply);
            LibraryRoot = ParseMappedUUID("inventory-lib-root", "folder_id", reply);
            LibraryOwner = ParseMappedUUID("inventory-lib-owner", "agent_id", reply);
            LibraryFolders = ParseInventoryFolders("inventory-skel-lib", LibraryOwner, reply);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:83,代码来源:Login.cs

示例8: Parse

        public void Parse(LLSDMap reply)
        {
            AgentID = ParseUUID("agent_id", reply);
            SessionID = ParseUUID("session_id", reply);
            SecureSessionID = ParseUUID("secure_session_id", reply);
            FirstName = ParseString("first_name", reply).Trim('"');
            LastName = ParseString("last_name", reply).Trim('"');
            StartLocation = ParseString("start_location", reply);
            AgentAccess = ParseString("agent_access", reply);
            LookAt = ParseLLVector3("look_at", reply);

            // Home
            LLSDMap home = (LLSDMap)LLSDParser.DeserializeNotation(reply["home"].AsString());

            if (home != null)
            {
                LLSD homeRegion;
                if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == LLSDType.Array)
                {
                    LLSDArray homeArray = (LLSDArray)homeRegion;
                    if (homeArray.Count == 2)
                        HomeRegion = Helpers.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
                    else
                        HomeRegion = 0;
                }

                HomePosition = ParseLLVector3("position", home);
                HomeLookAt = ParseLLVector3("look_at", home);
            }
            else
            {
                HomeRegion = 0;
                HomePosition = LLVector3.Zero;
                HomeLookAt = LLVector3.Zero;
            }

            CircuitCode = ParseUInt("circuit_code", reply);
            RegionX = ParseUInt("region_x", reply);
            RegionY = ParseUInt("region_y", reply);
            SimPort = (ushort)ParseUInt("sim_port", reply);
            string simIP = ParseString("sim_ip", reply);
            IPAddress.TryParse(simIP, out SimIP);
            SeedCapability = ParseString("seed_capability", reply);

            // Buddy list
            LLSD buddyLLSD;
            if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == LLSDType.Array)
            {
                LLSDArray buddyArray = (LLSDArray)buddyLLSD;
                BuddyList = new FriendInfo[buddyArray.Count];

                for (int i = 0; i < buddyArray.Count; i++)
                {
                    if (buddyArray[i].Type == LLSDType.Map)
                    {
                        LLSDMap buddy = (LLSDMap)buddyArray[i];
                        BuddyList[i] = new FriendInfo(
                            ParseUUID("buddy_id", buddy),
                            (FriendRights)ParseUInt("buddy_rights_given", buddy),
                            (FriendRights)ParseUInt("buddy_rights_has", buddy));
                    }
                }
            }

            SecondsSinceEpoch = Helpers.UnixTimeToDateTime(ParseUInt("seconds_since_epoch", reply));
            InventoryRoot = ParseMappedUUID("inventory-root", "folder_id", reply);
            InventorySkeleton = ParseInventoryFolders("inventory-skeleton", AgentID, reply);
            LibraryRoot = ParseMappedUUID("inventory-lib-root", "folder_id", reply);
            LibraryOwner = ParseMappedUUID("inventory-lib-owner", "agent_id", reply);
            LibrarySkeleton = ParseInventoryFolders("inventory-skel-lib", LibraryOwner, reply);
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:71,代码来源:Login.cs

示例9: ParseVector3

        public static Vector3 ParseVector3(string key, LLSDMap reply)
        {
            LLSD llsd;
            if (reply.TryGetValue(key, out llsd))
            {
                if (llsd.Type == LLSDType.Array)
                {
                    return ((LLSDArray)llsd).AsVector3();
                }
                else if (llsd.Type == LLSDType.String)
                {
                    LLSDArray array = (LLSDArray)LLSDParser.DeserializeNotation(llsd.AsString());
                    return array.AsVector3();
                }
            }

            return Vector3.Zero;
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:18,代码来源:Login.cs


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