Пример #1
0
        public static LLSD FromVector2(Vector2 value)
        {
            LLSDArray array = new LLSDArray();

            array.Add(LLSD.FromReal(value.X));
            array.Add(LLSD.FromReal(value.Y));
            return(array);
        }
Пример #2
0
        public static LLSD FromColor4(Color4 value)
        {
            LLSDArray array = new LLSDArray();

            array.Add(LLSD.FromReal(value.R));
            array.Add(LLSD.FromReal(value.G));
            array.Add(LLSD.FromReal(value.B));
            array.Add(LLSD.FromReal(value.A));
            return(array);
        }
Пример #3
0
        public static LLSD FromQuaternion(Quaternion value)
        {
            LLSDArray array = new LLSDArray();

            array.Add(LLSD.FromReal(value.X));
            array.Add(LLSD.FromReal(value.Y));
            array.Add(LLSD.FromReal(value.Z));
            array.Add(LLSD.FromReal(value.W));
            return(array);
        }
Пример #4
0
        private static LLSD DeserializeNotationArray(StringReader reader)
        {
            int       character;
            LLSDArray llsdArray = new LLSDArray();

            while (((character = PeekAndSkipWhitespace(reader)) > 0) &&
                   ((char)character != arrayEndNotationMarker))
            {
                llsdArray.Add(DeserializeNotationElement(reader));

                character = ReadAndSkipWhitespace(reader);
                if (character < 0)
                {
                    throw new LLSDException("Notation LLSD parsing: Unexpected end of array discovered.");
                }
                else if ((char)character == kommaNotationDelimiter)
                {
                    continue;
                }
                else if ((char)character == arrayEndNotationMarker)
                {
                    break;
                }
            }
            if (character < 0)
            {
                throw new LLSDException("Notation LLSD parsing: Unexpected end of array discovered.");
            }

            return((LLSD)llsdArray);
        }
Пример #5
0
        private static LLSDArray ParseXmlArray(XmlTextReader reader)
        {
            if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "array")
            {
                throw new LLSDException("Expected <array>");
            }

            LLSDArray array = new LLSDArray();

            if (reader.IsEmptyElement)
            {
                reader.Read();
                return(array);
            }

            if (reader.Read())
            {
                while (true)
                {
                    SkipWhitespace(reader);

                    if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "array")
                    {
                        reader.Read();
                        break;
                    }

                    array.Add(ParseXmlElement(reader));
                }
            }

            return(array);
        }
Пример #6
0
        private static LLSD ParseBinaryArray(MemoryStream stream)
        {
            int       numElements = NetworkToHostInt(ConsumeBytes(stream, int32Length));
            int       crrElement  = 0;
            LLSDArray llsdArray   = new LLSDArray();

            while (crrElement < numElements)
            {
                llsdArray.Add(ParseBinaryElement(stream));
                crrElement++;
            }

            if (!FindByte(stream, arrayEndBinaryMarker))
            {
                throw new LLSDException("Binary LLSD parsing: Missing end marker in array.");
            }

            return((LLSD)llsdArray);
        }