예제 #1
0
        /// <summary>
        /// Converts a list of primitives to an object that can be serialized
        /// with the LLSD system
        /// </summary>
        /// <param name="prims">Primitives to convert to a serializable object</param>
        /// <returns>An object that can be serialized with LLSD</returns>
        public static StructuredData.LLSD PrimListToLLSD(List <Primitive> prims)
        {
            StructuredData.LLSDMap map = new OpenMetaverse.StructuredData.LLSDMap(prims.Count);

            for (int i = 0; i < prims.Count; i++)
            {
                map.Add(prims[i].LocalID.ToString(), prims[i].GetLLSD());
            }

            return(map);
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public byte[] SerializeAttachment()
        {
            if (OwnerID == UUID.Zero || AttachmentID == UUID.Zero)
                return new byte[0];

            OpenMetaverse.StructuredData.LLSDMap att = new OpenMetaverse.StructuredData.LLSDMap();
            att.Add("item_id", OpenMetaverse.StructuredData.LLSD.FromUUID(AttachmentID));
            att.Add("owner_id", OpenMetaverse.StructuredData.LLSD.FromUUID(OwnerID));

            return OpenMetaverse.StructuredData.LLSDParser.SerializeXmlBytes(att);

            /*
            //I guess this is how this works, no gaurentees
            string lsd = "<llsd><item_id>" + AttachmentID.ToString() + "</item_id><owner_id>"
                + OwnerID.ToString() + "</owner_id></llsd>";
            return Utils.StringToBytes(lsd);
             */
        }
예제 #3
0
        /// <summary>
        /// Converts a list of primitives to an object that can be serialized
        /// with the LLSD system
        /// </summary>
        /// <param name="prims">Primitives to convert to a serializable object</param>
        /// <returns>An object that can be serialized with LLSD</returns>
        public static StructuredData.LLSD PrimListToLLSD(List<Primitive> prims)
        {
            StructuredData.LLSDMap map = new OpenMetaverse.StructuredData.LLSDMap(prims.Count);

            for (int i = 0; i < prims.Count; i++)
                map.Add(prims[i].LocalID.ToString(), prims[i].GetLLSD());

            return map;
        }