Пример #1
0
        /// <summary>
        /// Deserializes LLSD in to a list of primitives
        /// </summary>
        /// <param name="llsd">Structure holding the serialized primitive list,
        /// must be of the LLSDMap type</param>
        /// <returns>A list of deserialized primitives</returns>
        public static List <Primitive> LLSDToPrimList(StructuredData.LLSD llsd)
        {
            if (llsd.Type != StructuredData.LLSDType.Map)
            {
                throw new ArgumentException("LLSD must be in the Map structure");
            }

            StructuredData.LLSDMap map   = (StructuredData.LLSDMap)llsd;
            List <Primitive>       prims = new List <Primitive>(map.Count);

            foreach (KeyValuePair <string, StructuredData.LLSD> kvp in map)
            {
                Primitive prim = Primitive.FromLLSD(kvp.Value);
                prim.LocalID = UInt32.Parse(kvp.Key);
                prims.Add(prim);
            }

            return(prims);
        }