diff --git a/OpenMetaverse.Tests/BinaryLLSDTests.cs b/OpenMetaverse.Tests/BinaryLLSDTests.cs
index bdc47da5..922fedcf 100644
--- a/OpenMetaverse.Tests/BinaryLLSDTests.cs
+++ b/OpenMetaverse.Tests/BinaryLLSDTests.cs
@@ -47,7 +47,7 @@ namespace OpenMetaverse.Tests
{
[TestFixture()]
- public class BinaryLLSDTests
+ public class BinarySDTests
{
private static byte[] binaryHead = { 0x3c, 0x3f, 0x6c, 0x6c, 0x73, 0x64, 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x3f, 0x3e, 0xa };
@@ -107,15 +107,15 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeUndef()
{
- LLSD llsdUndef = LLSDParser.DeserializeBinary(binaryUndef);
- Assert.AreEqual(LLSDType.Unknown, llsdUndef.Type);
+ OSD llsdUndef = LLSDParser.DeserializeLLSDBinary(binaryUndef);
+ Assert.AreEqual(OSDType.Unknown, llsdUndef.Type);
}
[Test()]
public void SerializeUndef()
{
- LLSD llsdUndef = new LLSD();
- byte[] binaryUndefSerialized = LLSDParser.SerializeBinary(llsdUndef);
+ OSD llsdUndef = new OSD();
+ byte[] binaryUndefSerialized = LLSDParser.SerializeLLSDBinary(llsdUndef);
Assert.AreEqual(binaryUndef, binaryUndefSerialized);
}
@@ -129,24 +129,24 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeBool()
{
- LLSD llsdTrue = LLSDParser.DeserializeBinary(binaryTrue);
- Assert.AreEqual(LLSDType.Boolean, llsdTrue.Type);
+ OSD llsdTrue = LLSDParser.DeserializeLLSDBinary(binaryTrue);
+ Assert.AreEqual(OSDType.Boolean, llsdTrue.Type);
Assert.AreEqual(true, llsdTrue.AsBoolean());
- LLSD llsdFalse = LLSDParser.DeserializeBinary(binaryFalse);
- Assert.AreEqual(LLSDType.Boolean, llsdFalse.Type);
+ OSD llsdFalse = LLSDParser.DeserializeLLSDBinary(binaryFalse);
+ Assert.AreEqual(OSDType.Boolean, llsdFalse.Type);
Assert.AreEqual(false, llsdFalse.AsBoolean());
}
[Test()]
public void SerializeBool()
{
- LLSD llsdTrue = LLSD.FromBoolean(true);
- byte[] binaryTrueSerialized = LLSDParser.SerializeBinary(llsdTrue);
+ OSD llsdTrue = OSD.FromBoolean(true);
+ byte[] binaryTrueSerialized = LLSDParser.SerializeLLSDBinary(llsdTrue);
Assert.AreEqual(binaryTrue, binaryTrueSerialized);
- LLSD llsdFalse = LLSD.FromBoolean(false);
- byte[] binaryFalseSerialized = LLSDParser.SerializeBinary(llsdFalse);
+ OSD llsdFalse = OSD.FromBoolean(false);
+ byte[] binaryFalseSerialized = LLSDParser.SerializeLLSDBinary(llsdFalse);
Assert.AreEqual(binaryFalse, binaryFalseSerialized);
}
@@ -159,25 +159,25 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeInteger()
{
- LLSD llsdZeroInteger = LLSDParser.DeserializeBinary(binaryZeroInt);
- Assert.AreEqual(LLSDType.Integer, llsdZeroInteger.Type);
+ OSD llsdZeroInteger = LLSDParser.DeserializeLLSDBinary(binaryZeroInt);
+ Assert.AreEqual(OSDType.Integer, llsdZeroInteger.Type);
Assert.AreEqual(0, llsdZeroInteger.AsInteger());
- LLSD llsdAnInteger = LLSDParser.DeserializeBinary(binaryAnInt);
- Assert.AreEqual(LLSDType.Integer, llsdAnInteger.Type);
+ OSD llsdAnInteger = LLSDParser.DeserializeLLSDBinary(binaryAnInt);
+ Assert.AreEqual(OSDType.Integer, llsdAnInteger.Type);
Assert.AreEqual(1234843, llsdAnInteger.AsInteger());
}
[Test()]
public void SerializeInteger()
{
- LLSD llsdZeroInt = LLSD.FromInteger(0);
- byte[] binaryZeroIntSerialized = LLSDParser.SerializeBinary(llsdZeroInt);
+ OSD llsdZeroInt = OSD.FromInteger(0);
+ byte[] binaryZeroIntSerialized = LLSDParser.SerializeLLSDBinary(llsdZeroInt);
Assert.AreEqual(binaryZeroInt, binaryZeroIntSerialized);
- LLSD llsdAnInt = LLSD.FromInteger(1234843);
- byte[] binaryAnIntSerialized = LLSDParser.SerializeBinary(llsdAnInt);
+ OSD llsdAnInt = OSD.FromInteger(1234843);
+ byte[] binaryAnIntSerialized = LLSDParser.SerializeLLSDBinary(llsdAnInt);
Assert.AreEqual(binaryAnInt, binaryAnIntSerialized);
}
@@ -187,16 +187,16 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeReal()
{
- LLSD llsdReal = LLSDParser.DeserializeBinary(binaryReal);
- Assert.AreEqual(LLSDType.Real, llsdReal.Type);
+ OSD llsdReal = LLSDParser.DeserializeLLSDBinary(binaryReal);
+ Assert.AreEqual(OSDType.Real, llsdReal.Type);
Assert.AreEqual(947835.234d, llsdReal.AsReal());
}
[Test()]
public void SerializeReal()
{
- LLSD llsdReal = LLSD.FromReal(947835.234d);
- byte[] binaryRealSerialized = LLSDParser.SerializeBinary(llsdReal);
+ OSD llsdReal = OSD.FromReal(947835.234d);
+ byte[] binaryRealSerialized = LLSDParser.SerializeLLSDBinary(llsdReal);
Assert.AreEqual(binaryReal, binaryRealSerialized);
}
@@ -211,12 +211,12 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeUUID()
{
- LLSD llsdAUUID = LLSDParser.DeserializeBinary(binaryAUUID);
- Assert.AreEqual(LLSDType.UUID, llsdAUUID.Type);
+ OSD llsdAUUID = LLSDParser.DeserializeLLSDBinary(binaryAUUID);
+ Assert.AreEqual(OSDType.UUID, llsdAUUID.Type);
Assert.AreEqual("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdAUUID.AsString());
- LLSD llsdZeroUUID = LLSDParser.DeserializeBinary(binaryZeroUUID);
- Assert.AreEqual(LLSDType.UUID, llsdZeroUUID.Type);
+ OSD llsdZeroUUID = LLSDParser.DeserializeLLSDBinary(binaryZeroUUID);
+ Assert.AreEqual(OSDType.UUID, llsdZeroUUID.Type);
Assert.AreEqual("00000000-0000-0000-0000-000000000000", llsdZeroUUID.AsString());
}
@@ -224,12 +224,12 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeUUID()
{
- LLSD llsdAUUID = LLSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
- byte[] binaryAUUIDSerialized = LLSDParser.SerializeBinary(llsdAUUID);
+ OSD llsdAUUID = OSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
+ byte[] binaryAUUIDSerialized = LLSDParser.SerializeLLSDBinary(llsdAUUID);
Assert.AreEqual(binaryAUUID, binaryAUUIDSerialized);
- LLSD llsdZeroUUID = LLSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
- byte[] binaryZeroUUIDSerialized = LLSDParser.SerializeBinary(llsdZeroUUID);
+ OSD llsdZeroUUID = OSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
+ byte[] binaryZeroUUIDSerialized = LLSDParser.SerializeLLSDBinary(llsdZeroUUID);
Assert.AreEqual(binaryZeroUUID, binaryZeroUUIDSerialized);
}
@@ -241,10 +241,10 @@ namespace OpenMetaverse.Tests
private static byte[] binaryBinString = (byte[])ConcatenateArrays(binaryHead, binaryBinStringValue);
[Test()]
- public void DeserializeBinary()
+ public void DeserializeLLSDBinary()
{
- LLSD llsdBytes = LLSDParser.DeserializeBinary(binaryBinString);
- Assert.AreEqual(LLSDType.Binary, llsdBytes.Type);
+ OSD llsdBytes = LLSDParser.DeserializeLLSDBinary(binaryBinString);
+ Assert.AreEqual(OSDType.Binary, llsdBytes.Type);
byte[] contentBinString = { 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x73,
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x63, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68,
@@ -253,14 +253,14 @@ namespace OpenMetaverse.Tests
}
[Test()]
- public void SerializeBinary()
+ public void SerializeLLSDBinary()
{
byte[] contentBinString = { 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x73,
0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x63, 0x6f,
0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68,
0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0xa, 0xd };
- LLSD llsdBinary = LLSD.FromBinary(contentBinString);
- byte[] binaryBinarySerialized = LLSDParser.SerializeBinary(llsdBinary);
+ OSD llsdBinary = OSD.FromBinary(contentBinString);
+ byte[] binaryBinarySerialized = LLSDParser.SerializeLLSDBinary(llsdBinary);
Assert.AreEqual(binaryBinString, binaryBinarySerialized);
}
@@ -278,13 +278,13 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeString()
{
- LLSD llsdEmptyString = LLSDParser.DeserializeBinary(binaryEmptyString);
- Assert.AreEqual(LLSDType.String, llsdEmptyString.Type);
+ OSD llsdEmptyString = LLSDParser.DeserializeLLSDBinary(binaryEmptyString);
+ Assert.AreEqual(OSDType.String, llsdEmptyString.Type);
string contentEmptyString = "";
Assert.AreEqual(contentEmptyString, llsdEmptyString.AsString());
- LLSD llsdLongString = LLSDParser.DeserializeBinary(binaryLongString);
- Assert.AreEqual(LLSDType.String, llsdLongString.Type);
+ OSD llsdLongString = LLSDParser.DeserializeLLSDBinary(binaryLongString);
+ Assert.AreEqual(OSDType.String, llsdLongString.Type);
string contentLongString = "abcdefghijklmnopqrstuvwxyz01234567890";
Assert.AreEqual(contentLongString, llsdLongString.AsString());
}
@@ -292,8 +292,8 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeString()
{
- LLSD llsdString = LLSD.FromString("abcdefghijklmnopqrstuvwxyz01234567890");
- byte[] binaryLongStringSerialized = LLSDParser.SerializeBinary(llsdString);
+ OSD llsdString = OSD.FromString("abcdefghijklmnopqrstuvwxyz01234567890");
+ byte[] binaryLongStringSerialized = LLSDParser.SerializeLLSDBinary(llsdString);
Assert.AreEqual(binaryLongString, binaryLongStringSerialized);
// A test with some utf8 characters
@@ -304,10 +304,10 @@ namespace OpenMetaverse.Tests
xtr.Read();
string contentAString = xtr.ReadString();
- LLSD llsdAString = LLSD.FromString(contentAString);
- byte[] binaryAString = LLSDParser.SerializeBinary(llsdAString);
- LLSD llsdAStringDS = LLSDParser.DeserializeBinary(binaryAString);
- Assert.AreEqual(LLSDType.String, llsdAStringDS.Type);
+ OSD llsdAString = OSD.FromString(contentAString);
+ byte[] binaryAString = LLSDParser.SerializeLLSDBinary(llsdAString);
+ OSD llsdAStringDS = LLSDParser.DeserializeLLSDBinary(binaryAString);
+ Assert.AreEqual(OSDType.String, llsdAStringDS.Type);
Assert.AreEqual(contentAString, llsdAStringDS.AsString());
// we also test for a 4byte character.
@@ -318,10 +318,10 @@ namespace OpenMetaverse.Tests
xtrTwo.Read();
string content = xtrTwo.ReadString();
- LLSD llsdStringOne = LLSD.FromString(content);
- byte[] binaryAStringOneSerialized = LLSDParser.SerializeBinary(llsdStringOne);
- LLSD llsdStringOneDS = LLSDParser.DeserializeBinary(binaryAStringOneSerialized);
- Assert.AreEqual(LLSDType.String, llsdStringOneDS.Type);
+ OSD llsdStringOne = OSD.FromString(content);
+ byte[] binaryAStringOneSerialized = LLSDParser.SerializeLLSDBinary(llsdStringOne);
+ OSD llsdStringOneDS = LLSDParser.DeserializeLLSDBinary(binaryAStringOneSerialized);
+ Assert.AreEqual(OSDType.String, llsdStringOneDS.Type);
Assert.AreEqual(content, llsdStringOneDS.AsString());
}
@@ -337,8 +337,8 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeURI()
{
- LLSD llsdURI = LLSDParser.DeserializeBinary(binaryURI);
- Assert.AreEqual(LLSDType.URI, llsdURI.Type);
+ OSD llsdURI = LLSDParser.DeserializeLLSDBinary(binaryURI);
+ Assert.AreEqual(OSDType.URI, llsdURI.Type);
Uri uri = new Uri("http://www.testurl.test/");
Assert.AreEqual(uri, llsdURI.AsUri());
@@ -347,8 +347,8 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeURI()
{
- LLSD llsdUri = LLSD.FromUri(new Uri("http://www.testurl.test/"));
- byte[] binaryURISerialized = LLSDParser.SerializeBinary(llsdUri);
+ OSD llsdUri = OSD.FromUri(new Uri("http://www.testurl.test/"));
+ byte[] binaryURISerialized = LLSDParser.SerializeLLSDBinary(llsdUri);
Assert.AreEqual(binaryURI, binaryURISerialized);
}
@@ -363,8 +363,8 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeDateTime()
{
- LLSD llsdDateTime = LLSDParser.DeserializeBinary(binaryDateTime);
- Assert.AreEqual(LLSDType.Date, llsdDateTime.Type);
+ OSD llsdDateTime = LLSDParser.DeserializeLLSDBinary(binaryDateTime);
+ Assert.AreEqual(OSDType.Date, llsdDateTime.Type);
DateTime dt = new DateTime(2008, 1, 1, 20, 10, 31, 0, DateTimeKind.Utc);
DateTime dateLocal = llsdDateTime.AsDate();
Assert.AreEqual(dt, dateLocal.ToUniversalTime());
@@ -374,23 +374,23 @@ namespace OpenMetaverse.Tests
public void SerializeDateTime()
{
DateTime dt = new DateTime(2008, 1, 1, 20, 10, 31, 0, DateTimeKind.Utc);
- LLSD llsdDate = LLSD.FromDate(dt);
- byte[] binaryDateSerialized = LLSDParser.SerializeBinary(llsdDate);
+ OSD llsdDate = OSD.FromDate(dt);
+ byte[] binaryDateSerialized = LLSDParser.SerializeLLSDBinary(llsdDate);
Assert.AreEqual(binaryDateTime, binaryDateSerialized);
// check if a *local* time can be serialized and deserialized
DateTime dtOne = new DateTime(2009, 12, 30, 8, 25, 10, DateTimeKind.Local);
- LLSD llsdDateOne = LLSD.FromDate(dtOne);
- byte[] binaryDateOneSerialized = LLSDParser.SerializeBinary(llsdDateOne);
- LLSD llsdDateOneDS = LLSDParser.DeserializeBinary(binaryDateOneSerialized);
- Assert.AreEqual(LLSDType.Date, llsdDateOneDS.Type);
+ OSD llsdDateOne = OSD.FromDate(dtOne);
+ byte[] binaryDateOneSerialized = LLSDParser.SerializeLLSDBinary(llsdDateOne);
+ OSD llsdDateOneDS = LLSDParser.DeserializeLLSDBinary(binaryDateOneSerialized);
+ Assert.AreEqual(OSDType.Date, llsdDateOneDS.Type);
Assert.AreEqual(dtOne, llsdDateOneDS.AsDate());
DateTime dtTwo = new DateTime(2010, 11, 11, 10, 8, 20, DateTimeKind.Utc);
- LLSD llsdDateTwo = LLSD.FromDate(dtTwo);
- byte[] binaryDateTwoSerialized = LLSDParser.SerializeBinary(llsdDateTwo);
- LLSD llsdDateTwoDS = LLSDParser.DeserializeBinary(binaryDateTwoSerialized);
- Assert.AreEqual(LLSDType.Date, llsdDateOneDS.Type);
+ OSD llsdDateTwo = OSD.FromDate(dtTwo);
+ byte[] binaryDateTwoSerialized = LLSDParser.SerializeLLSDBinary(llsdDateTwo);
+ OSD llsdDateTwoDS = LLSDParser.DeserializeLLSDBinary(binaryDateTwoSerialized);
+ Assert.AreEqual(OSDType.Date, llsdDateOneDS.Type);
Assert.AreEqual(dtTwo.ToLocalTime(), llsdDateTwoDS.AsDate());
}
@@ -413,46 +413,46 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeArray()
{
- LLSD llsdEmptyArray = LLSDParser.DeserializeBinary(binaryEmptyArray);
- Assert.AreEqual(LLSDType.Array, llsdEmptyArray.Type);
- LLSDArray llsdEmptyArrayArray = (LLSDArray)llsdEmptyArray;
+ OSD llsdEmptyArray = LLSDParser.DeserializeLLSDBinary(binaryEmptyArray);
+ Assert.AreEqual(OSDType.Array, llsdEmptyArray.Type);
+ OSDArray llsdEmptyArrayArray = (OSDArray)llsdEmptyArray;
Assert.AreEqual(0, llsdEmptyArrayArray.Count);
- LLSD llsdSimpleArray = LLSDParser.DeserializeBinary(binarySimpleArray);
- Assert.AreEqual(LLSDType.Array, llsdSimpleArray.Type);
- LLSDArray llsdArray = (LLSDArray)llsdSimpleArray;
- Assert.AreEqual(LLSDType.Integer, llsdArray[0].Type);
+ OSD llsdSimpleArray = LLSDParser.DeserializeLLSDBinary(binarySimpleArray);
+ Assert.AreEqual(OSDType.Array, llsdSimpleArray.Type);
+ OSDArray llsdArray = (OSDArray)llsdSimpleArray;
+ Assert.AreEqual(OSDType.Integer, llsdArray[0].Type);
Assert.AreEqual(0, llsdArray[0].AsInteger());
- LLSD llsdSimpleArrayTwo = LLSDParser.DeserializeBinary(binarySimpleArrayTwo);
- Assert.AreEqual(LLSDType.Array, llsdSimpleArrayTwo.Type);
- LLSDArray llsdArrayTwo = (LLSDArray)llsdSimpleArrayTwo;
+ OSD llsdSimpleArrayTwo = LLSDParser.DeserializeLLSDBinary(binarySimpleArrayTwo);
+ Assert.AreEqual(OSDType.Array, llsdSimpleArrayTwo.Type);
+ OSDArray llsdArrayTwo = (OSDArray)llsdSimpleArrayTwo;
Assert.AreEqual(2, llsdArrayTwo.Count);
- Assert.AreEqual(LLSDType.Integer, llsdArrayTwo[0].Type);
+ Assert.AreEqual(OSDType.Integer, llsdArrayTwo[0].Type);
Assert.AreEqual(0, llsdArrayTwo[0].AsInteger());
- Assert.AreEqual(LLSDType.Integer, llsdArrayTwo[1].Type);
+ Assert.AreEqual(OSDType.Integer, llsdArrayTwo[1].Type);
Assert.AreEqual(0, llsdArrayTwo[1].AsInteger());
}
[Test()]
public void SerializeArray()
{
- LLSDArray llsdEmptyArray = new LLSDArray();
- byte[] binaryEmptyArraySerialized = LLSDParser.SerializeBinary(llsdEmptyArray);
+ OSDArray llsdEmptyArray = new OSDArray();
+ byte[] binaryEmptyArraySerialized = LLSDParser.SerializeLLSDBinary(llsdEmptyArray);
Assert.AreEqual(binaryEmptyArray, binaryEmptyArraySerialized);
- LLSDArray llsdSimpleArray = new LLSDArray();
- llsdSimpleArray.Add(LLSD.FromInteger(0));
- byte[] binarySimpleArraySerialized = LLSDParser.SerializeBinary(llsdSimpleArray);
+ OSDArray llsdSimpleArray = new OSDArray();
+ llsdSimpleArray.Add(OSD.FromInteger(0));
+ byte[] binarySimpleArraySerialized = LLSDParser.SerializeLLSDBinary(llsdSimpleArray);
Assert.AreEqual(binarySimpleArray, binarySimpleArraySerialized);
- LLSDArray llsdSimpleArrayTwo = new LLSDArray();
- llsdSimpleArrayTwo.Add(LLSD.FromInteger(0));
- llsdSimpleArrayTwo.Add(LLSD.FromInteger(0));
- byte[] binarySimpleArrayTwoSerialized = LLSDParser.SerializeBinary(llsdSimpleArrayTwo);
+ OSDArray llsdSimpleArrayTwo = new OSDArray();
+ llsdSimpleArrayTwo.Add(OSD.FromInteger(0));
+ llsdSimpleArrayTwo.Add(OSD.FromInteger(0));
+ byte[] binarySimpleArrayTwoSerialized = LLSDParser.SerializeLLSDBinary(llsdSimpleArrayTwo);
Assert.AreEqual(binarySimpleArrayTwo, binarySimpleArrayTwoSerialized);
}
@@ -487,23 +487,23 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeDictionary()
{
- LLSDMap llsdEmptyMap = (LLSDMap)LLSDParser.DeserializeBinary(binaryEmptyMap);
- Assert.AreEqual(LLSDType.Map, llsdEmptyMap.Type);
+ OSDMap llsdEmptyMap = (OSDMap)LLSDParser.DeserializeLLSDBinary(binaryEmptyMap);
+ Assert.AreEqual(OSDType.Map, llsdEmptyMap.Type);
Assert.AreEqual(0, llsdEmptyMap.Count);
- LLSDMap llsdSimpleMap = (LLSDMap)LLSDParser.DeserializeBinary(binarySimpleMap);
- Assert.AreEqual(LLSDType.Map, llsdSimpleMap.Type);
+ OSDMap llsdSimpleMap = (OSDMap)LLSDParser.DeserializeLLSDBinary(binarySimpleMap);
+ Assert.AreEqual(OSDType.Map, llsdSimpleMap.Type);
Assert.AreEqual(1, llsdSimpleMap.Count);
- Assert.AreEqual(LLSDType.Integer, llsdSimpleMap["test"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSimpleMap["test"].Type);
Assert.AreEqual(0, llsdSimpleMap["test"].AsInteger());
- LLSDMap llsdSimpleMapTwo = (LLSDMap)LLSDParser.DeserializeBinary(binarySimpleMapTwo);
- Assert.AreEqual(LLSDType.Map, llsdSimpleMapTwo.Type);
+ OSDMap llsdSimpleMapTwo = (OSDMap)LLSDParser.DeserializeLLSDBinary(binarySimpleMapTwo);
+ Assert.AreEqual(OSDType.Map, llsdSimpleMapTwo.Type);
Assert.AreEqual(3, llsdSimpleMapTwo.Count);
- Assert.AreEqual(LLSDType.Unknown, llsdSimpleMapTwo["test"].Type);
- Assert.AreEqual(LLSDType.String, llsdSimpleMapTwo["tes1"].Type);
+ Assert.AreEqual(OSDType.Unknown, llsdSimpleMapTwo["test"].Type);
+ Assert.AreEqual(OSDType.String, llsdSimpleMapTwo["tes1"].Type);
Assert.AreEqual("aha", llsdSimpleMapTwo["tes1"].AsString());
- Assert.AreEqual(LLSDType.Integer, llsdSimpleMapTwo["t0st"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSimpleMapTwo["t0st"].Type);
Assert.AreEqual(241, llsdSimpleMapTwo["t0st"].AsInteger());
@@ -512,32 +512,32 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeDictionary()
{
- LLSDMap llsdEmptyMap = new LLSDMap();
- byte[] binaryEmptyMapSerialized = LLSDParser.SerializeBinary(llsdEmptyMap);
+ OSDMap llsdEmptyMap = new OSDMap();
+ byte[] binaryEmptyMapSerialized = LLSDParser.SerializeLLSDBinary(llsdEmptyMap);
Assert.AreEqual(binaryEmptyMap, binaryEmptyMapSerialized);
- LLSDMap llsdSimpleMap = new LLSDMap();
- llsdSimpleMap["test"] = LLSD.FromInteger(0);
- byte[] binarySimpleMapSerialized = LLSDParser.SerializeBinary(llsdSimpleMap);
+ OSDMap llsdSimpleMap = new OSDMap();
+ llsdSimpleMap["test"] = OSD.FromInteger(0);
+ byte[] binarySimpleMapSerialized = LLSDParser.SerializeLLSDBinary(llsdSimpleMap);
Assert.AreEqual(binarySimpleMap, binarySimpleMapSerialized);
- LLSDMap llsdSimpleMapTwo = new LLSDMap();
- llsdSimpleMapTwo["t0st"] = LLSD.FromInteger(241);
- llsdSimpleMapTwo["tes1"] = LLSD.FromString("aha");
- llsdSimpleMapTwo["test"] = new LLSD();
- byte[] binarySimpleMapTwoSerialized = LLSDParser.SerializeBinary(llsdSimpleMapTwo);
+ OSDMap llsdSimpleMapTwo = new OSDMap();
+ llsdSimpleMapTwo["t0st"] = OSD.FromInteger(241);
+ llsdSimpleMapTwo["tes1"] = OSD.FromString("aha");
+ llsdSimpleMapTwo["test"] = new OSD();
+ byte[] binarySimpleMapTwoSerialized = LLSDParser.SerializeLLSDBinary(llsdSimpleMapTwo);
// We dont compare here to the original serialized value, because, as maps dont preserve order,
// the original serialized value is not *exactly* the same. Instead we compare to a deserialized
// version created by this deserializer.
- LLSDMap llsdSimpleMapDeserialized = (LLSDMap)LLSDParser.DeserializeBinary(binarySimpleMapTwoSerialized);
- Assert.AreEqual(LLSDType.Map, llsdSimpleMapDeserialized.Type);
+ OSDMap llsdSimpleMapDeserialized = (OSDMap)LLSDParser.DeserializeLLSDBinary(binarySimpleMapTwoSerialized);
+ Assert.AreEqual(OSDType.Map, llsdSimpleMapDeserialized.Type);
Assert.AreEqual(3, llsdSimpleMapDeserialized.Count);
- Assert.AreEqual(LLSDType.Integer, llsdSimpleMapDeserialized["t0st"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSimpleMapDeserialized["t0st"].Type);
Assert.AreEqual(241, llsdSimpleMapDeserialized["t0st"].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdSimpleMapDeserialized["tes1"].Type);
+ Assert.AreEqual(OSDType.String, llsdSimpleMapDeserialized["tes1"].Type);
Assert.AreEqual("aha", llsdSimpleMapDeserialized["tes1"].AsString());
- Assert.AreEqual(LLSDType.Unknown, llsdSimpleMapDeserialized["test"].Type);
+ Assert.AreEqual(OSDType.Unknown, llsdSimpleMapDeserialized["test"].Type);
// we also test for a 4byte key character.
string xml = "𐄷";
@@ -547,14 +547,14 @@ namespace OpenMetaverse.Tests
xtr.Read();
string content = xtr.ReadString();
- LLSDMap llsdSimpleMapThree = new LLSDMap();
- LLSD llsdSimpleValue = LLSD.FromString(content);
+ OSDMap llsdSimpleMapThree = new OSDMap();
+ OSD llsdSimpleValue = OSD.FromString(content);
llsdSimpleMapThree[content] = llsdSimpleValue;
Assert.AreEqual(content, llsdSimpleMapThree[content].AsString());
- byte[] binarySimpleMapThree = LLSDParser.SerializeBinary(llsdSimpleMapThree);
- LLSDMap llsdSimpleMapThreeDS = (LLSDMap)LLSDParser.DeserializeBinary(binarySimpleMapThree);
- Assert.AreEqual(LLSDType.Map, llsdSimpleMapThreeDS.Type);
+ byte[] binarySimpleMapThree = LLSDParser.SerializeLLSDBinary(llsdSimpleMapThree);
+ OSDMap llsdSimpleMapThreeDS = (OSDMap)LLSDParser.DeserializeLLSDBinary(binarySimpleMapThree);
+ Assert.AreEqual(OSDType.Map, llsdSimpleMapThreeDS.Type);
Assert.AreEqual(1, llsdSimpleMapThreeDS.Count);
Assert.AreEqual(content, llsdSimpleMapThreeDS[content].AsString());
@@ -579,33 +579,33 @@ namespace OpenMetaverse.Tests
[Test()]
public void DeserializeNestedComposite()
{
- LLSD llsdNested = LLSDParser.DeserializeBinary(binaryNested);
- Assert.AreEqual(LLSDType.Array, llsdNested.Type);
- LLSDArray llsdArray = (LLSDArray)llsdNested;
+ OSD llsdNested = LLSDParser.DeserializeLLSDBinary(binaryNested);
+ Assert.AreEqual(OSDType.Array, llsdNested.Type);
+ OSDArray llsdArray = (OSDArray)llsdNested;
Assert.AreEqual(3, llsdArray.Count);
- LLSDMap llsdMap = (LLSDMap)llsdArray[0];
- Assert.AreEqual(LLSDType.Map, llsdMap.Type);
+ OSDMap llsdMap = (OSDMap)llsdArray[0];
+ Assert.AreEqual(OSDType.Map, llsdMap.Type);
Assert.AreEqual(2, llsdMap.Count);
- LLSDArray llsdNestedArray = (LLSDArray)llsdMap["t0st"];
- Assert.AreEqual(LLSDType.Array, llsdNestedArray.Type);
- LLSDInteger llsdNestedIntOne = (LLSDInteger)llsdNestedArray[0];
- Assert.AreEqual(LLSDType.Integer, llsdNestedIntOne.Type);
+ OSDArray llsdNestedArray = (OSDArray)llsdMap["t0st"];
+ Assert.AreEqual(OSDType.Array, llsdNestedArray.Type);
+ OSDInteger llsdNestedIntOne = (OSDInteger)llsdNestedArray[0];
+ Assert.AreEqual(OSDType.Integer, llsdNestedIntOne.Type);
Assert.AreEqual(1, llsdNestedIntOne.AsInteger());
- LLSDInteger llsdNestedIntTwo = (LLSDInteger)llsdNestedArray[1];
- Assert.AreEqual(LLSDType.Integer, llsdNestedIntTwo.Type);
+ OSDInteger llsdNestedIntTwo = (OSDInteger)llsdNestedArray[1];
+ Assert.AreEqual(OSDType.Integer, llsdNestedIntTwo.Type);
Assert.AreEqual(2, llsdNestedIntTwo.AsInteger());
- LLSDString llsdString = (LLSDString)llsdMap["test"];
- Assert.AreEqual(LLSDType.String, llsdString.Type);
+ OSDString llsdString = (OSDString)llsdMap["test"];
+ Assert.AreEqual(OSDType.String, llsdString.Type);
Assert.AreEqual("what", llsdString.AsString());
- LLSDInteger llsdIntOne = (LLSDInteger)llsdArray[1];
- Assert.AreEqual(LLSDType.Integer, llsdIntOne.Type);
+ OSDInteger llsdIntOne = (OSDInteger)llsdArray[1];
+ Assert.AreEqual(OSDType.Integer, llsdIntOne.Type);
Assert.AreEqual(124, llsdIntOne.AsInteger());
- LLSDInteger llsdIntTwo = (LLSDInteger)llsdArray[2];
- Assert.AreEqual(LLSDType.Integer, llsdIntTwo.Type);
+ OSDInteger llsdIntTwo = (OSDInteger)llsdArray[2];
+ Assert.AreEqual(OSDType.Integer, llsdIntTwo.Type);
Assert.AreEqual(987, llsdIntTwo.AsInteger());
}
@@ -613,43 +613,43 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeNestedComposite()
{
- LLSDArray llsdNested = new LLSDArray();
- LLSDMap llsdMap = new LLSDMap();
- LLSDArray llsdArray = new LLSDArray();
- llsdArray.Add(LLSD.FromInteger(1));
- llsdArray.Add(LLSD.FromInteger(2));
+ OSDArray llsdNested = new OSDArray();
+ OSDMap llsdMap = new OSDMap();
+ OSDArray llsdArray = new OSDArray();
+ llsdArray.Add(OSD.FromInteger(1));
+ llsdArray.Add(OSD.FromInteger(2));
llsdMap["t0st"] = llsdArray;
- llsdMap["test"] = LLSD.FromString("what");
+ llsdMap["test"] = OSD.FromString("what");
llsdNested.Add(llsdMap);
- llsdNested.Add(LLSD.FromInteger(124));
- llsdNested.Add(LLSD.FromInteger(987));
+ llsdNested.Add(OSD.FromInteger(124));
+ llsdNested.Add(OSD.FromInteger(987));
- byte[] binaryNestedSerialized = LLSDParser.SerializeBinary(llsdNested);
+ byte[] binaryNestedSerialized = LLSDParser.SerializeLLSDBinary(llsdNested);
// Because maps don't preserve order, we compare here to a deserialized value.
- LLSDArray llsdNestedDeserialized = (LLSDArray)LLSDParser.DeserializeBinary(binaryNestedSerialized);
- Assert.AreEqual(LLSDType.Array, llsdNestedDeserialized.Type);
+ OSDArray llsdNestedDeserialized = (OSDArray)LLSDParser.DeserializeLLSDBinary(binaryNestedSerialized);
+ Assert.AreEqual(OSDType.Array, llsdNestedDeserialized.Type);
Assert.AreEqual(3, llsdNestedDeserialized.Count);
- LLSDMap llsdMapDeserialized = (LLSDMap)llsdNestedDeserialized[0];
- Assert.AreEqual(LLSDType.Map, llsdMapDeserialized.Type);
+ OSDMap llsdMapDeserialized = (OSDMap)llsdNestedDeserialized[0];
+ Assert.AreEqual(OSDType.Map, llsdMapDeserialized.Type);
Assert.AreEqual(2, llsdMapDeserialized.Count);
- Assert.AreEqual(LLSDType.Array, llsdMapDeserialized["t0st"].Type);
+ Assert.AreEqual(OSDType.Array, llsdMapDeserialized["t0st"].Type);
- LLSDArray llsdNestedArray = (LLSDArray)llsdMapDeserialized["t0st"];
- Assert.AreEqual(LLSDType.Array, llsdNestedArray.Type);
+ OSDArray llsdNestedArray = (OSDArray)llsdMapDeserialized["t0st"];
+ Assert.AreEqual(OSDType.Array, llsdNestedArray.Type);
Assert.AreEqual(2, llsdNestedArray.Count);
- Assert.AreEqual(LLSDType.Integer, llsdNestedArray[0].Type);
+ Assert.AreEqual(OSDType.Integer, llsdNestedArray[0].Type);
Assert.AreEqual(1, llsdNestedArray[0].AsInteger());
- Assert.AreEqual(LLSDType.Integer, llsdNestedArray[1].Type);
+ Assert.AreEqual(OSDType.Integer, llsdNestedArray[1].Type);
Assert.AreEqual(2, llsdNestedArray[1].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdMapDeserialized["test"].Type);
+ Assert.AreEqual(OSDType.String, llsdMapDeserialized["test"].Type);
Assert.AreEqual("what", llsdMapDeserialized["test"].AsString());
- Assert.AreEqual(LLSDType.Integer, llsdNestedDeserialized[1].Type);
+ Assert.AreEqual(OSDType.Integer, llsdNestedDeserialized[1].Type);
Assert.AreEqual(124, llsdNestedDeserialized[1].AsInteger());
- Assert.AreEqual(LLSDType.Integer, llsdNestedDeserialized[2].Type);
+ Assert.AreEqual(OSDType.Integer, llsdNestedDeserialized[2].Type);
Assert.AreEqual(987, llsdNestedDeserialized[2].AsInteger());
}
@@ -661,10 +661,10 @@ namespace OpenMetaverse.Tests
string sOne = "asdklfjasadlfkjaerotiudfgjkhsdklgjhsdklfghasdfklhjasdfkjhasdfkljahsdfjklaasdfkj8";
string sTwo = "asdfkjlaaweoiugsdfjkhsdfg,.mnasdgfkljhrtuiohfglökajsdfoiwghjkdlaaaaseldkfjgheus9";
- LLSD stringOne = LLSD.FromString( sOne );
- LLSD stringTwo = LLSD.FromString(sTwo);
+ OSD stringOne = OSD.FromString( sOne );
+ OSD stringTwo = OSD.FromString(sTwo);
- LLSDMap llsdMap = new LLSDMap();
+ OSDMap llsdMap = new OSDMap();
llsdMap["testOne"] = stringOne;
llsdMap["testTwo"] = stringTwo;
llsdMap["testThree"] = stringOne;
@@ -677,10 +677,10 @@ namespace OpenMetaverse.Tests
llsdMap["testTen"] = stringTwo;
- byte[] binaryData = LLSDParser.SerializeBinary( llsdMap );
+ byte[] binaryData = LLSDParser.SerializeLLSDBinary( llsdMap );
- LLSDMap llsdMapDS = (LLSDMap)LLSDParser.DeserializeBinary( binaryData );
- Assert.AreEqual( LLSDType.Map, llsdMapDS.Type );
+ OSDMap llsdMapDS = (OSDMap)LLSDParser.DeserializeLLSDBinary( binaryData );
+ Assert.AreEqual( OSDType.Map, llsdMapDS.Type );
Assert.AreEqual( 10, llsdMapDS.Count );
Assert.AreEqual( sOne, llsdMapDS["testOne"].AsString());
Assert.AreEqual( sTwo, llsdMapDS["testTwo"].AsString());
@@ -727,4 +727,4 @@ namespace OpenMetaverse.Tests
return ret;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenMetaverse.Tests/NotationLLSDTests.cs b/OpenMetaverse.Tests/NotationLLSDTests.cs
index 67612382..37d4e793 100644
--- a/OpenMetaverse.Tests/NotationLLSDTests.cs
+++ b/OpenMetaverse.Tests/NotationLLSDTests.cs
@@ -28,7 +28,7 @@
*
* This tests are based upon the description at
*
- * http://wiki.secondlife.com/wiki/LLSD
+ * http://wiki.secondlife.com/wiki/SD
*
* and (partially) generated by the (supposed) reference implementation at
*
@@ -47,7 +47,7 @@ namespace OpenMetaverse.Tests
{
[TestFixture()]
- public class NotationLLSDTests
+ public class NotationSDTests
{
[Test()]
public void HelperFunctions()
@@ -80,87 +80,87 @@ namespace OpenMetaverse.Tests
public void DeserializeUndef()
{
String s = "!";
- LLSD llsd = LLSDParser.DeserializeNotation(s);
- Assert.AreEqual(LLSDType.Unknown, llsd.Type);
+ OSD llsd = LLSDParser.DeserializeLLSDNotation(s);
+ Assert.AreEqual(OSDType.Unknown, llsd.Type);
}
[Test()]
public void SerializeUndef()
{
- LLSD llsd = new LLSD();
- string s = LLSDParser.SerializeNotation(llsd);
+ OSD llsd = new OSD();
+ string s = LLSDParser.SerializeLLSDNotation(llsd);
- LLSD llsdDS = LLSDParser.DeserializeNotation(s);
- Assert.AreEqual(LLSDType.Unknown, llsdDS.Type);
+ OSD llsdDS = LLSDParser.DeserializeLLSDNotation(s);
+ Assert.AreEqual(OSDType.Unknown, llsdDS.Type);
}
[Test()]
public void DeserializeBoolean()
{
String t = "true";
- LLSD llsdT = LLSDParser.DeserializeNotation(t);
- Assert.AreEqual(LLSDType.Boolean, llsdT.Type);
+ OSD llsdT = LLSDParser.DeserializeLLSDNotation(t);
+ Assert.AreEqual(OSDType.Boolean, llsdT.Type);
Assert.AreEqual(true, llsdT.AsBoolean());
String tTwo = "t";
- LLSD llsdTTwo = LLSDParser.DeserializeNotation(tTwo);
- Assert.AreEqual(LLSDType.Boolean, llsdTTwo.Type);
+ OSD llsdTTwo = LLSDParser.DeserializeLLSDNotation(tTwo);
+ Assert.AreEqual(OSDType.Boolean, llsdTTwo.Type);
Assert.AreEqual(true, llsdTTwo.AsBoolean());
String tThree = "TRUE";
- LLSD llsdTThree = LLSDParser.DeserializeNotation(tThree);
- Assert.AreEqual(LLSDType.Boolean, llsdTThree.Type);
+ OSD llsdTThree = LLSDParser.DeserializeLLSDNotation(tThree);
+ Assert.AreEqual(OSDType.Boolean, llsdTThree.Type);
Assert.AreEqual(true, llsdTThree.AsBoolean());
String tFour = "T";
- LLSD llsdTFour = LLSDParser.DeserializeNotation(tFour);
- Assert.AreEqual(LLSDType.Boolean, llsdTFour.Type);
+ OSD llsdTFour = LLSDParser.DeserializeLLSDNotation(tFour);
+ Assert.AreEqual(OSDType.Boolean, llsdTFour.Type);
Assert.AreEqual(true, llsdTFour.AsBoolean());
String tFive = "1";
- LLSD llsdTFive = LLSDParser.DeserializeNotation(tFive);
- Assert.AreEqual(LLSDType.Boolean, llsdTFive.Type);
+ OSD llsdTFive = LLSDParser.DeserializeLLSDNotation(tFive);
+ Assert.AreEqual(OSDType.Boolean, llsdTFive.Type);
Assert.AreEqual(true, llsdTFive.AsBoolean());
String f = "false";
- LLSD llsdF = LLSDParser.DeserializeNotation(f);
- Assert.AreEqual(LLSDType.Boolean, llsdF.Type);
+ OSD llsdF = LLSDParser.DeserializeLLSDNotation(f);
+ Assert.AreEqual(OSDType.Boolean, llsdF.Type);
Assert.AreEqual(false, llsdF.AsBoolean());
String fTwo = "f";
- LLSD llsdFTwo = LLSDParser.DeserializeNotation(fTwo);
- Assert.AreEqual(LLSDType.Boolean, llsdFTwo.Type);
+ OSD llsdFTwo = LLSDParser.DeserializeLLSDNotation(fTwo);
+ Assert.AreEqual(OSDType.Boolean, llsdFTwo.Type);
Assert.AreEqual(false, llsdFTwo.AsBoolean());
String fThree = "FALSE";
- LLSD llsdFThree = LLSDParser.DeserializeNotation(fThree);
- Assert.AreEqual(LLSDType.Boolean, llsdFThree.Type);
+ OSD llsdFThree = LLSDParser.DeserializeLLSDNotation(fThree);
+ Assert.AreEqual(OSDType.Boolean, llsdFThree.Type);
Assert.AreEqual(false, llsdFThree.AsBoolean());
String fFour = "F";
- LLSD llsdFFour = LLSDParser.DeserializeNotation(fFour);
- Assert.AreEqual(LLSDType.Boolean, llsdFFour.Type);
+ OSD llsdFFour = LLSDParser.DeserializeLLSDNotation(fFour);
+ Assert.AreEqual(OSDType.Boolean, llsdFFour.Type);
Assert.AreEqual(false, llsdFFour.AsBoolean());
String fFive = "0";
- LLSD llsdFFive = LLSDParser.DeserializeNotation(fFive);
- Assert.AreEqual(LLSDType.Boolean, llsdFFive.Type);
+ OSD llsdFFive = LLSDParser.DeserializeLLSDNotation(fFive);
+ Assert.AreEqual(OSDType.Boolean, llsdFFive.Type);
Assert.AreEqual(false, llsdFFive.AsBoolean());
}
[Test()]
public void SerializeBoolean()
{
- LLSD llsdTrue = LLSD.FromBoolean(true);
- string sTrue = LLSDParser.SerializeNotation(llsdTrue);
- LLSD llsdTrueDS = LLSDParser.DeserializeNotation(sTrue);
- Assert.AreEqual(LLSDType.Boolean, llsdTrueDS.Type);
+ OSD llsdTrue = OSD.FromBoolean(true);
+ string sTrue = LLSDParser.SerializeLLSDNotation(llsdTrue);
+ OSD llsdTrueDS = LLSDParser.DeserializeLLSDNotation(sTrue);
+ Assert.AreEqual(OSDType.Boolean, llsdTrueDS.Type);
Assert.AreEqual(true, llsdTrueDS.AsBoolean());
- LLSD llsdFalse = LLSD.FromBoolean(false);
- string sFalse = LLSDParser.SerializeNotation(llsdFalse);
- LLSD llsdFalseDS = LLSDParser.DeserializeNotation(sFalse);
- Assert.AreEqual(LLSDType.Boolean, llsdFalseDS.Type);
+ OSD llsdFalse = OSD.FromBoolean(false);
+ string sFalse = LLSDParser.SerializeLLSDNotation(llsdFalse);
+ OSD llsdFalseDS = LLSDParser.DeserializeLLSDNotation(sFalse);
+ Assert.AreEqual(OSDType.Boolean, llsdFalseDS.Type);
Assert.AreEqual(false, llsdFalseDS.AsBoolean());
}
@@ -168,29 +168,29 @@ namespace OpenMetaverse.Tests
public void DeserializeInteger()
{
string integerOne = "i12319423";
- LLSD llsdOne = LLSDParser.DeserializeNotation(integerOne);
- Assert.AreEqual(LLSDType.Integer, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(integerOne);
+ Assert.AreEqual(OSDType.Integer, llsdOne.Type);
Assert.AreEqual(12319423, llsdOne.AsInteger());
string integerTwo = "i-489234";
- LLSD llsdTwo = LLSDParser.DeserializeNotation(integerTwo);
- Assert.AreEqual(LLSDType.Integer, llsdTwo.Type);
+ OSD llsdTwo = LLSDParser.DeserializeLLSDNotation(integerTwo);
+ Assert.AreEqual(OSDType.Integer, llsdTwo.Type);
Assert.AreEqual(-489234, llsdTwo.AsInteger());
}
[Test()]
public void SerializeInteger()
{
- LLSD llsdOne = LLSD.FromInteger(12319423);
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.Integer, llsdOneDS.Type);
+ OSD llsdOne = OSD.FromInteger(12319423);
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.Integer, llsdOneDS.Type);
Assert.AreEqual(12319423, llsdOne.AsInteger());
- LLSD llsdTwo = LLSD.FromInteger(-71892034);
- string sTwo = LLSDParser.SerializeNotation(llsdTwo);
- LLSD llsdTwoDS = LLSDParser.DeserializeNotation(sTwo);
- Assert.AreEqual(LLSDType.Integer, llsdTwoDS.Type);
+ OSD llsdTwo = OSD.FromInteger(-71892034);
+ string sTwo = LLSDParser.SerializeLLSDNotation(llsdTwo);
+ OSD llsdTwoDS = LLSDParser.DeserializeLLSDNotation(sTwo);
+ Assert.AreEqual(OSDType.Integer, llsdTwoDS.Type);
Assert.AreEqual(-71892034, llsdTwoDS.AsInteger());
}
@@ -198,71 +198,71 @@ namespace OpenMetaverse.Tests
public void DeserializeReal()
{
String realOne = "r1123412345.465711";
- LLSD llsdOne = LLSDParser.DeserializeNotation(realOne);
- Assert.AreEqual(LLSDType.Real, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(realOne);
+ Assert.AreEqual(OSDType.Real, llsdOne.Type);
Assert.AreEqual(1123412345.465711d, llsdOne.AsReal());
String realTwo = "r-11234684.923411";
- LLSD llsdTwo = LLSDParser.DeserializeNotation(realTwo);
- Assert.AreEqual(LLSDType.Real, llsdTwo.Type);
+ OSD llsdTwo = LLSDParser.DeserializeLLSDNotation(realTwo);
+ Assert.AreEqual(OSDType.Real, llsdTwo.Type);
Assert.AreEqual(-11234684.923411d, llsdTwo.AsReal());
String realThree = "r1";
- LLSD llsdThree = LLSDParser.DeserializeNotation(realThree);
- Assert.AreEqual(LLSDType.Real, llsdThree.Type);
+ OSD llsdThree = LLSDParser.DeserializeLLSDNotation(realThree);
+ Assert.AreEqual(OSDType.Real, llsdThree.Type);
Assert.AreEqual(1d, llsdThree.AsReal());
String realFour = "r2.0193899999999998204e-06";
- LLSD llsdFour = LLSDParser.DeserializeNotation(realFour);
- Assert.AreEqual(LLSDType.Real, llsdFour.Type);
+ OSD llsdFour = LLSDParser.DeserializeLLSDNotation(realFour);
+ Assert.AreEqual(OSDType.Real, llsdFour.Type);
Assert.AreEqual(2.0193899999999998204e-06d, llsdFour.AsReal());
String realFive = "r0";
- LLSD llsdFive = LLSDParser.DeserializeNotation(realFive);
- Assert.AreEqual(LLSDType.Real, llsdFive.Type);
+ OSD llsdFive = LLSDParser.DeserializeLLSDNotation(realFive);
+ Assert.AreEqual(OSDType.Real, llsdFive.Type);
Assert.AreEqual(0d, llsdFive.AsReal());
}
[Test()]
public void SerializeReal()
{
- LLSD llsdOne = LLSD.FromReal(12987234.723847d);
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.Real, llsdOneDS.Type);
+ OSD llsdOne = OSD.FromReal(12987234.723847d);
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.Real, llsdOneDS.Type);
Assert.AreEqual(12987234.723847d, llsdOneDS.AsReal());
- LLSD llsdTwo = LLSD.FromReal(-32347892.234234d);
- string sTwo = LLSDParser.SerializeNotation(llsdTwo);
- LLSD llsdTwoDS = LLSDParser.DeserializeNotation(sTwo);
- Assert.AreEqual(LLSDType.Real, llsdTwoDS.Type);
+ OSD llsdTwo = OSD.FromReal(-32347892.234234d);
+ string sTwo = LLSDParser.SerializeLLSDNotation(llsdTwo);
+ OSD llsdTwoDS = LLSDParser.DeserializeLLSDNotation(sTwo);
+ Assert.AreEqual(OSDType.Real, llsdTwoDS.Type);
Assert.AreEqual(-32347892.234234d, llsdTwoDS.AsReal());
/* The following two tests don't pass on mono 1.9, as
* mono isnt able to parse its own Double.Max/MinValue.
*/
- // LLSD llsdThree = LLSD.FromReal( Double.MaxValue );
- // string sThree = LLSDParser.SerializeNotation( llsdThree );
- // LLSD llsdThreeDS = LLSDParser.DeserializeNotation( sThree );
- // Assert.AreEqual( LLSDType.Real, llsdThreeDS.Type );
+ // SD llsdThree = SD.FromReal( Double.MaxValue );
+ // string sThree = LLSDParser.SerializeLLSDNotation( llsdThree );
+ // SD llsdThreeDS = LLSDParser.DeserializeLLSDNotation( sThree );
+ // Assert.AreEqual( SDType.Real, llsdThreeDS.Type );
// Assert.AreEqual( Double.MaxValue, llsdThreeDS.AsReal());
//
- // LLSD llsdFour = LLSD.FromReal( Double.MinValue );
- // string sFour = LLSDParser.SerializeNotation( llsdFour );
- // LLSD llsdFourDS = LLSDParser.DeserializeNotation( sFour );
- // Assert.AreEqual( LLSDType.Real, llsdFourDS.Type );
+ // SD llsdFour = SD.FromReal( Double.MinValue );
+ // string sFour = LLSDParser.SerializeLLSDNotation( llsdFour );
+ // SD llsdFourDS = LLSDParser.DeserializeLLSDNotation( sFour );
+ // Assert.AreEqual( SDType.Real, llsdFourDS.Type );
// Assert.AreEqual( Double.MinValue, llsdFourDS.AsReal());
- LLSD llsdFive = LLSD.FromReal(-1.1123123E+50d);
- string sFive = LLSDParser.SerializeNotation(llsdFive);
- LLSD llsdFiveDS = LLSDParser.DeserializeNotation(sFive);
- Assert.AreEqual(LLSDType.Real, llsdFiveDS.Type);
+ OSD llsdFive = OSD.FromReal(-1.1123123E+50d);
+ string sFive = LLSDParser.SerializeLLSDNotation(llsdFive);
+ OSD llsdFiveDS = LLSDParser.DeserializeLLSDNotation(sFive);
+ Assert.AreEqual(OSDType.Real, llsdFiveDS.Type);
Assert.AreEqual(-1.1123123E+50d, llsdFiveDS.AsReal());
- LLSD llsdSix = LLSD.FromReal(2.0193899999999998204e-06);
- string sSix = LLSDParser.SerializeNotation(llsdSix);
- LLSD llsdSixDS = LLSDParser.DeserializeNotation(sSix);
- Assert.AreEqual(LLSDType.Real, llsdSixDS.Type);
+ OSD llsdSix = OSD.FromReal(2.0193899999999998204e-06);
+ string sSix = LLSDParser.SerializeLLSDNotation(llsdSix);
+ OSD llsdSixDS = LLSDParser.DeserializeLLSDNotation(sSix);
+ Assert.AreEqual(OSDType.Real, llsdSixDS.Type);
Assert.AreEqual(2.0193899999999998204e-06, llsdSixDS.AsReal());
@@ -272,43 +272,43 @@ namespace OpenMetaverse.Tests
public void DeserializeUUID()
{
String uuidOne = "u97f4aeca-88a1-42a1-b385-b97b18abb255";
- LLSD llsdOne = LLSDParser.DeserializeNotation(uuidOne);
- Assert.AreEqual(LLSDType.UUID, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(uuidOne);
+ Assert.AreEqual(OSDType.UUID, llsdOne.Type);
Assert.AreEqual("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdOne.AsString());
String uuidTwo = "u00000000-0000-0000-0000-000000000000";
- LLSD llsdTwo = LLSDParser.DeserializeNotation(uuidTwo);
- Assert.AreEqual(LLSDType.UUID, llsdTwo.Type);
+ OSD llsdTwo = LLSDParser.DeserializeLLSDNotation(uuidTwo);
+ Assert.AreEqual(OSDType.UUID, llsdTwo.Type);
Assert.AreEqual("00000000-0000-0000-0000-000000000000", llsdTwo.AsString());
}
[Test()]
public void SerializeUUID()
{
- LLSD llsdOne = LLSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.UUID, llsdOneDS.Type);
+ OSD llsdOne = OSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.UUID, llsdOneDS.Type);
Assert.AreEqual("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdOneDS.AsString());
- LLSD llsdTwo = LLSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
- string sTwo = LLSDParser.SerializeNotation(llsdTwo);
- LLSD llsdTwoDS = LLSDParser.DeserializeNotation(sTwo);
- Assert.AreEqual(LLSDType.UUID, llsdTwoDS.Type);
+ OSD llsdTwo = OSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
+ string sTwo = LLSDParser.SerializeLLSDNotation(llsdTwo);
+ OSD llsdTwoDS = LLSDParser.DeserializeLLSDNotation(sTwo);
+ Assert.AreEqual(OSDType.UUID, llsdTwoDS.Type);
Assert.AreEqual("00000000-0000-0000-0000-000000000000", llsdTwoDS.AsString());
}
public void DeserializeString()
{
string sOne = "''";
- LLSD llsdOne = LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.String, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.String, llsdOne.Type);
Assert.AreEqual("", llsdOne.AsString());
// This is double escaping. Once for the encoding, and once for csharp.
string sTwo = "'test\\'\"test'";
- LLSD llsdTwo = LLSDParser.DeserializeNotation(sTwo);
- Assert.AreEqual(LLSDType.String, llsdTwo.Type);
+ OSD llsdTwo = LLSDParser.DeserializeLLSDNotation(sTwo);
+ Assert.AreEqual(OSDType.String, llsdTwo.Type);
Assert.AreEqual("test'\"test", llsdTwo.AsString());
// "test \\lest"
@@ -316,35 +316,35 @@ namespace OpenMetaverse.Tests
(char)0x5c, (char)0x6c, (char)0x65, (char)0x73, (char)0x74, (char)0x27 };
string sThree = new string(cThree);
- LLSD llsdThree = LLSDParser.DeserializeNotation(sThree);
- Assert.AreEqual(LLSDType.String, llsdThree.Type);
+ OSD llsdThree = LLSDParser.DeserializeLLSDNotation(sThree);
+ Assert.AreEqual(OSDType.String, llsdThree.Type);
Assert.AreEqual("test \\lest", llsdThree.AsString());
string sFour = "'aa\t la'";
- LLSD llsdFour = LLSDParser.DeserializeNotation(sFour);
- Assert.AreEqual(LLSDType.String, llsdFour.Type);
+ OSD llsdFour = LLSDParser.DeserializeLLSDNotation(sFour);
+ Assert.AreEqual(OSDType.String, llsdFour.Type);
Assert.AreEqual("aa\t la", llsdFour.AsString());
char[] cFive = { (char)0x27, (char)0x5c, (char)0x5c, (char)0x27 };
string sFive = new String(cFive);
- LLSD llsdFive = LLSDParser.DeserializeNotation(sFive);
- Assert.AreEqual(LLSDType.String, llsdFive.Type);
+ OSD llsdFive = LLSDParser.DeserializeLLSDNotation(sFive);
+ Assert.AreEqual(OSDType.String, llsdFive.Type);
Assert.AreEqual("\\", llsdFive.AsString());
string sSix = "s(10)\"1234567890\"";
- LLSD llsdSix = LLSDParser.DeserializeNotation(sSix);
- Assert.AreEqual(LLSDType.String, llsdSix.Type);
+ OSD llsdSix = LLSDParser.DeserializeLLSDNotation(sSix);
+ Assert.AreEqual(OSDType.String, llsdSix.Type);
Assert.AreEqual("1234567890", llsdSix.AsString());
string sSeven = "s(5)\"\\\\\\\\\\\"";
- LLSD llsdSeven = LLSDParser.DeserializeNotation(sSeven);
- Assert.AreEqual(LLSDType.String, llsdSeven.Type);
+ OSD llsdSeven = LLSDParser.DeserializeLLSDNotation(sSeven);
+ Assert.AreEqual(OSDType.String, llsdSeven.Type);
Assert.AreEqual("\\\\\\\\\\", llsdSeven.AsString());
string sEight = "\"aouAOUhsdjklfghskldjfghqeiurtzwieortzaslxfjkgh\"";
- LLSD llsdEight = LLSDParser.DeserializeNotation(sEight);
- Assert.AreEqual(LLSDType.String, llsdEight.Type);
+ OSD llsdEight = LLSDParser.DeserializeLLSDNotation(sEight);
+ Assert.AreEqual(OSDType.String, llsdEight.Type);
Assert.AreEqual("aouAOUhsdjklfghskldjfghqeiurtzwieortzaslxfjkgh", llsdEight.AsString());
@@ -353,10 +353,10 @@ namespace OpenMetaverse.Tests
public void DoSomeStringSerializingActionsAndAsserts(string s)
{
- LLSD llsdOne = LLSD.FromString(s);
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.String, llsdOne.Type);
+ OSD llsdOne = OSD.FromString(s);
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.String, llsdOne.Type);
Assert.AreEqual(s, llsdOneDS.AsString());
}
@@ -399,13 +399,13 @@ namespace OpenMetaverse.Tests
public void DeserializeURI()
{
string sUriOne = "l\"http://test.com/test test>\\\"/&yes\"";
- LLSD llsdOne = LLSDParser.DeserializeNotation(sUriOne);
- Assert.AreEqual(LLSDType.URI, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(sUriOne);
+ Assert.AreEqual(OSDType.URI, llsdOne.Type);
Assert.AreEqual("http://test.com/test test>\"/&yes", llsdOne.AsString());
string sUriTwo = "l\"test/test/test?test=1&toast=2\"";
- LLSD llsdTwo = LLSDParser.DeserializeNotation(sUriTwo);
- Assert.AreEqual(LLSDType.URI, llsdTwo.Type);
+ OSD llsdTwo = LLSDParser.DeserializeLLSDNotation(sUriTwo);
+ Assert.AreEqual(OSDType.URI, llsdTwo.Type);
Assert.AreEqual("test/test/test?test=1&toast=2", llsdTwo.AsString());
}
@@ -413,17 +413,17 @@ namespace OpenMetaverse.Tests
public void SerializeURI()
{
Uri uriOne = new Uri("http://test.org/test test>\\\"/&yes\"", UriKind.RelativeOrAbsolute);
- LLSD llsdOne = LLSD.FromUri(uriOne);
- string sUriOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sUriOne);
- Assert.AreEqual(LLSDType.URI, llsdOneDS.Type);
+ OSD llsdOne = OSD.FromUri(uriOne);
+ string sUriOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sUriOne);
+ Assert.AreEqual(OSDType.URI, llsdOneDS.Type);
Assert.AreEqual(uriOne, llsdOneDS.AsUri());
Uri uriTwo = new Uri("test/test/near/the/end?test=1", UriKind.RelativeOrAbsolute);
- LLSD llsdTwo = LLSD.FromUri(uriTwo);
- string sUriTwo = LLSDParser.SerializeNotation(llsdTwo);
- LLSD llsdTwoDS = LLSDParser.DeserializeNotation(sUriTwo);
- Assert.AreEqual(LLSDType.URI, llsdTwoDS.Type);
+ OSD llsdTwo = OSD.FromUri(uriTwo);
+ string sUriTwo = LLSDParser.SerializeLLSDNotation(llsdTwo);
+ OSD llsdTwoDS = LLSDParser.DeserializeLLSDNotation(sUriTwo);
+ Assert.AreEqual(OSDType.URI, llsdTwoDS.Type);
Assert.AreEqual(uriTwo, llsdTwoDS.AsUri());
}
@@ -431,8 +431,8 @@ namespace OpenMetaverse.Tests
public void DeserializeDate()
{
string sDateOne = "d\"2007-12-31T20:49:10Z\"";
- LLSD llsdOne = LLSDParser.DeserializeNotation(sDateOne);
- Assert.AreEqual(LLSDType.Date, llsdOne.Type);
+ OSD llsdOne = LLSDParser.DeserializeLLSDNotation(sDateOne);
+ Assert.AreEqual(OSDType.Date, llsdOne.Type);
DateTime dt = new DateTime(2007, 12, 31, 20, 49, 10, 0, DateTimeKind.Utc);
DateTime dtDS = llsdOne.AsDate();
Assert.AreEqual(dt, dtDS.ToUniversalTime());
@@ -442,27 +442,27 @@ namespace OpenMetaverse.Tests
public void SerializeDate()
{
DateTime dtOne = new DateTime(2005, 8, 10, 11, 23, 4, DateTimeKind.Utc);
- LLSD llsdOne = LLSD.FromDate(dtOne);
- string sDtOne = LLSDParser.SerializeNotation(llsdOne);
- LLSD llsdOneDS = LLSDParser.DeserializeNotation(sDtOne);
- Assert.AreEqual(LLSDType.Date, llsdOneDS.Type);
+ OSD llsdOne = OSD.FromDate(dtOne);
+ string sDtOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSD llsdOneDS = LLSDParser.DeserializeLLSDNotation(sDtOne);
+ Assert.AreEqual(OSDType.Date, llsdOneDS.Type);
DateTime dtOneDS = llsdOneDS.AsDate();
Assert.AreEqual(dtOne, dtOneDS.ToUniversalTime());
DateTime dtTwo = new DateTime(2010, 10, 11, 23, 00, 10, 100, DateTimeKind.Utc);
- LLSD llsdTwo = LLSD.FromDate(dtTwo);
- string sDtTwo = LLSDParser.SerializeNotation(llsdTwo);
- LLSD llsdTwoDS = LLSDParser.DeserializeNotation(sDtTwo);
- Assert.AreEqual(LLSDType.Date, llsdTwoDS.Type);
+ OSD llsdTwo = OSD.FromDate(dtTwo);
+ string sDtTwo = LLSDParser.SerializeLLSDNotation(llsdTwo);
+ OSD llsdTwoDS = LLSDParser.DeserializeLLSDNotation(sDtTwo);
+ Assert.AreEqual(OSDType.Date, llsdTwoDS.Type);
DateTime dtTwoDS = llsdTwoDS.AsDate();
Assert.AreEqual(dtTwo, dtTwoDS.ToUniversalTime());
// check if a *local* time can be serialized and deserialized
DateTime dtThree = new DateTime(2009, 12, 30, 8, 25, 10, DateTimeKind.Local);
- LLSD llsdDateThree = LLSD.FromDate(dtThree);
- string sDateThreeSerialized = LLSDParser.SerializeNotation(llsdDateThree);
- LLSD llsdDateThreeDS = LLSDParser.DeserializeNotation(sDateThreeSerialized);
- Assert.AreEqual(LLSDType.Date, llsdDateThreeDS.Type);
+ OSD llsdDateThree = OSD.FromDate(dtThree);
+ string sDateThreeSerialized = LLSDParser.SerializeLLSDNotation(llsdDateThree);
+ OSD llsdDateThreeDS = LLSDParser.DeserializeLLSDNotation(sDateThreeSerialized);
+ Assert.AreEqual(OSDType.Date, llsdDateThreeDS.Type);
Assert.AreEqual(dtThree, llsdDateThreeDS.AsDate());
}
@@ -472,10 +472,10 @@ namespace OpenMetaverse.Tests
byte[] binary = { 0x0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0b,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
- LLSD llsdBinary = LLSD.FromBinary(binary);
- string sBinarySerialized = LLSDParser.SerializeNotation(llsdBinary);
- LLSD llsdBinaryDS = LLSDParser.DeserializeNotation(sBinarySerialized);
- Assert.AreEqual(LLSDType.Binary, llsdBinaryDS.Type);
+ OSD llsdBinary = OSD.FromBinary(binary);
+ string sBinarySerialized = LLSDParser.SerializeLLSDNotation(llsdBinary);
+ OSD llsdBinaryDS = LLSDParser.DeserializeLLSDNotation(sBinarySerialized);
+ Assert.AreEqual(OSDType.Binary, llsdBinaryDS.Type);
Assert.AreEqual(binary, llsdBinaryDS.AsBinary());
}
@@ -483,32 +483,32 @@ namespace OpenMetaverse.Tests
public void DeserializeArray()
{
string sArrayOne = "[]";
- LLSDArray llsdArrayOne = (LLSDArray)LLSDParser.DeserializeNotation(sArrayOne);
- Assert.AreEqual(LLSDType.Array, llsdArrayOne.Type);
+ OSDArray llsdArrayOne = (OSDArray)LLSDParser.DeserializeLLSDNotation(sArrayOne);
+ Assert.AreEqual(OSDType.Array, llsdArrayOne.Type);
Assert.AreEqual(0, llsdArrayOne.Count);
string sArrayTwo = "[ i0 ]";
- LLSDArray llsdArrayTwo = (LLSDArray)LLSDParser.DeserializeNotation(sArrayTwo);
- Assert.AreEqual(LLSDType.Array, llsdArrayTwo.Type);
+ OSDArray llsdArrayTwo = (OSDArray)LLSDParser.DeserializeLLSDNotation(sArrayTwo);
+ Assert.AreEqual(OSDType.Array, llsdArrayTwo.Type);
Assert.AreEqual(1, llsdArrayTwo.Count);
- LLSDInteger llsdIntOne = (LLSDInteger)llsdArrayTwo[0];
- Assert.AreEqual(LLSDType.Integer, llsdIntOne.Type);
+ OSDInteger llsdIntOne = (OSDInteger)llsdArrayTwo[0];
+ Assert.AreEqual(OSDType.Integer, llsdIntOne.Type);
Assert.AreEqual(0, llsdIntOne.AsInteger());
string sArrayThree = "[ i0, i1 ]";
- LLSDArray llsdArrayThree = (LLSDArray)LLSDParser.DeserializeNotation(sArrayThree);
- Assert.AreEqual(LLSDType.Array, llsdArrayThree.Type);
+ OSDArray llsdArrayThree = (OSDArray)LLSDParser.DeserializeLLSDNotation(sArrayThree);
+ Assert.AreEqual(OSDType.Array, llsdArrayThree.Type);
Assert.AreEqual(2, llsdArrayThree.Count);
- LLSDInteger llsdIntTwo = (LLSDInteger)llsdArrayThree[0];
- Assert.AreEqual(LLSDType.Integer, llsdIntTwo.Type);
+ OSDInteger llsdIntTwo = (OSDInteger)llsdArrayThree[0];
+ Assert.AreEqual(OSDType.Integer, llsdIntTwo.Type);
Assert.AreEqual(0, llsdIntTwo.AsInteger());
- LLSDInteger llsdIntThree = (LLSDInteger)llsdArrayThree[1];
- Assert.AreEqual(LLSDType.Integer, llsdIntThree.Type);
+ OSDInteger llsdIntThree = (OSDInteger)llsdArrayThree[1];
+ Assert.AreEqual(OSDType.Integer, llsdIntThree.Type);
Assert.AreEqual(1, llsdIntThree.AsInteger());
string sArrayFour = " [ \"testtest\", \"aha\",t,f,i1, r1.2, [ i1] ] ";
- LLSDArray llsdArrayFour = (LLSDArray)LLSDParser.DeserializeNotation(sArrayFour);
- Assert.AreEqual(LLSDType.Array, llsdArrayFour.Type);
+ OSDArray llsdArrayFour = (OSDArray)LLSDParser.DeserializeLLSDNotation(sArrayFour);
+ Assert.AreEqual(OSDType.Array, llsdArrayFour.Type);
Assert.AreEqual(7, llsdArrayFour.Count);
Assert.AreEqual("testtest", llsdArrayFour[0].AsString());
Assert.AreEqual("aha", llsdArrayFour[1].AsString());
@@ -516,8 +516,8 @@ namespace OpenMetaverse.Tests
Assert.AreEqual(false, llsdArrayFour[3].AsBoolean());
Assert.AreEqual(1, llsdArrayFour[4].AsInteger());
Assert.AreEqual(1.2d, llsdArrayFour[5].AsReal());
- Assert.AreEqual(LLSDType.Array, llsdArrayFour[6].Type);
- LLSDArray llsdArrayFive = (LLSDArray)llsdArrayFour[6];
+ Assert.AreEqual(OSDType.Array, llsdArrayFour[6].Type);
+ OSDArray llsdArrayFive = (OSDArray)llsdArrayFour[6];
Assert.AreEqual(1, llsdArrayFive[0].AsInteger());
}
@@ -525,15 +525,15 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeArray()
{
- LLSDArray llsdOne = new LLSDArray();
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSDArray llsdOneDS = (LLSDArray)LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.Array, llsdOneDS.Type);
+ OSDArray llsdOne = new OSDArray();
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSDArray llsdOneDS = (OSDArray)LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.Array, llsdOneDS.Type);
Assert.AreEqual(0, llsdOneDS.Count);
- LLSD llsdTwo = LLSD.FromInteger(123234);
- LLSD llsdThree = LLSD.FromString("asedkfjhaqweiurohzasdf");
- LLSDArray llsdFour = new LLSDArray();
+ OSD llsdTwo = OSD.FromInteger(123234);
+ OSD llsdThree = OSD.FromString("asedkfjhaqweiurohzasdf");
+ OSDArray llsdFour = new OSDArray();
llsdFour.Add(llsdTwo);
llsdFour.Add(llsdThree);
@@ -541,21 +541,21 @@ namespace OpenMetaverse.Tests
llsdOne.Add(llsdThree);
llsdOne.Add(llsdFour);
- string sFive = LLSDParser.SerializeNotation(llsdOne);
- LLSDArray llsdFive = (LLSDArray)LLSDParser.DeserializeNotation(sFive);
- Assert.AreEqual(LLSDType.Array, llsdFive.Type);
+ string sFive = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSDArray llsdFive = (OSDArray)LLSDParser.DeserializeLLSDNotation(sFive);
+ Assert.AreEqual(OSDType.Array, llsdFive.Type);
Assert.AreEqual(3, llsdFive.Count);
- Assert.AreEqual(LLSDType.Integer, llsdFive[0].Type);
+ Assert.AreEqual(OSDType.Integer, llsdFive[0].Type);
Assert.AreEqual(123234, llsdFive[0].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdFive[1].Type);
+ Assert.AreEqual(OSDType.String, llsdFive[1].Type);
Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdFive[1].AsString());
- LLSDArray llsdSix = (LLSDArray)llsdFive[2];
- Assert.AreEqual(LLSDType.Array, llsdSix.Type);
+ OSDArray llsdSix = (OSDArray)llsdFive[2];
+ Assert.AreEqual(OSDType.Array, llsdSix.Type);
Assert.AreEqual(2, llsdSix.Count);
- Assert.AreEqual(LLSDType.Integer, llsdSix[0].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSix[0].Type);
Assert.AreEqual(123234, llsdSix[0].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdSix[1].Type);
+ Assert.AreEqual(OSDType.String, llsdSix[1].Type);
Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdSix[1].AsString());
}
@@ -563,39 +563,39 @@ namespace OpenMetaverse.Tests
public void DeserializeMap()
{
string sMapOne = " { } ";
- LLSDMap llsdMapOne = (LLSDMap)LLSDParser.DeserializeNotation(sMapOne);
- Assert.AreEqual(LLSDType.Map, llsdMapOne.Type);
+ OSDMap llsdMapOne = (OSDMap)LLSDParser.DeserializeLLSDNotation(sMapOne);
+ Assert.AreEqual(OSDType.Map, llsdMapOne.Type);
Assert.AreEqual(0, llsdMapOne.Count);
string sMapTwo = " { \"test\":i2 } ";
- LLSDMap llsdMapTwo = (LLSDMap)LLSDParser.DeserializeNotation(sMapTwo);
- Assert.AreEqual(LLSDType.Map, llsdMapTwo.Type);
+ OSDMap llsdMapTwo = (OSDMap)LLSDParser.DeserializeLLSDNotation(sMapTwo);
+ Assert.AreEqual(OSDType.Map, llsdMapTwo.Type);
Assert.AreEqual(1, llsdMapTwo.Count);
- Assert.AreEqual(LLSDType.Integer, llsdMapTwo["test"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdMapTwo["test"].Type);
Assert.AreEqual(2, llsdMapTwo["test"].AsInteger());
string sMapThree = " { 'test':\"testtesttest\", 'aha':\"muahahaha\" , \"anywhere\":! } ";
- LLSDMap llsdMapThree = (LLSDMap)LLSDParser.DeserializeNotation(sMapThree);
- Assert.AreEqual(LLSDType.Map, llsdMapThree.Type);
+ OSDMap llsdMapThree = (OSDMap)LLSDParser.DeserializeLLSDNotation(sMapThree);
+ Assert.AreEqual(OSDType.Map, llsdMapThree.Type);
Assert.AreEqual(3, llsdMapThree.Count);
- Assert.AreEqual(LLSDType.String, llsdMapThree["test"].Type);
+ Assert.AreEqual(OSDType.String, llsdMapThree["test"].Type);
Assert.AreEqual("testtesttest", llsdMapThree["test"].AsString());
- Assert.AreEqual(LLSDType.String, llsdMapThree["test"].Type);
+ Assert.AreEqual(OSDType.String, llsdMapThree["test"].Type);
Assert.AreEqual("muahahaha", llsdMapThree["aha"].AsString());
- Assert.AreEqual(LLSDType.Unknown, llsdMapThree["self"].Type);
+ Assert.AreEqual(OSDType.Unknown, llsdMapThree["self"].Type);
string sMapFour = " { 'test' : { 'test' : i1, 't0st' : r2.5 }, 'tist' : \"hello world!\", 'tast' : \"last\" } ";
- LLSDMap llsdMapFour = (LLSDMap)LLSDParser.DeserializeNotation(sMapFour);
- Assert.AreEqual(LLSDType.Map, llsdMapFour.Type);
+ OSDMap llsdMapFour = (OSDMap)LLSDParser.DeserializeLLSDNotation(sMapFour);
+ Assert.AreEqual(OSDType.Map, llsdMapFour.Type);
Assert.AreEqual(3, llsdMapFour.Count);
Assert.AreEqual("hello world!", llsdMapFour["tist"].AsString());
Assert.AreEqual("last", llsdMapFour["tast"].AsString());
- LLSDMap llsdMapFive = (LLSDMap)llsdMapFour["test"];
- Assert.AreEqual(LLSDType.Map, llsdMapFive.Type);
+ OSDMap llsdMapFive = (OSDMap)llsdMapFour["test"];
+ Assert.AreEqual(OSDType.Map, llsdMapFive.Type);
Assert.AreEqual(2, llsdMapFive.Count);
- Assert.AreEqual(LLSDType.Integer, llsdMapFive["test"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdMapFive["test"].Type);
Assert.AreEqual(1, llsdMapFive["test"].AsInteger());
- Assert.AreEqual(LLSDType.Real, llsdMapFive["t0st"].Type);
+ Assert.AreEqual(OSDType.Real, llsdMapFive["t0st"].Type);
Assert.AreEqual(2.5d, llsdMapFive["t0st"].AsReal());
}
@@ -603,15 +603,15 @@ namespace OpenMetaverse.Tests
[Test()]
public void SerializeMap()
{
- LLSDMap llsdOne = new LLSDMap();
- string sOne = LLSDParser.SerializeNotation(llsdOne);
- LLSDMap llsdOneDS = (LLSDMap)LLSDParser.DeserializeNotation(sOne);
- Assert.AreEqual(LLSDType.Map, llsdOneDS.Type);
+ OSDMap llsdOne = new OSDMap();
+ string sOne = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSDMap llsdOneDS = (OSDMap)LLSDParser.DeserializeLLSDNotation(sOne);
+ Assert.AreEqual(OSDType.Map, llsdOneDS.Type);
Assert.AreEqual(0, llsdOneDS.Count);
- LLSD llsdTwo = LLSD.FromInteger(123234);
- LLSD llsdThree = LLSD.FromString("asedkfjhaqweiurohzasdf");
- LLSDMap llsdFour = new LLSDMap();
+ OSD llsdTwo = OSD.FromInteger(123234);
+ OSD llsdThree = OSD.FromString("asedkfjhaqweiurohzasdf");
+ OSDMap llsdFour = new OSDMap();
llsdFour["test0"] = llsdTwo;
llsdFour["test1"] = llsdThree;
@@ -619,21 +619,21 @@ namespace OpenMetaverse.Tests
llsdOne["test1"] = llsdThree;
llsdOne["test2"] = llsdFour;
- string sFive = LLSDParser.SerializeNotation(llsdOne);
- LLSDMap llsdFive = (LLSDMap)LLSDParser.DeserializeNotation(sFive);
- Assert.AreEqual(LLSDType.Map, llsdFive.Type);
+ string sFive = LLSDParser.SerializeLLSDNotation(llsdOne);
+ OSDMap llsdFive = (OSDMap)LLSDParser.DeserializeLLSDNotation(sFive);
+ Assert.AreEqual(OSDType.Map, llsdFive.Type);
Assert.AreEqual(3, llsdFive.Count);
- Assert.AreEqual(LLSDType.Integer, llsdFive["test0"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdFive["test0"].Type);
Assert.AreEqual(123234, llsdFive["test0"].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdFive["test1"].Type);
+ Assert.AreEqual(OSDType.String, llsdFive["test1"].Type);
Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdFive["test1"].AsString());
- LLSDMap llsdSix = (LLSDMap)llsdFive["test2"];
- Assert.AreEqual(LLSDType.Map, llsdSix.Type);
+ OSDMap llsdSix = (OSDMap)llsdFive["test2"];
+ Assert.AreEqual(OSDType.Map, llsdSix.Type);
Assert.AreEqual(2, llsdSix.Count);
- Assert.AreEqual(LLSDType.Integer, llsdSix["test0"].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSix["test0"].Type);
Assert.AreEqual(123234, llsdSix["test0"].AsInteger());
- Assert.AreEqual(LLSDType.String, llsdSix["test1"].Type);
+ Assert.AreEqual(OSDType.String, llsdSix["test1"].Type);
Assert.AreEqual("asedkfjhaqweiurohzasdf", llsdSix["test1"].AsString());
// We test here also for 4byte characters as map keys
@@ -644,11 +644,11 @@ namespace OpenMetaverse.Tests
xtr.Read();
string content = xtr.ReadString();
- LLSDMap llsdSeven = new LLSDMap();
- llsdSeven[content] = LLSD.FromString(content);
- string sSeven = LLSDParser.SerializeNotation(llsdSeven);
- LLSDMap llsdSevenDS = (LLSDMap)LLSDParser.DeserializeNotation(sSeven);
- Assert.AreEqual(LLSDType.Map, llsdSevenDS.Type);
+ OSDMap llsdSeven = new OSDMap();
+ llsdSeven[content] = OSD.FromString(content);
+ string sSeven = LLSDParser.SerializeLLSDNotation(llsdSeven);
+ OSDMap llsdSevenDS = (OSDMap)LLSDParser.DeserializeLLSDNotation(sSeven);
+ Assert.AreEqual(OSDType.Map, llsdSevenDS.Type);
Assert.AreEqual(1, llsdSevenDS.Count);
Assert.AreEqual(content, llsdSevenDS[content].AsString());
}
@@ -686,23 +686,23 @@ namespace OpenMetaverse.Tests
]";
// We dont do full testing here. We are fine if a few values are right
// and the parser doesnt throw an exception
- LLSDArray llsdArray = (LLSDArray)LLSDParser.DeserializeNotation(realWorldExample);
- Assert.AreEqual(LLSDType.Array, llsdArray.Type);
+ OSDArray llsdArray = (OSDArray)LLSDParser.DeserializeLLSDNotation(realWorldExample);
+ Assert.AreEqual(OSDType.Array, llsdArray.Type);
Assert.AreEqual(3, llsdArray.Count);
- LLSDMap llsdMapOne = (LLSDMap)llsdArray[0];
- Assert.AreEqual(LLSDType.Map, llsdMapOne.Type);
+ OSDMap llsdMapOne = (OSDMap)llsdArray[0];
+ Assert.AreEqual(OSDType.Map, llsdMapOne.Type);
Assert.AreEqual("http://secondlife.com", llsdMapOne["destination"].AsString());
- LLSDMap llsdMapTwo = (LLSDMap)llsdArray[1];
- Assert.AreEqual(LLSDType.Map, llsdMapTwo.Type);
- Assert.AreEqual(LLSDType.Integer, llsdMapTwo["version"].Type);
+ OSDMap llsdMapTwo = (OSDMap)llsdArray[1];
+ Assert.AreEqual(OSDType.Map, llsdMapTwo.Type);
+ Assert.AreEqual(OSDType.Integer, llsdMapTwo["version"].Type);
Assert.AreEqual(1, llsdMapTwo["version"].AsInteger());
- LLSDMap llsdMapThree = (LLSDMap)llsdArray[2];
- Assert.AreEqual(LLSDType.UUID, llsdMapThree["session_id"].Type);
+ OSDMap llsdMapThree = (OSDMap)llsdArray[2];
+ Assert.AreEqual(OSDType.UUID, llsdMapThree["session_id"].Type);
Assert.AreEqual("2c585cec-038c-40b0-b42e-a25ebab4d132", llsdMapThree["session_id"].AsString());
- Assert.AreEqual(LLSDType.UUID, llsdMapThree["agent_id"].Type);
+ Assert.AreEqual(OSDType.UUID, llsdMapThree["agent_id"].Type);
Assert.AreEqual("3c115e51-04f4-523c-9fa6-98aff1034730", llsdMapThree["agent_id"].AsString());
}
@@ -711,48 +711,48 @@ namespace OpenMetaverse.Tests
public void SerializeFormattedTest()
{
// This is not a real test. Instead look at the console.out tab for how formatted notation looks like.
- LLSDArray llsdArray = new LLSDArray();
- LLSD llsdOne = LLSD.FromInteger(1);
- LLSD llsdTwo = LLSD.FromInteger(1);
+ OSDArray llsdArray = new OSDArray();
+ OSD llsdOne = OSD.FromInteger(1);
+ OSD llsdTwo = OSD.FromInteger(1);
llsdArray.Add(llsdOne);
llsdArray.Add(llsdTwo);
- string sOne = LLSDParser.SerializeNotationFormatted(llsdArray);
+ string sOne = LLSDParser.SerializeLLSDNotationFormatted(llsdArray);
Console.Write(sOne);
- LLSDMap llsdMap = new LLSDMap();
- LLSD llsdThree = LLSD.FromInteger(2);
+ OSDMap llsdMap = new OSDMap();
+ OSD llsdThree = OSD.FromInteger(2);
llsdMap["test1"] = llsdThree;
- LLSD llsdFour = LLSD.FromInteger(2);
+ OSD llsdFour = OSD.FromInteger(2);
llsdMap["test2"] = llsdFour;
llsdArray.Add(llsdMap);
- string sTwo = LLSDParser.SerializeNotationFormatted(llsdArray);
+ string sTwo = LLSDParser.SerializeLLSDNotationFormatted(llsdArray);
Console.Write(sTwo);
- LLSDArray llsdArrayTwo = new LLSDArray();
- LLSD llsdFive = LLSD.FromString("asdflkhjasdhj");
- LLSD llsdSix = LLSD.FromString("asdkfhasjkldfghsd");
+ OSDArray llsdArrayTwo = new OSDArray();
+ OSD llsdFive = OSD.FromString("asdflkhjasdhj");
+ OSD llsdSix = OSD.FromString("asdkfhasjkldfghsd");
llsdArrayTwo.Add(llsdFive);
llsdArrayTwo.Add(llsdSix);
llsdMap["test3"] = llsdArrayTwo;
- string sThree = LLSDParser.SerializeNotationFormatted(llsdArray);
+ string sThree = LLSDParser.SerializeLLSDNotationFormatted(llsdArray);
Console.Write(sThree);
// we also try to parse this... and look a little at the results
- LLSDArray llsdSeven = (LLSDArray)LLSDParser.DeserializeNotation(sThree);
- Assert.AreEqual(LLSDType.Array, llsdSeven.Type);
+ OSDArray llsdSeven = (OSDArray)LLSDParser.DeserializeLLSDNotation(sThree);
+ Assert.AreEqual(OSDType.Array, llsdSeven.Type);
Assert.AreEqual(3, llsdSeven.Count);
- Assert.AreEqual(LLSDType.Integer, llsdSeven[0].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSeven[0].Type);
Assert.AreEqual(1, llsdSeven[0].AsInteger());
- Assert.AreEqual(LLSDType.Integer, llsdSeven[1].Type);
+ Assert.AreEqual(OSDType.Integer, llsdSeven[1].Type);
Assert.AreEqual(1, llsdSeven[1].AsInteger());
- Assert.AreEqual(LLSDType.Map, llsdSeven[2].Type);
+ Assert.AreEqual(OSDType.Map, llsdSeven[2].Type);
// thats enough for now.
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenMetaverse.Tests/TypeTests.cs b/OpenMetaverse.Tests/TypeTests.cs
index 37439427..0eb9f981 100644
--- a/OpenMetaverse.Tests/TypeTests.cs
+++ b/OpenMetaverse.Tests/TypeTests.cs
@@ -208,36 +208,36 @@ namespace OpenMetaverse.Tests
string testTwo = "[[r1,r1,r1],r0]";
string testThree = "{'region_handle':[r255232, r256512], 'position':[r33.6, r33.71, r43.13], 'look_at':[r34.6, r33.71, r43.13]}";
- LLSD obj = LLSDParser.DeserializeNotation(testOne);
- Assert.IsInstanceOfType(typeof(LLSDArray), obj, "Expected LLSDArray, got " + obj.GetType().ToString());
- LLSDArray array = (LLSDArray)obj;
+ OSD obj = LLSDParser.DeserializeLLSDNotation(testOne);
+ Assert.IsInstanceOfType(typeof(OSDArray), obj, "Expected SDArray, got " + obj.GetType().ToString());
+ OSDArray array = (OSDArray)obj;
Assert.IsTrue(array.Count == 3, "Expected three contained objects, got " + array.Count);
Assert.IsTrue(array[0].AsReal() > 0.9d && array[0].AsReal() < 1.0d, "Unexpected value for first real " + array[0].AsReal());
Assert.IsTrue(array[1].AsReal() < 0.0d && array[1].AsReal() > -0.03d, "Unexpected value for second real " + array[1].AsReal());
Assert.IsTrue(array[2].AsReal() == 0.0d, "Unexpected value for third real " + array[2].AsReal());
- obj = LLSDParser.DeserializeNotation(testTwo);
- Assert.IsInstanceOfType(typeof(LLSDArray), obj, "Expected LLSDArray, got " + obj.GetType().ToString());
- array = (LLSDArray)obj;
+ obj = LLSDParser.DeserializeLLSDNotation(testTwo);
+ Assert.IsInstanceOfType(typeof(OSDArray), obj, "Expected SDArray, got " + obj.GetType().ToString());
+ array = (OSDArray)obj;
Assert.IsTrue(array.Count == 2, "Expected two contained objects, got " + array.Count);
Assert.IsTrue(array[1].AsReal() == 0.0d, "Unexpected value for real " + array[1].AsReal());
obj = array[0];
- Assert.IsInstanceOfType(typeof(LLSDArray), obj, "Expected ArrayList, got " + obj.GetType().ToString());
- array = (LLSDArray)obj;
+ Assert.IsInstanceOfType(typeof(OSDArray), obj, "Expected ArrayList, got " + obj.GetType().ToString());
+ array = (OSDArray)obj;
Assert.IsTrue(array[0].AsReal() == 1.0d && array[1].AsReal() == 1.0d && array[2].AsReal() == 1.0d,
"Unexpected value(s) for nested array: " + array[0].AsReal() + ", " + array[1].AsReal() + ", " +
array[2].AsReal());
- obj = LLSDParser.DeserializeNotation(testThree);
- Assert.IsInstanceOfType(typeof(LLSDMap), obj, "Expected LLSDMap, got " + obj.GetType().ToString());
- LLSDMap hashtable = (LLSDMap)obj;
+ obj = LLSDParser.DeserializeLLSDNotation(testThree);
+ Assert.IsInstanceOfType(typeof(OSDMap), obj, "Expected LLSDMap, got " + obj.GetType().ToString());
+ OSDMap hashtable = (OSDMap)obj;
Assert.IsTrue(hashtable.Count == 3, "Expected three contained objects, got " + hashtable.Count);
- Assert.IsInstanceOfType(typeof(LLSDArray), hashtable["region_handle"]);
- Assert.IsTrue(((LLSDArray)hashtable["region_handle"]).Count == 2);
- Assert.IsInstanceOfType(typeof(LLSDArray), hashtable["position"]);
- Assert.IsTrue(((LLSDArray)hashtable["position"]).Count == 3);
- Assert.IsInstanceOfType(typeof(LLSDArray), hashtable["look_at"]);
- Assert.IsTrue(((LLSDArray)hashtable["look_at"]).Count == 3);
+ Assert.IsInstanceOfType(typeof(OSDArray), hashtable["region_handle"]);
+ Assert.IsTrue(((OSDArray)hashtable["region_handle"]).Count == 2);
+ Assert.IsInstanceOfType(typeof(OSDArray), hashtable["position"]);
+ Assert.IsTrue(((OSDArray)hashtable["position"]).Count == 3);
+ Assert.IsInstanceOfType(typeof(OSDArray), hashtable["look_at"]);
+ Assert.IsTrue(((OSDArray)hashtable["look_at"]).Count == 3);
}
}
}
diff --git a/OpenMetaverse.Tests/XmlLLSDTests.cs b/OpenMetaverse.Tests/XmlLLSDTests.cs
index cd630d22..a9841b69 100644
--- a/OpenMetaverse.Tests/XmlLLSDTests.cs
+++ b/OpenMetaverse.Tests/XmlLLSDTests.cs
@@ -34,11 +34,11 @@ using OpenMetaverse.StructuredData;
namespace OpenMetaverse.Tests
{
///
- /// XmlLLSDTests is a suite of tests for libsl implementation of the LLSD XML format.
+ /// XmlSDTests is a suite of tests for libsl implementation of the SD XML format.
///
///
[TestFixture]
- public class XmlLLSDTests
+ public class XmlSDTests
{
///
/// Test that the sample LLSD supplied by Linden Lab is properly deserialized.
@@ -48,14 +48,14 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeLLSDSample()
{
- LLSD theLLSD = null;
- LLSDMap map = null;
- LLSD tempLLSD = null;
- LLSDUUID tempUUID = null;
- LLSDString tempStr = null;
- LLSDReal tempReal = null;
+ OSD theSD = null;
+ OSDMap map = null;
+ OSD tempSD = null;
+ OSDUUID tempUUID = null;
+ OSDString tempStr = null;
+ OSDReal tempReal = null;
- String testLLSD = @"
+ String testSD = @"
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
//Confirm the contents
- Assert.IsNotNull(theLLSD);
- Assert.IsTrue(theLLSD is LLSDMap);
- Assert.IsTrue(theLLSD.Type == LLSDType.Map);
- map = (LLSDMap)theLLSD;
+ Assert.IsNotNull(theSD);
+ Assert.IsTrue(theSD is OSDMap);
+ Assert.IsTrue(theSD.Type == OSDType.Map);
+ map = (OSDMap)theSD;
- tempLLSD = map["region_id"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDUUID);
- Assert.IsTrue(tempLLSD.Type == LLSDType.UUID);
- tempUUID = (LLSDUUID)tempLLSD;
+ tempSD = map["region_id"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDUUID);
+ Assert.IsTrue(tempSD.Type == OSDType.UUID);
+ tempUUID = (OSDUUID)tempSD;
Assert.AreEqual(new UUID("67153d5b-3659-afb4-8510-adda2c034649"), tempUUID.AsUUID());
- tempLLSD = map["scale"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDString);
- Assert.IsTrue(tempLLSD.Type == LLSDType.String);
- tempStr = (LLSDString)tempLLSD;
+ tempSD = map["scale"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDString);
+ Assert.IsTrue(tempSD.Type == OSDType.String);
+ tempStr = (OSDString)tempSD;
Assert.AreEqual("one minute", tempStr.AsString());
- tempLLSD = map["simulator statistics"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDMap);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Map);
- map = (LLSDMap)tempLLSD;
+ tempSD = map["simulator statistics"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDMap);
+ Assert.IsTrue(tempSD.Type == OSDType.Map);
+ map = (OSDMap)tempSD;
- tempLLSD = map["time dilation"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
+ tempSD = map["time dilation"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
Assert.AreEqual(0.9878624d, tempReal.AsReal());
//TODO - figure out any relevant rounding variability for 64 bit reals
- tempLLSD = map["sim fps"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
+ tempSD = map["sim fps"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
Assert.AreEqual(44.38898d, tempReal.AsReal());
- tempLLSD = map["agent updates per second"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
- Assert.AreEqual(Double.NaN, tempLLSD.AsReal());
+ tempSD = map["agent updates per second"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
+ Assert.AreEqual(Double.NaN, tempSD.AsReal());
- tempLLSD = map["total task count"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
+ tempSD = map["total task count"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
Assert.AreEqual(4.0d, tempReal.AsReal());
- tempLLSD = map["active task count"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
+ tempSD = map["active task count"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
Assert.AreEqual(0.0d, tempReal.AsReal());
- tempLLSD = map["pending uploads"];
- Assert.IsNotNull(tempLLSD);
- Assert.IsTrue(tempLLSD is LLSDReal);
- Assert.IsTrue(tempLLSD.Type == LLSDType.Real);
- tempReal = (LLSDReal)tempLLSD;
+ tempSD = map["pending uploads"];
+ Assert.IsNotNull(tempSD);
+ Assert.IsTrue(tempSD is OSDReal);
+ Assert.IsTrue(tempSD.Type == OSDType.Real);
+ tempReal = (OSDReal)tempSD;
Assert.AreEqual(0.0001096525d, tempReal.AsReal());
}
@@ -161,11 +161,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeReals()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDReal tempReal = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDReal tempReal = null;
- String testLLSD = @"
+ String testSD = @"
44.38898
@@ -176,30 +176,30 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.Real, array[0].Type);
- tempReal = (LLSDReal)array[0];
+ Assert.AreEqual(OSDType.Real, array[0].Type);
+ tempReal = (OSDReal)array[0];
Assert.AreEqual(44.38898d, tempReal.AsReal());
- Assert.AreEqual(LLSDType.Real, array[1].Type);
- tempReal = (LLSDReal)array[1];
+ Assert.AreEqual(OSDType.Real, array[1].Type);
+ tempReal = (OSDReal)array[1];
Assert.AreEqual(Double.NaN, tempReal.AsReal());
- Assert.AreEqual(LLSDType.Real, array[2].Type);
- tempReal = (LLSDReal)array[2];
+ Assert.AreEqual(OSDType.Real, array[2].Type);
+ tempReal = (OSDReal)array[2];
Assert.AreEqual(4.0d, tempReal.AsReal());
- Assert.AreEqual(LLSDType.Real, array[3].Type);
- tempReal = (LLSDReal)array[3];
+ Assert.AreEqual(OSDType.Real, array[3].Type);
+ tempReal = (OSDReal)array[3];
Assert.AreEqual(-13.333d, tempReal.AsReal());
- Assert.AreEqual(LLSDType.Real, array[4].Type);
- tempReal = (LLSDReal)array[4];
+ Assert.AreEqual(OSDType.Real, array[4].Type);
+ tempReal = (OSDReal)array[4];
Assert.AreEqual(0d, tempReal.AsReal());
}
@@ -209,11 +209,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeStrings()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDString tempStr = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDString tempStr = null;
- String testLLSD = @"
+ String testSD = @"
Kissling
@@ -223,26 +223,26 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.String, array[0].Type);
- tempStr = (LLSDString)array[0];
+ Assert.AreEqual(OSDType.String, array[0].Type);
+ tempStr = (OSDString)array[0];
Assert.AreEqual("Kissling", tempStr.AsString());
- Assert.AreEqual(LLSDType.String, array[1].Type);
- tempStr = (LLSDString)array[1];
+ Assert.AreEqual(OSDType.String, array[1].Type);
+ tempStr = (OSDString)array[1];
Assert.AreEqual("Attack ships on fire off the shoulder of Orion", tempStr.AsString());
- Assert.AreEqual(LLSDType.String, array[2].Type);
- tempStr = (LLSDString)array[2];
+ Assert.AreEqual(OSDType.String, array[2].Type);
+ tempStr = (OSDString)array[2];
Assert.AreEqual("< > & \' \"", tempStr.AsString());
- Assert.AreEqual(LLSDType.String, array[3].Type);
- tempStr = (LLSDString)array[3];
+ Assert.AreEqual(OSDType.String, array[3].Type);
+ tempStr = (OSDString)array[3];
Assert.AreEqual("", tempStr.AsString());
}
@@ -250,7 +250,7 @@ namespace OpenMetaverse.Tests
///
/// Test that various Integer representations are parsed correctly.
/// These tests currently only test for values within the range of a
- /// 32 bit signed integer, even though the LLSD specification says
+ /// 32 bit signed integer, even though the SD specification says
/// the type is a 64 bit signed integer, because LLSInteger is currently
/// implemented using int, a.k.a. Int32. Not testing Int64 range until
/// it's understood if there was a design reason for the Int32.
@@ -258,11 +258,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeIntegers()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDInteger tempInt = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDInteger tempInt = null;
- String testLLSD = @"
+ String testSD = @"
2147483647
@@ -273,30 +273,30 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.Integer, array[0].Type);
- tempInt = (LLSDInteger)array[0];
+ Assert.AreEqual(OSDType.Integer, array[0].Type);
+ tempInt = (OSDInteger)array[0];
Assert.AreEqual(2147483647, tempInt.AsInteger());
- Assert.AreEqual(LLSDType.Integer, array[1].Type);
- tempInt = (LLSDInteger)array[1];
+ Assert.AreEqual(OSDType.Integer, array[1].Type);
+ tempInt = (OSDInteger)array[1];
Assert.AreEqual(-2147483648, tempInt.AsInteger());
- Assert.AreEqual(LLSDType.Integer, array[2].Type);
- tempInt = (LLSDInteger)array[2];
+ Assert.AreEqual(OSDType.Integer, array[2].Type);
+ tempInt = (OSDInteger)array[2];
Assert.AreEqual(0, tempInt.AsInteger());
- Assert.AreEqual(LLSDType.Integer, array[3].Type);
- tempInt = (LLSDInteger)array[3];
+ Assert.AreEqual(OSDType.Integer, array[3].Type);
+ tempInt = (OSDInteger)array[3];
Assert.AreEqual(13, tempInt.AsInteger());
- Assert.AreEqual(LLSDType.Integer, array[4].Type);
- tempInt = (LLSDInteger)array[4];
+ Assert.AreEqual(OSDType.Integer, array[4].Type);
+ tempInt = (OSDInteger)array[4];
Assert.AreEqual(0, tempInt.AsInteger());
}
@@ -306,11 +306,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeUUID()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDUUID tempUUID = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDUUID tempUUID = null;
- String testLLSD = @"
+ String testSD = @"
d7f4aeca-88f1-42a1-b385-b9db18abb255
@@ -318,18 +318,18 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.UUID, array[0].Type);
- tempUUID = (LLSDUUID)array[0];
+ Assert.AreEqual(OSDType.UUID, array[0].Type);
+ tempUUID = (OSDUUID)array[0];
Assert.AreEqual(new UUID("d7f4aeca-88f1-42a1-b385-b9db18abb255"), tempUUID.AsUUID());
- Assert.AreEqual(LLSDType.UUID, array[1].Type);
- tempUUID = (LLSDUUID)array[1];
+ Assert.AreEqual(OSDType.UUID, array[1].Type);
+ tempUUID = (OSDUUID)array[1];
Assert.AreEqual(UUID.Zero, tempUUID.AsUUID());
}
@@ -339,12 +339,12 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeDates()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDDate tempDate = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDDate tempDate = null;
DateTime testDate;
- String testLLSD = @"
+ String testSD = @"
2006-02-01T14:29:53Z
@@ -353,24 +353,24 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.Date, array[0].Type);
- tempDate = (LLSDDate)array[0];
+ Assert.AreEqual(OSDType.Date, array[0].Type);
+ tempDate = (OSDDate)array[0];
DateTime.TryParse("2006-02-01T14:29:53Z", out testDate);
Assert.AreEqual(testDate, tempDate.AsDate());
- Assert.AreEqual(LLSDType.Date, array[1].Type);
- tempDate = (LLSDDate)array[1];
+ Assert.AreEqual(OSDType.Date, array[1].Type);
+ tempDate = (OSDDate)array[1];
DateTime.TryParse("1999-01-01T00:00:00Z", out testDate);
Assert.AreEqual(testDate, tempDate.AsDate());
- Assert.AreEqual(LLSDType.Date, array[2].Type);
- tempDate = (LLSDDate)array[2];
+ Assert.AreEqual(OSDType.Date, array[2].Type);
+ tempDate = (OSDDate)array[2];
Assert.AreEqual(Utils.Epoch, tempDate.AsDate());
}
@@ -380,11 +380,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeBoolean()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDBoolean tempBool = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDBoolean tempBool = null;
- String testLLSD = @"
+ String testSD = @"
1
@@ -395,30 +395,30 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.Boolean, array[0].Type);
- tempBool = (LLSDBoolean)array[0];
+ Assert.AreEqual(OSDType.Boolean, array[0].Type);
+ tempBool = (OSDBoolean)array[0];
Assert.AreEqual(true, tempBool.AsBoolean());
- Assert.AreEqual(LLSDType.Boolean, array[1].Type);
- tempBool = (LLSDBoolean)array[1];
+ Assert.AreEqual(OSDType.Boolean, array[1].Type);
+ tempBool = (OSDBoolean)array[1];
Assert.AreEqual(true, tempBool.AsBoolean());
- Assert.AreEqual(LLSDType.Boolean, array[2].Type);
- tempBool = (LLSDBoolean)array[2];
+ Assert.AreEqual(OSDType.Boolean, array[2].Type);
+ tempBool = (OSDBoolean)array[2];
Assert.AreEqual(false, tempBool.AsBoolean());
- Assert.AreEqual(LLSDType.Boolean, array[3].Type);
- tempBool = (LLSDBoolean)array[3];
+ Assert.AreEqual(OSDType.Boolean, array[3].Type);
+ tempBool = (OSDBoolean)array[3];
Assert.AreEqual(false, tempBool.AsBoolean());
- Assert.AreEqual(LLSDType.Boolean, array[4].Type);
- tempBool = (LLSDBoolean)array[4];
+ Assert.AreEqual(OSDType.Boolean, array[4].Type);
+ tempBool = (OSDBoolean)array[4];
Assert.AreEqual(false, tempBool.AsBoolean());
}
@@ -428,11 +428,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeBinary()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDBinary tempBinary = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDBinary tempBinary = null;
- String testLLSD = @"
+ String testSD = @"
cmFuZG9t
@@ -442,35 +442,35 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.Binary, array[0].Type);
- tempBinary = (LLSDBinary)array[0];
+ Assert.AreEqual(OSDType.Binary, array[0].Type);
+ tempBinary = (OSDBinary)array[0];
byte[] testData1 = {114, 97, 110, 100, 111, 109};
TestBinary(tempBinary, testData1);
- Assert.AreEqual(LLSDType.Binary, array[1].Type);
- tempBinary = (LLSDBinary)array[1];
+ Assert.AreEqual(OSDType.Binary, array[1].Type);
+ tempBinary = (OSDBinary)array[1];
byte[] testData2 = {116, 104, 101, 32, 113, 117, 105, 99, 107, 32, 98,
114, 111, 119, 110, 32, 102, 111, 120};
TestBinary(tempBinary, testData2);
- Assert.AreEqual(LLSDType.Binary, array[1].Type);
- tempBinary = (LLSDBinary)array[2];
+ Assert.AreEqual(OSDType.Binary, array[1].Type);
+ tempBinary = (OSDBinary)array[2];
Assert.AreEqual(0, tempBinary.AsBinary().Length);
}
///
- /// Asserts that the contents of the LLSDBinary match the values and length
+ /// Asserts that the contents of the SDBinary match the values and length
/// of the supplied byte array
///
///
///
- private void TestBinary(LLSDBinary inBinary, byte[] inExpected)
+ private void TestBinary(OSDBinary inBinary, byte[] inExpected)
{
byte[] binary = inBinary.AsBinary();
Assert.AreEqual(inExpected.Length, binary.Length);
@@ -487,23 +487,23 @@ namespace OpenMetaverse.Tests
///
/// Test that undefened elements are parsed correctly.
/// Currently this just checks that there is no error since undefined has no
- /// value and there is no LLSD child class for Undefined elements - the
- /// current implementation generates an instance of LLSD
+ /// value and there is no SD child class for Undefined elements - the
+ /// current implementation generates an instance of SD
///
[Test]
public void DeserializeUndef()
{
- LLSD theLLSD = null;
+ OSD theSD = null;
- String testLLSD = @"
+ String testSD = @"
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSD);
+ Assert.IsTrue(theSD is OSD);
}
///
@@ -512,11 +512,11 @@ namespace OpenMetaverse.Tests
[Test]
public void DeserializeURI()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDURI tempURI = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDURI tempURI = null;
- String testLLSD = @"
+ String testSD = @"
http://sim956.agni.lindenlab.com:12035/runtime/agents
@@ -524,35 +524,35 @@ namespace OpenMetaverse.Tests
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
- Assert.AreEqual(LLSDType.URI, array[0].Type);
- tempURI = (LLSDURI)array[0];
+ Assert.AreEqual(OSDType.URI, array[0].Type);
+ tempURI = (OSDURI)array[0];
Uri testURI = new Uri(@"http://sim956.agni.lindenlab.com:12035/runtime/agents");
Assert.AreEqual(testURI, tempURI.AsUri());
- Assert.AreEqual(LLSDType.URI, array[1].Type);
- tempURI = (LLSDURI)array[1];
+ Assert.AreEqual(OSDType.URI, array[1].Type);
+ tempURI = (OSDURI)array[1];
Assert.AreEqual("", tempURI.AsUri().ToString());
}
///
- /// Test some nested containers. This is not a very deep or complicated LLSD graph
+ /// Test some nested containers. This is not a very deep or complicated SD graph
/// but it should reveal basic nesting issues.
///
[Test]
public void DeserializeNestedContainers()
{
- LLSD theLLSD = null;
- LLSDArray array = null;
- LLSDMap map = null;
- LLSD tempLLSD = null;
+ OSD theSD = null;
+ OSDArray array = null;
+ OSDMap map = null;
+ OSD tempSD = null;
- String testLLSD = @"
+ String testSD = @"
";
//Deserialize the string
- byte[] bytes = Encoding.UTF8.GetBytes(testLLSD);
- theLLSD = LLSDParser.DeserializeXml(bytes);
+ byte[] bytes = Encoding.UTF8.GetBytes(testSD);
+ theSD = LLSDParser.DeserializeLLSDXml(bytes);
- Assert.IsTrue(theLLSD is LLSDArray);
- array = (LLSDArray)theLLSD;
+ Assert.IsTrue(theSD is OSDArray);
+ array = (OSDArray)theSD;
Assert.AreEqual(2, array.Count);
//The first element of top level array, a map
- Assert.AreEqual(LLSDType.Map, array[0].Type);
- map = (LLSDMap)array[0];
+ Assert.AreEqual(OSDType.Map, array[0].Type);
+ map = (OSDMap)array[0];
//First nested map
- tempLLSD = map["Map One"];
- Assert.IsNotNull(tempLLSD);
- Assert.AreEqual(LLSDType.Map, tempLLSD.Type);
- map = (LLSDMap)tempLLSD;
+ tempSD = map["Map One"];
+ Assert.IsNotNull(tempSD);
+ Assert.AreEqual(OSDType.Map, tempSD.Type);
+ map = (OSDMap)tempSD;
//First nested array
- tempLLSD = map["Array One"];
- Assert.IsNotNull(tempLLSD);
- Assert.AreEqual(LLSDType.Array, tempLLSD.Type);
- array = (LLSDArray)tempLLSD;
+ tempSD = map["Array One"];
+ Assert.IsNotNull(tempSD);
+ Assert.AreEqual(OSDType.Array, tempSD.Type);
+ array = (OSDArray)tempSD;
Assert.AreEqual(2, array.Count);
- array = (LLSDArray)theLLSD;
+ array = (OSDArray)theSD;
//Second element of top level array, an array
- tempLLSD = array[1];
- Assert.AreEqual(LLSDType.Array, tempLLSD.Type);
- array = (LLSDArray)tempLLSD;
+ tempSD = array[1];
+ Assert.AreEqual(OSDType.Array, tempSD.Type);
+ array = (OSDArray)tempSD;
Assert.AreEqual(3, array.Count);
//Nested array
- tempLLSD = array[2];
- Assert.AreEqual(LLSDType.Array, tempLLSD.Type);
- array = (LLSDArray)tempLLSD;
+ tempSD = array[2];
+ Assert.AreEqual(OSDType.Array, tempSD.Type);
+ array = (OSDArray)tempSD;
Assert.AreEqual(3, array.Count);
}
diff --git a/OpenMetaverse.Utilities/RegistrationApi.cs b/OpenMetaverse.Utilities/RegistrationApi.cs
index 7bcb40fa..988f416e 100644
--- a/OpenMetaverse.Utilities/RegistrationApi.cs
+++ b/OpenMetaverse.Utilities/RegistrationApi.cs
@@ -140,11 +140,11 @@ namespace OpenMetaverse
request.StartRequest(postData);
}
- private void GatherCapsResponse(CapsClient client, LLSD response, Exception error)
+ private void GatherCapsResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
- LLSDMap respTable = (LLSDMap)response;
+ OSDMap respTable = (OSDMap)response;
// parse
_caps = new RegistrationCaps();
@@ -171,9 +171,9 @@ namespace OpenMetaverse
request.StartRequest();
}
- private void GatherErrorMessagesResponse(CapsClient client, LLSD response, Exception error)
+ private void GatherErrorMessagesResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
// parse
@@ -211,9 +211,9 @@ namespace OpenMetaverse
// FIXME: Block
}
- private void GatherLastNamesResponse(CapsClient client, LLSD response, Exception error)
+ private void GatherLastNamesResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
//LLSDMap respTable = (LLSDMap)response;
@@ -243,9 +243,9 @@ namespace OpenMetaverse
throw new InvalidOperationException("access denied; only approved developers have access to the registration api");
// Create the POST data
- LLSDMap query = new LLSDMap();
- query.Add("username", LLSD.FromString(firstName));
- query.Add("last_name_id", LLSD.FromInteger(lastName.ID));
+ OSDMap query = new OSDMap();
+ query.Add("username", OSD.FromString(firstName));
+ query.Add("last_name_id", OSD.FromInteger(lastName.ID));
//byte[] postData = LLSDParser.SerializeXmlBytes(query);
CapsClient request = new CapsClient(_caps.CheckName);
@@ -256,9 +256,9 @@ namespace OpenMetaverse
return false;
}
- private void CheckNameResponse(CapsClient client, LLSD response, Exception error)
+ private void CheckNameResponse(CapsClient client, OSD response, Exception error)
{
- if (response.Type == LLSDType.Boolean)
+ if (response.Type == OSDType.Boolean)
{
// FIXME:
//(bool)response;
@@ -284,31 +284,31 @@ namespace OpenMetaverse
throw new InvalidOperationException("access denied; only approved developers have access to the registration api");
// Create the POST data
- LLSDMap query = new LLSDMap();
- query.Add("username", LLSD.FromString(user.FirstName));
- query.Add("last_name_id", LLSD.FromInteger(user.LastName.ID));
- query.Add("email", LLSD.FromString(user.Email));
- query.Add("password", LLSD.FromString(user.Password));
- query.Add("dob", LLSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")));
+ OSDMap query = new OSDMap();
+ query.Add("username", OSD.FromString(user.FirstName));
+ query.Add("last_name_id", OSD.FromInteger(user.LastName.ID));
+ query.Add("email", OSD.FromString(user.Email));
+ query.Add("password", OSD.FromString(user.Password));
+ query.Add("dob", OSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")));
if (user.LimitedToEstate != null)
- query.Add("limited_to_estate", LLSD.FromInteger(user.LimitedToEstate.Value));
+ query.Add("limited_to_estate", OSD.FromInteger(user.LimitedToEstate.Value));
if (!string.IsNullOrEmpty(user.StartRegionName))
- query.Add("start_region_name", LLSD.FromInteger(user.LimitedToEstate.Value));
+ query.Add("start_region_name", OSD.FromInteger(user.LimitedToEstate.Value));
if (user.StartLocation != null)
{
- query.Add("start_local_x", LLSD.FromReal(user.StartLocation.Value.X));
- query.Add("start_local_y", LLSD.FromReal(user.StartLocation.Value.Y));
- query.Add("start_local_z", LLSD.FromReal(user.StartLocation.Value.Z));
+ query.Add("start_local_x", OSD.FromReal(user.StartLocation.Value.X));
+ query.Add("start_local_y", OSD.FromReal(user.StartLocation.Value.Y));
+ query.Add("start_local_z", OSD.FromReal(user.StartLocation.Value.Z));
}
if (user.StartLookAt != null)
{
- query.Add("start_look_at_x", LLSD.FromReal(user.StartLookAt.Value.X));
- query.Add("start_look_at_y", LLSD.FromReal(user.StartLookAt.Value.Y));
- query.Add("start_look_at_z", LLSD.FromReal(user.StartLookAt.Value.Z));
+ query.Add("start_look_at_x", OSD.FromReal(user.StartLookAt.Value.X));
+ query.Add("start_look_at_y", OSD.FromReal(user.StartLookAt.Value.Y));
+ query.Add("start_look_at_z", OSD.FromReal(user.StartLookAt.Value.Z));
}
//byte[] postData = LLSDParser.SerializeXmlBytes(query);
@@ -322,9 +322,9 @@ namespace OpenMetaverse
return UUID.Zero;
}
- private void CreateUserResponse(CapsClient client, LLSD response, Exception error)
+ private void CreateUserResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
// everything is okay
// FIXME:
@@ -333,11 +333,11 @@ namespace OpenMetaverse
else
{
// an error happened
- LLSDArray al = (LLSDArray)response;
+ OSDArray al = (OSDArray)response;
StringBuilder sb = new StringBuilder();
- foreach (LLSD ec in al)
+ foreach (OSD ec in al)
{
if (sb.Length > 0)
sb.Append("; ");
diff --git a/OpenMetaverse.Utilities/VoiceManager.cs b/OpenMetaverse.Utilities/VoiceManager.cs
index 85da8f28..1225e053 100644
--- a/OpenMetaverse.Utilities/VoiceManager.cs
+++ b/OpenMetaverse.Utilities/VoiceManager.cs
@@ -331,7 +331,7 @@ namespace OpenMetaverse.Utilities
if (url != null)
{
CapsClient request = new CapsClient(url);
- LLSDMap body = new LLSDMap();
+ OSDMap body = new OSDMap();
request.OnComplete += new CapsClient.CompleteCallback(callback);
request.StartRequest(body);
@@ -523,9 +523,9 @@ namespace OpenMetaverse.Utilities
#region Callbacks
- private void RequiredVoiceVersionEventHandler(string message, LLSD llsd, Simulator simulator)
+ private void RequiredVoiceVersionEventHandler(string message, OSD osd, Simulator simulator)
{
- LLSDMap body = (LLSDMap)llsd;
+ OSDMap body = (OSDMap)osd;
if (body.ContainsKey("major_version"))
{
@@ -544,11 +544,11 @@ namespace OpenMetaverse.Utilities
}
}
- private void ProvisionCapsResponse(CapsClient client, LLSD response, Exception error)
+ private void ProvisionCapsResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
- LLSDMap respTable = (LLSDMap)response;
+ OSDMap respTable = (OSDMap)response;
if (OnProvisionAccount != null)
{
@@ -558,18 +558,19 @@ namespace OpenMetaverse.Utilities
}
}
- private void ParcelVoiceInfoResponse(CapsClient client, LLSD response, Exception error)
+ private void ParcelVoiceInfoResponse(CapsClient client, OSD response, Exception error)
{
- if (response is LLSDMap)
+ if (response is OSDMap)
{
- LLSDMap respTable = (LLSDMap)response;
+ OSDMap respTable = (OSDMap)response;
string regionName = respTable["region_name"].AsString();
int localID = (int)respTable["parcel_local_id"].AsInteger();
string channelURI = null;
- if (respTable["voice_credentials"] is LLSDMap) {
- LLSDMap creds = (LLSDMap)respTable["voice_credentials"];
+ if (respTable["voice_credentials"] is OSDMap)
+ {
+ OSDMap creds = (OSDMap)respTable["voice_credentials"];
channelURI = creds["channel_uri"].AsString();
}
diff --git a/OpenMetaverse/AgentManager.cs b/OpenMetaverse/AgentManager.cs
index cb19fe75..310b6d6f 100644
--- a/OpenMetaverse/AgentManager.cs
+++ b/OpenMetaverse/AgentManager.cs
@@ -2706,9 +2706,9 @@ namespace OpenMetaverse
}
}
- private void EstablishAgentCommunicationEventHandler(string message, LLSD llsd, Simulator simulator)
+ private void EstablishAgentCommunicationEventHandler(string message, OSD osd, Simulator simulator)
{
- StructuredData.LLSDMap body = (StructuredData.LLSDMap)llsd;
+ StructuredData.OSDMap body = (StructuredData.OSDMap)osd;
if (Client.Settings.MULTIPLE_SIMS && body.ContainsKey("sim-ip-and-port"))
@@ -2739,17 +2739,17 @@ namespace OpenMetaverse
/// Process TeleportFinish from Event Queue and pass it onto our TeleportHandler
///
///
- ///
+ ///
///
- private void TeleportFinishEventHandler(string message, LLSD llsd, Simulator simulator)
+ private void TeleportFinishEventHandler(string message, OSD osd, Simulator simulator)
{
- LLSDMap map = (LLSDMap)llsd;
- LLSDArray array = (LLSDArray)map["Info"];
+ OSDMap map = (OSDMap)osd;
+ OSDArray array = (OSDArray)map["Info"];
for (int i = 0; i < array.Count; i++)
{
TeleportFinishPacket p = new TeleportFinishPacket();
- LLSDMap data = (LLSDMap)array[i];
+ OSDMap data = (OSDMap)array[i];
p.Info.AgentID = data["AgentID"].AsUUID();
p.Info.LocationID = Utils.BytesToUInt(data["LocationID"].AsBinary());
p.Info.RegionHandle = Utils.BytesToUInt64(data["RegionHandle"].AsBinary());
@@ -3014,11 +3014,11 @@ namespace OpenMetaverse
/// Group Chat event handler
///
/// The capability Key
- ///
+ ///
///
- private void ChatterBoxSessionEventHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ChatterBoxSessionEventHandler(string capsKey, OSD osd, Simulator simulator)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
if (map["success"].AsBoolean() != true)
{
Logger.Log("Attempt to send group chat to non-existant session for group " + map["session_id"].AsString(),
@@ -3030,11 +3030,11 @@ namespace OpenMetaverse
/// Response from request to join a group chat
///
///
- ///
+ ///
///
- private void ChatterBoxSessionStartReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ChatterBoxSessionStartReplyHandler(string capsKey, OSD osd, Simulator simulator)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
UUID sessionID = map["session_id"].AsUUID();
UUID tmpSessionID = map["temp_session_id"].AsUUID();
@@ -3044,7 +3044,7 @@ namespace OpenMetaverse
if (success)
{
- LLSDMap sessionInfo = (LLSDMap)map["session_info"];
+ OSDMap sessionInfo = (OSDMap)map["session_info"];
sessionName = sessionInfo["session_name"].AsString();
/* Parameters we do not currently use for anything */
@@ -3064,12 +3064,12 @@ namespace OpenMetaverse
/// Someone joined or left group chat
///
///
- ///
+ ///
///
- private void ChatterBoxSessionAgentListReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ChatterBoxSessionAgentListReplyHandler(string capsKey, OSD osd, Simulator simulator)
{
- // parse the LLSD
- LLSDMap map = (LLSDMap)llsd;
+ // parse the SD
+ OSDMap map = (OSDMap)osd;
// verify sessions exists, if not add it
UUID sessionID;
@@ -3087,15 +3087,15 @@ namespace OpenMetaverse
//string errormsg = map["error"].AsString();
- //LLSDMap updates = (LLSDMap)map["updates"];
+ //SDMap updates = (SDMap)map["updates"];
// Handle any agent data updates
- LLSDMap agent_updates = (LLSDMap)map["agent_updates"];
+ OSDMap agent_updates = (OSDMap)map["agent_updates"];
- foreach (KeyValuePair kvp in agent_updates)
+ foreach (KeyValuePair kvp in agent_updates)
{
UUID agent_key = UUID.Parse(kvp.Key);
- LLSDMap record = (LLSDMap)kvp.Value;
+ OSDMap record = (OSDMap)kvp.Value;
// handle joins/parts first
if (record.ContainsKey("transition"))
@@ -3167,15 +3167,15 @@ namespace OpenMetaverse
return m.AvatarKey == agent_key;
});
- LLSDMap record_info = (LLSDMap)record["info"];
+ OSDMap record_info = (OSDMap)record["info"];
lock (GroupChatSessions.Dictionary)
{
if (record_info.ContainsKey("mutes"))
{
- LLSDMap mutes = (LLSDMap)record_info["mutes"];
- foreach (KeyValuePair muteEntry in mutes)
+ OSDMap mutes = (OSDMap)record_info["mutes"];
+ foreach (KeyValuePair muteEntry in mutes)
{
if (muteEntry.Key == "text")
{
@@ -3214,7 +3214,7 @@ namespace OpenMetaverse
}
- //foreach (KeyValuePair kvp in updates)
+ //foreach (KeyValuePair kvp in updates)
//{
// if (kvp.Value.Equals("ENTER"))
// {
@@ -3246,17 +3246,17 @@ namespace OpenMetaverse
/// Group Chat Request
///
/// Caps Key
- /// LLSD Map containing invitation
+ /// SD Map containing invitation
/// Originating Simulator
- private void ChatterBoxInvitationHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ChatterBoxInvitationHandler(string capsKey, OSD osd, Simulator simulator)
{
if (OnInstantMessage != null)
{
- LLSDMap map = (LLSDMap)llsd;
- LLSDMap im = (LLSDMap)map["instantmessage"];
- //LLSDMap agent = (LLSDMap)im["agent_params"];
- LLSDMap msg = (LLSDMap)im["message_params"];
- LLSDMap msgdata = (LLSDMap)msg["data"];
+ OSDMap map = (OSDMap)osd;
+ OSDMap im = (OSDMap)map["instantmessage"];
+ //SDMap agent = (SDMap)im["agent_params"];
+ OSDMap msg = (OSDMap)im["message_params"];
+ OSDMap msgdata = (OSDMap)msg["data"];
InstantMessage message = new InstantMessage();
@@ -3265,7 +3265,7 @@ namespace OpenMetaverse
message.ToAgentID = msg["to_id"].AsUUID();
message.ParentEstateID = (uint)msg["parent_estate_id"].AsInteger();
message.RegionID = msg["region_id"].AsUUID();
- message.Position = ((LLSDArray)msg["position"]).AsVector3();
+ message.Position = ((OSDArray)msg["position"]).AsVector3();
message.Dialog = (InstantMessageDialog)msgdata["type"].AsInteger();
message.GroupIM = true;
message.IMSessionID = map["session_id"].AsUUID();
@@ -3295,21 +3295,21 @@ namespace OpenMetaverse
if (url != null)
{
- LLSDMap req = new LLSDMap();
- req.Add("method", LLSD.FromString("mute update"));
+ OSDMap req = new OSDMap();
+ req.Add("method", OSD.FromString("mute update"));
- LLSDMap mute_info = new LLSDMap();
- mute_info.Add("text", LLSD.FromBoolean(moderateText));
+ OSDMap mute_info = new OSDMap();
+ mute_info.Add("text", OSD.FromBoolean(moderateText));
- LLSDMap parameters = new LLSDMap();
- parameters["agent_id"] = LLSD.FromUUID(memberID);
+ OSDMap parameters = new OSDMap();
+ parameters["agent_id"] = OSD.FromUUID(memberID);
parameters["mute_info"] = mute_info;
req["params"] = parameters;
- req.Add("session-id", LLSD.FromUUID(sessionID));
+ req.Add("session-id", OSD.FromUUID(sessionID));
- byte[] postData = StructuredData.LLSDParser.SerializeXmlBytes(req);
+ byte[] postData = StructuredData.LLSDParser.SerializeLLSDXmlBytes(req);
CapsClient request = new CapsClient(url);
request.StartRequest(postData);
diff --git a/OpenMetaverse/Capabilities/CapsClient.cs b/OpenMetaverse/Capabilities/CapsClient.cs
index 2cb18932..f78b748f 100644
--- a/OpenMetaverse/Capabilities/CapsClient.cs
+++ b/OpenMetaverse/Capabilities/CapsClient.cs
@@ -34,7 +34,7 @@ namespace OpenMetaverse.Capabilities
{
public delegate void ProgressCallback(CapsClient client, long bytesReceived, long bytesSent,
long totalBytesToReceive, long totalBytesToSend);
- public delegate void CompleteCallback(CapsClient client, LLSD result, Exception error);
+ public delegate void CompleteCallback(CapsClient client, OSD result, Exception error);
public ProgressCallback OnProgress;
public CompleteCallback OnComplete;
@@ -60,9 +60,9 @@ namespace OpenMetaverse.Capabilities
StartRequest(null, null);
}
- public void StartRequest(LLSD llsd)
+ public void StartRequest(OSD llsd)
{
- byte[] postData = LLSDParser.SerializeXmlBytes(llsd);
+ byte[] postData = LLSDParser.SerializeLLSDXmlBytes(llsd);
StartRequest(postData, null);
}
@@ -137,7 +137,7 @@ namespace OpenMetaverse.Capabilities
{
if (e.Error == null)
{
- LLSD result = LLSDParser.DeserializeXml(e.Result);
+ OSD result = LLSDParser.DeserializeLLSDXml(e.Result);
try { OnComplete(this, result, e.Error); }
catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, ex); }
@@ -188,7 +188,7 @@ namespace OpenMetaverse.Capabilities
{
if (e.Error == null)
{
- LLSD result = LLSDParser.DeserializeXml(e.Result);
+ OSD result = LLSDParser.DeserializeLLSDXml(e.Result);
try { OnComplete(this, result, e.Error); }
catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, ex); }
diff --git a/OpenMetaverse/Capabilities/EventQueueClient.cs b/OpenMetaverse/Capabilities/EventQueueClient.cs
index f23b8647..e61767ab 100644
--- a/OpenMetaverse/Capabilities/EventQueueClient.cs
+++ b/OpenMetaverse/Capabilities/EventQueueClient.cs
@@ -42,7 +42,7 @@ namespace OpenMetaverse.Capabilities
///
///
///
- public delegate void EventCallback(string eventName, LLSDMap body);
+ public delegate void EventCallback(string eventName, OSDMap body);
///
public ConnectedCallback OnConnected;
@@ -103,11 +103,11 @@ namespace OpenMetaverse.Capabilities
}
// Create an EventQueueGet request
- LLSDMap request = new LLSDMap();
- request["ack"] = new LLSD();
- request["done"] = LLSD.FromBoolean(false);
+ OSDMap request = new OSDMap();
+ request["ack"] = new OSD();
+ request["done"] = OSD.FromBoolean(false);
- byte[] postData = LLSDParser.SerializeXmlBytes(request);
+ byte[] postData = LLSDParser.SerializeLLSDXmlBytes(request);
_Client.UploadDataAsync(_Client.Location, postData);
@@ -126,7 +126,7 @@ namespace OpenMetaverse.Capabilities
private void Client_UploadDataCompleted(object sender, CapsBase.UploadDataCompletedEventArgs e)
{
- LLSDArray events = null;
+ OSDArray events = null;
int ack = 0;
if (e.Error != null)
@@ -174,13 +174,13 @@ namespace OpenMetaverse.Capabilities
else if (!e.Cancelled && e.Result != null)
{
// Got a response
- LLSD result = LLSDParser.DeserializeXml(e.Result);
- if (result != null && result.Type == LLSDType.Map)
+ OSD result = LLSDParser.DeserializeLLSDXml(e.Result);
+ if (result != null && result.Type == OSDType.Map)
{
// Parse any events returned by the event queue
- LLSDMap map = (LLSDMap)result;
+ OSDMap map = (OSDMap)result;
- events = (LLSDArray)map["events"];
+ events = (OSDArray)map["events"];
ack = map["id"].AsInteger();
}
}
@@ -192,12 +192,12 @@ namespace OpenMetaverse.Capabilities
if (_Running)
{
- LLSDMap request = new LLSDMap();
- if (ack != 0) request["ack"] = LLSD.FromInteger(ack);
- else request["ack"] = new LLSD();
- request["done"] = LLSD.FromBoolean(_Dead);
+ OSDMap request = new OSDMap();
+ if (ack != 0) request["ack"] = OSD.FromInteger(ack);
+ else request["ack"] = new OSD();
+ request["done"] = OSD.FromBoolean(_Dead);
- byte[] postData = LLSDParser.SerializeXmlBytes(request);
+ byte[] postData = LLSDParser.SerializeLLSDXmlBytes(request);
_Client.UploadDataAsync(_Client.Location, postData);
@@ -213,10 +213,10 @@ namespace OpenMetaverse.Capabilities
if (OnEvent != null && events != null && events.Count > 0)
{
// Fire callbacks for each event received
- foreach (LLSDMap evt in events)
+ foreach (OSDMap evt in events)
{
string msg = evt["message"].AsString();
- LLSDMap body = (LLSDMap)evt["body"];
+ OSDMap body = (OSDMap)evt["body"];
try { OnEvent(msg, body); }
catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, ex); }
diff --git a/OpenMetaverse/Caps.cs b/OpenMetaverse/Caps.cs
index a5248e25..c271fe11 100644
--- a/OpenMetaverse/Caps.cs
+++ b/OpenMetaverse/Caps.cs
@@ -47,7 +47,7 @@ namespace OpenMetaverse
/// Event name
/// Decoded event data
/// The simulator that generated the event
- public delegate void EventQueueCallback(string message, StructuredData.LLSD body, Simulator simulator);
+ public delegate void EventQueueCallback(string message, StructuredData.OSD body, Simulator simulator);
/// Reference to the simulator this system is connected to
public Simulator Simulator;
@@ -122,7 +122,7 @@ namespace OpenMetaverse
return;
// Create a request list
- LLSDArray req = new LLSDArray();
+ OSDArray req = new OSDArray();
req.Add("ChatSessionRequest");
req.Add("CopyInventoryFromNotecard");
req.Add("DispatchRegionInfo");
@@ -160,11 +160,11 @@ namespace OpenMetaverse
_SeedRequest.StartRequest(req);
}
- private void SeedRequestCompleteHandler(CapsClient client, LLSD result, Exception error)
+ private void SeedRequestCompleteHandler(CapsClient client, OSD result, Exception error)
{
- if (result != null && result.Type == LLSDType.Map)
+ if (result != null && result.Type == OSDType.Map)
{
- LLSDMap respTable = (LLSDMap)result;
+ OSDMap respTable = (OSDMap)result;
foreach (string cap in respTable.Keys)
{
@@ -193,7 +193,7 @@ namespace OpenMetaverse
Simulator.Client.Network.RaiseConnectedEvent(Simulator);
}
- private void EventQueueEventHandler(string eventName, LLSDMap body)
+ private void EventQueueEventHandler(string eventName, OSDMap body)
{
if (Simulator.Client.Settings.SYNC_PACKETCALLBACKS)
Simulator.Client.Network.CapsEvents.RaiseEvent(eventName, body, Simulator);
diff --git a/OpenMetaverse/CapsToPacket.cs b/OpenMetaverse/CapsToPacket.cs
index 461f567a..dec7045f 100644
--- a/OpenMetaverse/CapsToPacket.cs
+++ b/OpenMetaverse/CapsToPacket.cs
@@ -38,12 +38,12 @@ namespace OpenMetaverse.Packets
public static string ToXmlString(Packet packet)
{
- return LLSDParser.SerializeXmlString(GetLLSD(packet));
+ return LLSDParser.SerializeLLSDXmlString(GetLLSD(packet));
}
- public static LLSD GetLLSD(Packet packet)
+ public static OSD GetLLSD(Packet packet)
{
- LLSDMap body = new LLSDMap();
+ OSDMap body = new OSDMap();
Type type = packet.GetType();
foreach (FieldInfo field in type.GetFields())
@@ -56,7 +56,7 @@ namespace OpenMetaverse.Packets
{
object blockArray = field.GetValue(packet);
Array array = (Array)blockArray;
- LLSDArray blockList = new LLSDArray(array.Length);
+ OSDArray blockList = new OSDArray(array.Length);
IEnumerator ie = array.GetEnumerator();
while (ie.MoveNext())
@@ -80,7 +80,7 @@ namespace OpenMetaverse.Packets
public static byte[] ToBinary(Packet packet)
{
- return LLSDParser.SerializeBinary(GetLLSD(packet));
+ return LLSDParser.SerializeLLSDBinary(GetLLSD(packet));
}
public static Packet FromXmlString(string xml)
@@ -88,10 +88,10 @@ namespace OpenMetaverse.Packets
System.Xml.XmlTextReader reader =
new System.Xml.XmlTextReader(new System.IO.MemoryStream(Utils.StringToBytes(xml)));
- return FromLLSD(LLSDParser.DeserializeXml(reader));
+ return FromLLSD(LLSDParser.DeserializeLLSDXml(reader));
}
- public static Packet FromLLSD(LLSD llsd)
+ public static Packet FromLLSD(OSD osd)
{
// FIXME: Need the inverse of the reflection magic above done here
throw new NotImplementedException();
@@ -106,7 +106,7 @@ namespace OpenMetaverse.Packets
/// packet name for a Packet to be successfully built
/// LLSD to convert to a Packet
/// A Packet on success, otherwise null
- public static Packet BuildPacket(string capsEventName, LLSDMap body)
+ public static Packet BuildPacket(string capsEventName, OSDMap body)
{
Assembly assembly = Assembly.GetExecutingAssembly();
@@ -131,13 +131,13 @@ namespace OpenMetaverse.Packets
if (blockType.IsArray)
{
- LLSDArray array = (LLSDArray)body[field.Name];
+ OSDArray array = (OSDArray)body[field.Name];
Type elementType = blockType.GetElementType();
object[] blockArray = (object[])Array.CreateInstance(elementType, array.Count);
for (int i = 0; i < array.Count; i++)
{
- LLSDMap map = (LLSDMap)array[i];
+ OSDMap map = (OSDMap)array[i];
blockArray[i] = ParseLLSDBlock(map, elementType);
}
@@ -145,7 +145,7 @@ namespace OpenMetaverse.Packets
}
else
{
- LLSDMap map = (LLSDMap)((LLSDArray)body[field.Name])[0];
+ OSDMap map = (OSDMap)((OSDArray)body[field.Name])[0];
field.SetValue(packet, ParseLLSDBlock(map, blockType));
}
}
@@ -159,7 +159,7 @@ namespace OpenMetaverse.Packets
return packet;
}
- private static object ParseLLSDBlock(LLSDMap blockData, Type blockType)
+ private static object ParseLLSDBlock(OSDMap blockData, Type blockType)
{
object block = Activator.CreateInstance(blockType);
@@ -224,17 +224,17 @@ namespace OpenMetaverse.Packets
}
else if (fieldType == typeof(Vector3))
{
- Vector3 vec = ((LLSDArray)blockData[field.Name]).AsVector3();
+ Vector3 vec = ((OSDArray)blockData[field.Name]).AsVector3();
field.SetValue(block, vec);
}
else if (fieldType == typeof(Vector4))
{
- Vector4 vec = ((LLSDArray)blockData[field.Name]).AsVector4();
+ Vector4 vec = ((OSDArray)blockData[field.Name]).AsVector4();
field.SetValue(block, vec);
}
else if (fieldType == typeof(Quaternion))
{
- Quaternion quat = ((LLSDArray)blockData[field.Name]).AsQuaternion();
+ Quaternion quat = ((OSDArray)blockData[field.Name]).AsQuaternion();
field.SetValue(block, quat);
}
}
@@ -245,10 +245,10 @@ namespace OpenMetaverse.Packets
{
if (blockData.ContainsKey(property.Name))
{
- LLSDType proptype = blockData[property.Name].Type;
+ OSDType proptype = blockData[property.Name].Type;
MethodInfo set = property.GetSetMethod();
- if (proptype.Equals(LLSDType.Binary))
+ if (proptype.Equals(OSDType.Binary))
{
set.Invoke(block, new object[] { blockData[property.Name].AsBinary() });
}
@@ -260,22 +260,22 @@ namespace OpenMetaverse.Packets
return block;
}
- private static LLSD BuildLLSDBlock(object block)
+ private static OSD BuildLLSDBlock(object block)
{
- LLSDMap map = new LLSDMap();
+ OSDMap map = new OSDMap();
Type blockType = block.GetType();
foreach (FieldInfo field in blockType.GetFields())
{
if (field.IsPublic)
- map[field.Name] = LLSD.FromObject(field.GetValue(block));
+ map[field.Name] = OSD.FromObject(field.GetValue(block));
}
foreach (PropertyInfo property in blockType.GetProperties())
{
if (property.Name != "Length")
{
- map[property.Name] = LLSD.FromObject(property.GetValue(block, null));
+ map[property.Name] = OSD.FromObject(property.GetValue(block, null));
}
}
diff --git a/OpenMetaverse/EventDictionary.cs b/OpenMetaverse/EventDictionary.cs
index c724fbc6..295c5709 100644
--- a/OpenMetaverse/EventDictionary.cs
+++ b/OpenMetaverse/EventDictionary.cs
@@ -211,7 +211,7 @@ namespace OpenMetaverse
/// Name of the CAPS event
public string CapsEvent;
/// Decoded body of the CAPS event
- public StructuredData.LLSD Body;
+ public StructuredData.OSD Body;
/// Reference to the simulator that generated this event
public Simulator Simulator;
}
@@ -273,7 +273,7 @@ namespace OpenMetaverse
/// Decoded event body
/// Reference to the simulator that
/// generated this event
- internal void RaiseEvent(string capsEvent, StructuredData.LLSD body, Simulator simulator)
+ internal void RaiseEvent(string capsEvent, StructuredData.OSD body, Simulator simulator)
{
bool specialHandler = false;
Caps.EventQueueCallback callback;
@@ -289,9 +289,9 @@ namespace OpenMetaverse
}
// Generic parser next
- if (body.Type == StructuredData.LLSDType.Map)
+ if (body.Type == StructuredData.OSDType.Map)
{
- StructuredData.LLSDMap map = (StructuredData.LLSDMap)body;
+ StructuredData.OSDMap map = (StructuredData.OSDMap)body;
Packet packet = Packet.BuildPacket(capsEvent, map);
if (packet != null)
{
@@ -326,7 +326,7 @@ namespace OpenMetaverse
/// Decoded event body
/// Reference to the simulator that
/// generated this event
- internal void BeginRaiseEvent(string capsEvent, StructuredData.LLSD body, Simulator simulator)
+ internal void BeginRaiseEvent(string capsEvent, StructuredData.OSD body, Simulator simulator)
{
bool specialHandler = false;
Caps.EventQueueCallback callback;
@@ -346,9 +346,9 @@ namespace OpenMetaverse
}
// Generic parser next, don't generic parse events we've manually registered for
- if (body.Type == StructuredData.LLSDType.Map && !_EventTable.ContainsKey(capsEvent))
+ if (body.Type == StructuredData.OSDType.Map && !_EventTable.ContainsKey(capsEvent))
{
- StructuredData.LLSDMap map = (StructuredData.LLSDMap)body;
+ StructuredData.OSDMap map = (StructuredData.OSDMap)body;
Packet packet = Packet.BuildPacket(capsEvent, map);
if (packet != null)
{
diff --git a/OpenMetaverse/GridManager.cs b/OpenMetaverse/GridManager.cs
index 701a076f..acc6a09d 100644
--- a/OpenMetaverse/GridManager.cs
+++ b/OpenMetaverse/GridManager.cs
@@ -285,8 +285,8 @@ namespace OpenMetaverse
if (url != null)
{
- LLSDMap body = new LLSDMap();
- body["Flags"] = LLSD.FromInteger((int)layer);
+ OSDMap body = new OSDMap();
+ body["Flags"] = OSD.FromInteger((int)layer);
CapsClient request = new CapsClient(url);
request.OnComplete += new CapsClient.CompleteCallback(MapLayerResponseHandler);
@@ -475,16 +475,16 @@ namespace OpenMetaverse
}
}
- private void MapLayerResponseHandler(CapsClient client, LLSD result, Exception error)
+ private void MapLayerResponseHandler(CapsClient client, OSD result, Exception error)
{
- LLSDMap body = (LLSDMap)result;
- LLSDArray layerData = (LLSDArray)body["LayerData"];
+ OSDMap body = (OSDMap)result;
+ OSDArray layerData = (OSDArray)body["LayerData"];
if (OnGridLayer != null)
{
for (int i = 0; i < layerData.Count; i++)
{
- LLSDMap thisLayerData = (LLSDMap)layerData[i];
+ OSDMap thisLayerData = (OSDMap)layerData[i];
GridLayer layer;
layer.Bottom = thisLayerData["Bottom"].AsInteger();
diff --git a/OpenMetaverse/GroupManager.cs b/OpenMetaverse/GroupManager.cs
index 129e89b8..88739c04 100644
--- a/OpenMetaverse/GroupManager.cs
+++ b/OpenMetaverse/GroupManager.cs
@@ -237,11 +237,11 @@ namespace OpenMetaverse
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));
+ OpenMetaverse.StructuredData.OSDMap att = new OpenMetaverse.StructuredData.OSDMap();
+ att.Add("item_id", OpenMetaverse.StructuredData.OSD.FromUUID(AttachmentID));
+ att.Add("owner_id", OpenMetaverse.StructuredData.OSD.FromUUID(OwnerID));
- return OpenMetaverse.StructuredData.LLSDParser.SerializeXmlBytes(att);
+ return OpenMetaverse.StructuredData.LLSDParser.SerializeLLSDXmlBytes(att);
/*
//I guess this is how this works, no gaurentees
diff --git a/OpenMetaverse/Helpers.cs b/OpenMetaverse/Helpers.cs
index e5f5ce59..3cfe2f4c 100644
--- a/OpenMetaverse/Helpers.cs
+++ b/OpenMetaverse/Helpers.cs
@@ -491,33 +491,33 @@ namespace OpenMetaverse
///
/// Primitives to convert to a serializable object
/// An object that can be serialized with LLSD
- public static StructuredData.LLSD PrimListToLLSD(List prims)
+ public static StructuredData.OSD PrimListToOSD(List prims)
{
- StructuredData.LLSDMap map = new OpenMetaverse.StructuredData.LLSDMap(prims.Count);
+ StructuredData.OSDMap map = new OpenMetaverse.StructuredData.OSDMap(prims.Count);
for (int i = 0; i < prims.Count; i++)
- map.Add(prims[i].LocalID.ToString(), prims[i].GetLLSD());
+ map.Add(prims[i].LocalID.ToString(), prims[i].GetOSD());
return map;
}
///
- /// Deserializes LLSD in to a list of primitives
+ /// Deserializes OSD in to a list of primitives
///
/// Structure holding the serialized primitive list,
- /// must be of the LLSDMap type
+ /// must be of the SDMap type
/// A list of deserialized primitives
- public static List LLSDToPrimList(StructuredData.LLSD llsd)
+ public static List OSDToPrimList(StructuredData.OSD osd)
{
- if (llsd.Type != StructuredData.LLSDType.Map)
+ if (osd.Type != StructuredData.OSDType.Map)
throw new ArgumentException("LLSD must be in the Map structure");
- StructuredData.LLSDMap map = (StructuredData.LLSDMap)llsd;
+ StructuredData.OSDMap map = (StructuredData.OSDMap)osd;
List prims = new List(map.Count);
- foreach (KeyValuePair kvp in map)
+ foreach (KeyValuePair kvp in map)
{
- Primitive prim = Primitive.FromLLSD(kvp.Value);
+ Primitive prim = Primitive.FromOSD(kvp.Value);
prim.LocalID = UInt32.Parse(kvp.Key);
prims.Add(prim);
}
diff --git a/OpenMetaverse/InventoryManager.cs b/OpenMetaverse/InventoryManager.cs
index 2bb1b7a2..35585048 100644
--- a/OpenMetaverse/InventoryManager.cs
+++ b/OpenMetaverse/InventoryManager.cs
@@ -1732,12 +1732,12 @@ namespace OpenMetaverse
if (url != null)
{
- LLSDMap query = new LLSDMap();
- query.Add("folder_id", LLSD.FromUUID(folderID));
- query.Add("asset_type", LLSD.FromString(AssetTypeToString(assetType)));
- query.Add("inventory_type", LLSD.FromString(InventoryTypeToString(invType)));
- query.Add("name", LLSD.FromString(name));
- query.Add("description", LLSD.FromString(description));
+ OSDMap query = new OSDMap();
+ query.Add("folder_id", OSD.FromUUID(folderID));
+ query.Add("asset_type", OSD.FromString(AssetTypeToString(assetType)));
+ query.Add("inventory_type", OSD.FromString(InventoryTypeToString(invType)));
+ query.Add("name", OSD.FromString(name));
+ query.Add("description", OSD.FromString(description));
// Make the request
CapsClient request = new CapsClient(url);
@@ -1939,10 +1939,10 @@ namespace OpenMetaverse
if (url != null)
{
- LLSDMap query = new LLSDMap();
- query.Add("item_id", LLSD.FromUUID(notecardID));
+ OSDMap query = new OSDMap();
+ query.Add("item_id", OSD.FromUUID(notecardID));
- byte[] postData = StructuredData.LLSDParser.SerializeXmlBytes(query);
+ byte[] postData = StructuredData.LLSDParser.SerializeLLSDXmlBytes(query);
// Make the request
CapsClient request = new CapsClient(url);
@@ -2884,7 +2884,7 @@ namespace OpenMetaverse
#region Callbacks
- private void CreateItemFromAssetResponse(CapsClient client, LLSD result, Exception error)
+ private void CreateItemFromAssetResponse(CapsClient client, OSD result, Exception error)
{
object[] args = (object[])client.UserData;
CapsClient.ProgressCallback progCallback = (CapsClient.ProgressCallback)args[0];
@@ -2898,7 +2898,7 @@ namespace OpenMetaverse
return;
}
- LLSDMap contents = (LLSDMap)result;
+ OSDMap contents = (OSDMap)result;
string status = contents["state"].AsString().ToLower();
@@ -3490,9 +3490,9 @@ namespace OpenMetaverse
}
}
- private void UploadNotecardAssetResponse(CapsClient client, LLSD result, Exception error)
+ private void UploadNotecardAssetResponse(CapsClient client, OSD result, Exception error)
{
- LLSDMap contents = (LLSDMap)result;
+ OSDMap contents = (OSDMap)result;
KeyValuePair kvp = (KeyValuePair)(((object[])client.UserData)[0]);
NotecardUploadedAssetCallback callback = kvp.Key;
byte[] itemData = (byte[])kvp.Value;
diff --git a/OpenMetaverse/LLSD/BinaryLLSD.cs b/OpenMetaverse/LLSD/BinaryLLSD.cs
deleted file mode 100644
index bb4d55cf..00000000
--- a/OpenMetaverse/LLSD/BinaryLLSD.cs
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2007-2008, openmetaverse.org
- * All rights reserved.
- *
- * - Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * - Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * - Neither the name of the openmetaverse.org nor the names
- * of its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- *
- * This implementation is based upon the description at
- *
- * http://wiki.secondlife.com/wiki/LLSD
- *
- * and (partially) tested against the (supposed) reference implementation at
- *
- * http://svn.secondlife.com/svn/linden/release/indra/lib/python/indra/base/llsd.py
- *
- */
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-
- namespace OpenMetaverse.StructuredData
- {
- ///
- ///
- ///
- public static partial class LLSDParser
- {
- private const int initialBufferSize = 128;
- private const int int32Length = 4;
- private const int doubleLength = 8;
-
- private static byte[] binaryHead = Encoding.ASCII.GetBytes( "\n" );
- private const byte undefBinaryValue = (byte)'!';
- private const byte trueBinaryValue = (byte) '1';
- private const byte falseBinaryValue = (byte) '0';
- private const byte integerBinaryMarker = (byte) 'i';
- private const byte realBinaryMarker = (byte) 'r';
- private const byte uuidBinaryMarker = (byte) 'u';
- private const byte binaryBinaryMarker = (byte) 'b';
- private const byte stringBinaryMarker = (byte) 's';
- private const byte uriBinaryMarker = (byte) 'l';
- private const byte dateBinaryMarker = (byte) 'd';
- private const byte arrayBeginBinaryMarker = (byte) '[';
- private const byte arrayEndBinaryMarker = (byte) ']';
- private const byte mapBeginBinaryMarker = (byte) '{';
- private const byte mapEndBinaryMarker = (byte) '}';
- private const byte keyBinaryMarker = (byte) 'k';
-
- ///
- ///
- ///
- ///
- ///
- public static LLSD DeserializeBinary(byte[] binaryData)
- {
-
- MemoryStream stream = new MemoryStream( binaryData );
- LLSD llsd = DeserializeBinary( stream );
- stream.Close();
- return llsd;
- }
-
- ///
- ///
- ///
- ///
- ///
- public static LLSD DeserializeBinary( MemoryStream stream )
- {
- SkipWhiteSpace( stream );
-
- bool result = FindByteArray( stream, binaryHead );
- if ( !result )
- throw new LLSDException( "No binary encoded LLSD." );
-
- return ParseBinaryElement( stream );
- }
-
- ///
- ///
- ///
- ///
- ///
- public static byte[] SerializeBinary(LLSD llsd)
- {
- MemoryStream stream = SerializeBinaryStream( llsd );
- byte[] binaryData = stream.ToArray();
- stream.Close();
-
- return binaryData;
- }
-
- ///
- ///
- ///
- ///
- ///
- public static MemoryStream SerializeBinaryStream(LLSD data)
- {
- MemoryStream stream = new MemoryStream( initialBufferSize );
-
- stream.Write( binaryHead, 0, binaryHead.Length );
- SerializeBinaryElement( stream, data );
- return stream;
- }
-
- private static void SerializeBinaryElement( MemoryStream stream, LLSD llsd )
- {
- switch( llsd.Type )
- {
- case LLSDType.Unknown:
- stream.WriteByte( undefBinaryValue );
- break;
- case LLSDType.Boolean:
- stream.Write( llsd.AsBinary(), 0, 1 );
- break;
- case LLSDType.Integer:
- stream.WriteByte( integerBinaryMarker );
- stream.Write( llsd.AsBinary(), 0, int32Length );
- break;
- case LLSDType.Real:
- stream.WriteByte( realBinaryMarker );
- stream.Write( llsd.AsBinary(), 0, doubleLength );
- break;
- case LLSDType.UUID:
- stream.WriteByte( uuidBinaryMarker );
- stream.Write( llsd.AsBinary(), 0, 16 );
- break;
- case LLSDType.String:
- stream.WriteByte( stringBinaryMarker );
- byte[] rawString = llsd.AsBinary();
- byte[] stringLengthNetEnd = HostToNetworkIntBytes( rawString.Length );
- stream.Write( stringLengthNetEnd, 0, int32Length );
- stream.Write( rawString, 0, rawString.Length );
- break;
- case LLSDType.Binary:
- stream.WriteByte( binaryBinaryMarker );
- byte[] rawBinary = llsd.AsBinary();
- byte[] binaryLengthNetEnd = HostToNetworkIntBytes( rawBinary.Length );
- stream.Write( binaryLengthNetEnd, 0, int32Length );
- stream.Write( rawBinary, 0, rawBinary.Length );
- break;
- case LLSDType.Date:
- stream.WriteByte( dateBinaryMarker );
- stream.Write( llsd.AsBinary(), 0, doubleLength );
- break;
- case LLSDType.URI:
- stream.WriteByte( uriBinaryMarker );
- byte[] rawURI = llsd.AsBinary();
- byte[] uriLengthNetEnd = HostToNetworkIntBytes( rawURI.Length );
- stream.Write( uriLengthNetEnd, 0, int32Length );
- stream.Write( rawURI, 0, rawURI.Length );
- break;
- case LLSDType.Array:
- SerializeBinaryArray( stream, (LLSDArray)llsd );
- break;
- case LLSDType.Map:
- SerializeBinaryMap( stream, (LLSDMap)llsd );
- break;
- default:
- throw new LLSDException( "Binary serialization: Not existing element discovered." );
-
- }
- }
-
- private static void SerializeBinaryArray( MemoryStream stream, LLSDArray llsdArray )
- {
- stream.WriteByte( arrayBeginBinaryMarker );
- byte[] binaryNumElementsHostEnd = HostToNetworkIntBytes( llsdArray.Count );
- stream.Write( binaryNumElementsHostEnd, 0, int32Length );
-
- foreach( LLSD llsd in llsdArray )
- {
- SerializeBinaryElement( stream, llsd );
- }
- stream.WriteByte( arrayEndBinaryMarker );
- }
-
- private static void SerializeBinaryMap( MemoryStream stream, LLSDMap llsdMap )
- {
- stream.WriteByte( mapBeginBinaryMarker );
- byte[] binaryNumElementsNetEnd = HostToNetworkIntBytes( llsdMap.Count );
- stream.Write( binaryNumElementsNetEnd, 0, int32Length );
-
- foreach( KeyValuePair kvp in llsdMap )
- {
- stream.WriteByte( keyBinaryMarker );
- byte[] binaryKey = Encoding.UTF8.GetBytes( kvp.Key );
- byte[] binaryKeyLength = HostToNetworkIntBytes( binaryKey.Length );
- stream.Write( binaryKeyLength, 0, int32Length );
- stream.Write( binaryKey, 0, binaryKey.Length );
- SerializeBinaryElement( stream, kvp.Value );
- }
- stream.WriteByte( mapEndBinaryMarker );
- }
-
- private static LLSD ParseBinaryElement(MemoryStream stream)
- {
- SkipWhiteSpace( stream );
- LLSD llsd;
-
- int marker = stream.ReadByte();
- if ( marker < 0 )
- throw new LLSDException( "Binary LLSD parsing:Unexpected end of stream." );
-
- switch( (byte)marker )
- {
- case undefBinaryValue:
- llsd = new LLSD();
- break;
- case trueBinaryValue:
- llsd = LLSD.FromBoolean( true );
- break;
- case falseBinaryValue:
- llsd = LLSD.FromBoolean( false );
- break;
- case integerBinaryMarker:
- int integer = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- llsd = LLSD.FromInteger( integer );
- break;
- case realBinaryMarker:
- double dbl = NetworkToHostDouble( ConsumeBytes( stream, doubleLength ));
- llsd = LLSD.FromReal( dbl );
- break;
- case uuidBinaryMarker:
- llsd = LLSD.FromUUID( new UUID( ConsumeBytes( stream, 16 ), 0));
- break;
- case binaryBinaryMarker:
- int binaryLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- llsd = LLSD.FromBinary( ConsumeBytes( stream, binaryLength ));
- break;
- case stringBinaryMarker:
- int stringLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- string ss = Encoding.UTF8.GetString( ConsumeBytes( stream, stringLength ));
- llsd = LLSD.FromString( ss );
- break;
- case uriBinaryMarker:
- int uriLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- string sUri = Encoding.UTF8.GetString( ConsumeBytes( stream, uriLength ));
- Uri uri;
- try
- {
- uri = new Uri( sUri, UriKind.RelativeOrAbsolute );
- }
- catch
- {
- throw new LLSDException( "Binary LLSD parsing: Invalid Uri format detected." );
- }
- llsd = LLSD.FromUri( uri );
- break;
- case dateBinaryMarker:
- double timestamp = NetworkToHostDouble( ConsumeBytes( stream, doubleLength ));
- DateTime dateTime = DateTime.SpecifyKind( Utils.Epoch, DateTimeKind.Utc );
- dateTime = dateTime.AddSeconds(timestamp);
- llsd = LLSD.FromDate( dateTime.ToLocalTime() );
- break;
- case arrayBeginBinaryMarker:
- llsd = ParseBinaryArray( stream );
- break;
- case mapBeginBinaryMarker:
- llsd = ParseBinaryMap( stream );
- break;
- default:
- throw new LLSDException( "Binary LLSD parsing: Unknown type marker." );
-
- }
- return llsd;
- }
-
- 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;
- }
-
- private static LLSD ParseBinaryMap(MemoryStream stream)
- {
- int numElements = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- int crrElement = 0;
- LLSDMap llsdMap = new LLSDMap();
- while( crrElement < numElements )
- {
- if (!FindByte( stream, keyBinaryMarker ))
- throw new LLSDException( "Binary LLSD parsing: Missing key marker in map." );
- int keyLength = NetworkToHostInt( ConsumeBytes( stream, int32Length ));
- string key = Encoding.UTF8.GetString( ConsumeBytes( stream, keyLength ));
- llsdMap[key] = ParseBinaryElement( stream );
- crrElement++;
- }
-
- if ( !FindByte( stream, mapEndBinaryMarker ))
- throw new LLSDException( "Binary LLSD parsing: Missing end marker in map." );
-
- return (LLSD)llsdMap;
- }
-
- ///
- ///
- ///
- ///
- public static void SkipWhiteSpace(MemoryStream stream)
- {
- int bt;
-
- while ( ((bt = stream.ReadByte()) > 0) &&
- ( (byte)bt == ' ' || (byte)bt == '\t' ||
- (byte)bt == '\n' || (byte)bt == '\r' )
- )
- {
- }
- stream.Seek( -1, SeekOrigin.Current );
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public static bool FindByte( MemoryStream stream, byte toFind )
- {
- int bt = stream.ReadByte();
- if ( bt < 0 )
- return false;
- if ( (byte)bt == toFind )
- return true;
- else
- {
- stream.Seek( -1L, SeekOrigin.Current );
- return false;
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public static bool FindByteArray( MemoryStream stream, byte[] toFind )
- {
- int lastIndexToFind = toFind.Length - 1;
- int crrIndex = 0;
- bool found = true;
- int bt;
- long lastPosition = stream.Position;
-
- while( found &&
- ((bt = stream.ReadByte()) > 0) &&
- (crrIndex <= lastIndexToFind)
- )
- {
- if ( toFind[crrIndex] == (byte)bt ) {
- found = true;
- crrIndex++;
- }
- else
- found = false;
- }
-
- if ( found && crrIndex > lastIndexToFind )
- {
- stream.Seek( -1L, SeekOrigin.Current );
- return true;
- }
- else
- {
- stream.Position = lastPosition;
- return false;
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public static byte[] ConsumeBytes( MemoryStream stream, int consumeBytes )
- {
- byte[] bytes = new byte[consumeBytes];
- if (stream.Read( bytes, 0, consumeBytes ) < consumeBytes )
- throw new LLSDException( "Binary LLSD parsing: Unexpected end of stream." );
- return bytes;
- }
-
- ///
- ///
- ///
- ///
- ///
- public static int NetworkToHostInt( byte[] binaryNetEnd )
- {
- if ( binaryNetEnd == null )
- return -1;
-
- int intNetEnd = BitConverter.ToInt32( binaryNetEnd, 0 );
- int intHostEnd = System.Net.IPAddress.NetworkToHostOrder( intNetEnd );
- return intHostEnd;
- }
-
- ///
- ///
- ///
- ///
- ///
- public static double NetworkToHostDouble( byte[] binaryNetEnd )
- {
- if ( binaryNetEnd == null )
- return -1d;
- long longNetEnd = BitConverter.ToInt64( binaryNetEnd, 0 );
- long longHostEnd = System.Net.IPAddress.NetworkToHostOrder( longNetEnd );
- byte[] binaryHostEnd = BitConverter.GetBytes( longHostEnd );
- double doubleHostEnd = BitConverter.ToDouble( binaryHostEnd, 0 );
- return doubleHostEnd;
- }
-
- ///
- ///
- ///
- ///
- ///
- public static byte[] HostToNetworkIntBytes( int intHostEnd )
- {
- int intNetEnd = System.Net.IPAddress.HostToNetworkOrder( intHostEnd );
- byte[] bytesNetEnd = BitConverter.GetBytes( intNetEnd );
- return bytesNetEnd;
-
- }
- }
- }
\ No newline at end of file
diff --git a/OpenMetaverse/LLSD/xml-llsd.dtd b/OpenMetaverse/LLSD/xml-llsd.dtd
deleted file mode 100644
index 019deaaf..00000000
--- a/OpenMetaverse/LLSD/xml-llsd.dtd
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/OpenMetaverse/LLSD/xml-llsd.xsd b/OpenMetaverse/LLSD/xml-llsd.xsd
deleted file mode 100644
index 2c6f9185..00000000
--- a/OpenMetaverse/LLSD/xml-llsd.xsd
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OpenMetaverse/Login.cs b/OpenMetaverse/Login.cs
index 6a396f55..0c3012fa 100644
--- a/OpenMetaverse/Login.cs
+++ b/OpenMetaverse/Login.cs
@@ -129,7 +129,7 @@ namespace OpenMetaverse
public InventoryFolder[] LibrarySkeleton;
public UUID LibraryOwner;
- public void Parse(LLSDMap reply)
+ public void Parse(OSDMap reply)
{
try
{
@@ -142,23 +142,23 @@ namespace OpenMetaverse
AgentAccess = ParseString("agent_access", reply);
LookAt = ParseVector3("look_at", reply);
}
- catch (LLSDException e)
+ catch (OSDException e)
{
Logger.DebugLog("Login server returned (some) invalid data: " + e.Message);
}
// Home
- LLSDMap home = null;
- LLSD llsdHome = LLSDParser.DeserializeNotation(reply["home"].AsString());
+ OSDMap home = null;
+ OSD osdHome = LLSDParser.DeserializeLLSDNotation(reply["home"].AsString());
- if (llsdHome.Type == LLSDType.Map)
+ if (osdHome.Type == OSDType.Map)
{
- home = (LLSDMap)llsdHome;
+ home = (OSDMap)osdHome;
- LLSD homeRegion;
- if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == LLSDType.Array)
+ OSD homeRegion;
+ if (home.TryGetValue("region_handle", out homeRegion) && homeRegion.Type == OSDType.Array)
{
- LLSDArray homeArray = (LLSDArray)homeRegion;
+ OSDArray homeArray = (OSDArray)homeRegion;
if (homeArray.Count == 2)
HomeRegion = Utils.UIntsToLong((uint)homeArray[0].AsInteger(), (uint)homeArray[1].AsInteger());
else
@@ -184,17 +184,17 @@ namespace OpenMetaverse
SeedCapability = ParseString("seed_capability", reply);
// Buddy list
- LLSD buddyLLSD;
- if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == LLSDType.Array)
+ OSD buddyLLSD;
+ if (reply.TryGetValue("buddy-list", out buddyLLSD) && buddyLLSD.Type == OSDType.Array)
{
- LLSDArray buddyArray = (LLSDArray)buddyLLSD;
+ OSDArray buddyArray = (OSDArray)buddyLLSD;
BuddyList = new FriendInfo[buddyArray.Count];
for (int i = 0; i < buddyArray.Count; i++)
{
- if (buddyArray[i].Type == LLSDType.Map)
+ if (buddyArray[i].Type == OSDType.Map)
{
- LLSDMap buddy = (LLSDMap)buddyArray[i];
+ OSDMap buddy = (OSDMap)buddyArray[i];
BuddyList[i] = new FriendInfo(
ParseUUID("buddy_id", buddy),
(FriendRights)ParseUInt("buddy_rights_given", buddy),
@@ -362,24 +362,24 @@ namespace OpenMetaverse
WriteXmlRpcStringMember(writer, false, "inventory_host", IPAddress.Loopback.ToString());
// home
- LLSDArray homeRegionHandle = new LLSDArray(2);
+ OSDArray homeRegionHandle = new OSDArray(2);
uint homeRegionX, homeRegionY;
Utils.LongToUInts(HomeRegion, out homeRegionX, out homeRegionY);
- homeRegionHandle.Add(LLSD.FromReal((double)homeRegionX));
- homeRegionHandle.Add(LLSD.FromReal((double)homeRegionY));
+ homeRegionHandle.Add(OSD.FromReal((double)homeRegionX));
+ homeRegionHandle.Add(OSD.FromReal((double)homeRegionY));
- LLSDMap home = new LLSDMap(3);
+ OSDMap home = new OSDMap(3);
home["region_handle"] = homeRegionHandle;
- home["position"] = LLSD.FromVector3(HomePosition);
- home["look_at"] = LLSD.FromVector3(HomeLookAt);
+ home["position"] = OSD.FromVector3(HomePosition);
+ home["look_at"] = OSD.FromVector3(HomeLookAt);
- WriteXmlRpcStringMember(writer, false, "home", LLSDParser.SerializeNotation(home));
+ WriteXmlRpcStringMember(writer, false, "home", LLSDParser.SerializeLLSDNotation(home));
// message
WriteXmlRpcStringMember(writer, false, "message", Message);
// look_at
- WriteXmlRpcStringMember(writer, false, "look_at", LLSDParser.SerializeNotation(LLSD.FromVector3(LookAt)));
+ WriteXmlRpcStringMember(writer, false, "look_at", LLSDParser.SerializeLLSDNotation(OSD.FromVector3(LookAt)));
// login
WriteXmlRpcStringMember(writer, false, "login", "true");
@@ -423,45 +423,45 @@ namespace OpenMetaverse
#region Parsing Helpers
- public static uint ParseUInt(string key, LLSDMap reply)
+ public static uint ParseUInt(string key, OSDMap reply)
{
- LLSD llsd;
- if (reply.TryGetValue(key, out llsd))
- return (uint)llsd.AsInteger();
+ OSD osd;
+ if (reply.TryGetValue(key, out osd))
+ return (uint)osd.AsInteger();
else
return 0;
}
- public static UUID ParseUUID(string key, LLSDMap reply)
+ public static UUID ParseUUID(string key, OSDMap reply)
{
- LLSD llsd;
- if (reply.TryGetValue(key, out llsd))
- return llsd.AsUUID();
+ OSD osd;
+ if (reply.TryGetValue(key, out osd))
+ return osd.AsUUID();
else
return UUID.Zero;
}
- public static string ParseString(string key, LLSDMap reply)
+ public static string ParseString(string key, OSDMap reply)
{
- LLSD llsd;
- if (reply.TryGetValue(key, out llsd))
- return llsd.AsString();
+ OSD osd;
+ if (reply.TryGetValue(key, out osd))
+ return osd.AsString();
else
return String.Empty;
}
- public static Vector3 ParseVector3(string key, LLSDMap reply)
+ public static Vector3 ParseVector3(string key, OSDMap reply)
{
- LLSD llsd;
- if (reply.TryGetValue(key, out llsd))
+ OSD osd;
+ if (reply.TryGetValue(key, out osd))
{
- if (llsd.Type == LLSDType.Array)
+ if (osd.Type == OSDType.Array)
{
- return ((LLSDArray)llsd).AsVector3();
+ return ((OSDArray)osd).AsVector3();
}
- else if (llsd.Type == LLSDType.String)
+ else if (osd.Type == OSDType.String)
{
- LLSDArray array = (LLSDArray)LLSDParser.DeserializeNotation(llsd.AsString());
+ OSDArray array = (OSDArray)LLSDParser.DeserializeLLSDNotation(osd.AsString());
return array.AsVector3();
}
}
@@ -469,16 +469,16 @@ namespace OpenMetaverse
return Vector3.Zero;
}
- public static UUID ParseMappedUUID(string key, string key2, LLSDMap reply)
+ public static UUID ParseMappedUUID(string key, string key2, OSDMap reply)
{
- LLSD folderLLSD;
- if (reply.TryGetValue(key, out folderLLSD) && folderLLSD.Type == LLSDType.Array)
+ OSD folderOSD;
+ if (reply.TryGetValue(key, out folderOSD) && folderOSD.Type == OSDType.Array)
{
- LLSDArray array = (LLSDArray)folderLLSD;
- if (array.Count == 1 && array[0].Type == LLSDType.Map)
+ OSDArray array = (OSDArray)folderOSD;
+ if (array.Count == 1 && array[0].Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)array[0];
- LLSD folder;
+ OSDMap map = (OSDMap)array[0];
+ OSD folder;
if (map.TryGetValue(key2, out folder))
return folder.AsUUID();
}
@@ -487,20 +487,20 @@ namespace OpenMetaverse
return UUID.Zero;
}
- public static InventoryFolder[] ParseInventoryFolders(string key, UUID owner, LLSDMap reply)
+ public static InventoryFolder[] ParseInventoryFolders(string key, UUID owner, OSDMap reply)
{
List folders = new List();
- LLSD skeleton;
- if (reply.TryGetValue(key, out skeleton) && skeleton.Type == LLSDType.Array)
+ OSD skeleton;
+ if (reply.TryGetValue(key, out skeleton) && skeleton.Type == OSDType.Array)
{
- LLSDArray array = (LLSDArray)skeleton;
+ OSDArray array = (OSDArray)skeleton;
for (int i = 0; i < array.Count; i++)
{
- if (array[i].Type == LLSDType.Map)
+ if (array[i].Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)array[i];
+ OSDMap map = (OSDMap)array[i];
InventoryFolder folder = new InventoryFolder(map["folder_id"].AsUUID());
folder.PreferredType = (AssetType)map["type_default"].AsInteger();
folder.Version = map["version"].AsInteger();
@@ -925,36 +925,36 @@ namespace OpenMetaverse
// TODO: At some point, maybe we should check the cert?
// Create the CAPS login structure
- LLSDMap loginLLSD = new LLSDMap();
- loginLLSD["first"] = LLSD.FromString(loginParams.FirstName);
- loginLLSD["last"] = LLSD.FromString(loginParams.LastName);
- loginLLSD["passwd"] = LLSD.FromString(loginParams.Password);
- loginLLSD["start"] = LLSD.FromString(loginParams.Start);
- loginLLSD["channel"] = LLSD.FromString(loginParams.Channel);
- loginLLSD["version"] = LLSD.FromString(loginParams.Version);
- loginLLSD["platform"] = LLSD.FromString(loginParams.Platform);
- loginLLSD["mac"] = LLSD.FromString(loginParams.MAC);
- loginLLSD["agree_to_tos"] = LLSD.FromBoolean(true);
- loginLLSD["read_critical"] = LLSD.FromBoolean(true);
- loginLLSD["viewer_digest"] = LLSD.FromString(loginParams.ViewerDigest);
- loginLLSD["id0"] = LLSD.FromString(loginParams.id0);
+ OSDMap loginLLSD = new OSDMap();
+ loginLLSD["first"] = OSD.FromString(loginParams.FirstName);
+ loginLLSD["last"] = OSD.FromString(loginParams.LastName);
+ loginLLSD["passwd"] = OSD.FromString(loginParams.Password);
+ loginLLSD["start"] = OSD.FromString(loginParams.Start);
+ loginLLSD["channel"] = OSD.FromString(loginParams.Channel);
+ loginLLSD["version"] = OSD.FromString(loginParams.Version);
+ loginLLSD["platform"] = OSD.FromString(loginParams.Platform);
+ loginLLSD["mac"] = OSD.FromString(loginParams.MAC);
+ loginLLSD["agree_to_tos"] = OSD.FromBoolean(true);
+ loginLLSD["read_critical"] = OSD.FromBoolean(true);
+ loginLLSD["viewer_digest"] = OSD.FromString(loginParams.ViewerDigest);
+ loginLLSD["id0"] = OSD.FromString(loginParams.id0);
// Create the options LLSD array
- LLSDArray optionsLLSD = new LLSDArray();
+ OSDArray optionsOSD = new OSDArray();
for (int i = 0; i < loginParams.Options.Count; i++)
- optionsLLSD.Add(LLSD.FromString(loginParams.Options[i]));
+ optionsOSD.Add(OSD.FromString(loginParams.Options[i]));
foreach (string[] callbackOpts in CallbackOptions.Values)
{
if (callbackOpts != null)
{
for (int i = 0; i < callbackOpts.Length; i++)
{
- if (!optionsLLSD.Contains(callbackOpts[i]))
- optionsLLSD.Add(callbackOpts[i]);
+ if (!optionsOSD.Contains(callbackOpts[i]))
+ optionsOSD.Add(callbackOpts[i]);
}
}
}
- loginLLSD["options"] = optionsLLSD;
+ loginLLSD["options"] = optionsOSD;
// Make the CAPS POST for login
Uri loginUri;
@@ -972,7 +972,7 @@ namespace OpenMetaverse
CapsClient loginRequest = new CapsClient(loginUri);
loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyHandler);
loginRequest.UserData = CurrentContext;
- loginRequest.StartRequest(LLSDParser.SerializeXmlBytes(loginLLSD), "application/xml+llsd");
+ loginRequest.StartRequest(LLSDParser.SerializeLLSDXmlBytes(loginLLSD), "application/xml+llsd");
}
private void UpdateLoginStatus(LoginStatus status, string message)
@@ -997,31 +997,31 @@ namespace OpenMetaverse
}
}
- private void LoginReplyHandler(CapsClient client, LLSD result, Exception error)
+ private void LoginReplyHandler(CapsClient client, OSD result, Exception error)
{
if (error == null)
{
- if (result != null && result.Type == LLSDType.Map)
+ if (result != null && result.Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)result;
+ OSDMap map = (OSDMap)result;
- LLSD llsd;
+ OSD osd;
string reason, message;
- if (map.TryGetValue("reason", out llsd))
- reason = llsd.AsString();
+ if (map.TryGetValue("reason", out osd))
+ reason = osd.AsString();
else
reason = String.Empty;
- if (map.TryGetValue("message", out llsd))
- message = llsd.AsString();
+ if (map.TryGetValue("message", out osd))
+ message = osd.AsString();
else
message = String.Empty;
- if (map.TryGetValue("login", out llsd))
+ if (map.TryGetValue("login", out osd))
{
- bool loginSuccess = llsd.AsBoolean();
- bool redirect = (llsd.AsString() == "indeterminate");
+ bool loginSuccess = osd.AsBoolean();
+ bool redirect = (osd.AsString() == "indeterminate");
LoginResponseData data = new LoginResponseData();
data.Reason = reason;
data.Message = message;
diff --git a/OpenMetaverse/NetworkManager.cs b/OpenMetaverse/NetworkManager.cs
index aca7830f..c39a2aee 100644
--- a/OpenMetaverse/NetworkManager.cs
+++ b/OpenMetaverse/NetworkManager.cs
@@ -1105,17 +1105,17 @@ namespace OpenMetaverse
/// Handler for EnableSimulator packet
///
/// the Capabilities Key, "EnableSimulator"
- /// the LLSD Encoded packet
+ /// the LLSD Encoded packet
/// The simulator the packet was sent from
- private void EnableSimulatorHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void EnableSimulatorHandler(string capsKey, OSD osd, Simulator simulator)
{
if (!Client.Settings.MULTIPLE_SIMS) return;
- LLSDMap map = (LLSDMap)llsd;
- LLSDArray connectInfo = (LLSDArray)map["SimulatorInfo"];
+ OSDMap map = (OSDMap)osd;
+ OSDArray connectInfo = (OSDArray)map["SimulatorInfo"];
for(int i = 0; i < connectInfo.Count; i++)
{
- LLSDMap data = (LLSDMap)connectInfo[i];
+ OSDMap data = (OSDMap)connectInfo[i];
IPAddress ip = new IPAddress(data["IP"].AsBinary());
ushort port = (ushort)data["Port"].AsInteger();
diff --git a/OpenMetaverse/ParcelManager.cs b/OpenMetaverse/ParcelManager.cs
index e6ed3f4c..58ef4f11 100644
--- a/OpenMetaverse/ParcelManager.cs
+++ b/OpenMetaverse/ParcelManager.cs
@@ -1427,19 +1427,19 @@ namespace OpenMetaverse
/// Not used (will always be ParcelProperties)
/// LLSD Structured data
/// Object representing simulator
- private void ParcelPropertiesReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ParcelPropertiesReplyHandler(string capsKey, OSD llsd, Simulator simulator)
{
if (OnParcelProperties != null || Client.Settings.PARCEL_TRACKING == true)
{
- LLSDMap map = (LLSDMap)llsd;
- LLSDMap parcelDataBlock = (LLSDMap)(((LLSDArray)map["ParcelData"])[0]);
- LLSDMap ageVerifyBlock = (LLSDMap)(((LLSDArray)map["AgeVerificationBlock"])[0]);
- LLSDMap mediaDataBlock = (LLSDMap)(((LLSDArray)map["MediaData"])[0]);
+ OSDMap map = (OSDMap)llsd;
+ OSDMap parcelDataBlock = (OSDMap)(((OSDArray)map["ParcelData"])[0]);
+ OSDMap ageVerifyBlock = (OSDMap)(((OSDArray)map["AgeVerificationBlock"])[0]);
+ OSDMap mediaDataBlock = (OSDMap)(((OSDArray)map["MediaData"])[0]);
Parcel parcel = new Parcel(parcelDataBlock["LocalID"].AsInteger());
- parcel.AABBMax = ((LLSDArray)parcelDataBlock["AABBMax"]).AsVector3();
- parcel.AABBMin = ((LLSDArray)parcelDataBlock["AABBMin"]).AsVector3();
+ parcel.AABBMax = ((OSDArray)parcelDataBlock["AABBMax"]).AsVector3();
+ parcel.AABBMin = ((OSDArray)parcelDataBlock["AABBMin"]).AsVector3();
parcel.Area = parcelDataBlock["Area"].AsInteger();
parcel.AuctionID = (uint)parcelDataBlock["AuctionID"].AsInteger();
parcel.AuthBuyerID = parcelDataBlock["AuthBuyerID"].AsUUID();
@@ -1489,8 +1489,8 @@ namespace OpenMetaverse
parcel.SnapshotID = parcelDataBlock["SnapshotID"].AsUUID();
parcel.Status = (Parcel.ParcelStatus)parcelDataBlock["Status"].AsInteger();
parcel.TotalPrims = parcelDataBlock["TotalPrims"].AsInteger();
- parcel.UserLocation = ((LLSDArray)parcelDataBlock["UserLocation"]).AsVector3();
- parcel.UserLookAt = ((LLSDArray)parcelDataBlock["UserLookAt"]).AsVector3();
+ parcel.UserLocation = ((OSDArray)parcelDataBlock["UserLocation"]).AsVector3();
+ parcel.UserLookAt = ((OSDArray)parcelDataBlock["UserLookAt"]).AsVector3();
parcel.Media.MediaDesc = mediaDataBlock["MediaDesc"].AsString();
parcel.Media.MediaHeight = mediaDataBlock["MediaHeight"].AsInteger();
parcel.Media.MediaWidth = mediaDataBlock["MediaWidth"].AsInteger();
@@ -1606,30 +1606,30 @@ namespace OpenMetaverse
///
///
///
- private void ParcelObjectOwnersReplyHandler(string capsKey, LLSD llsd, Simulator simulator)
+ private void ParcelObjectOwnersReplyHandler(string capsKey, OSD llsd, Simulator simulator)
{
if (OnPrimOwnersListReply != null)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)llsd;
List primOwners = new List();
if (map.ContainsKey("Data") && map.ContainsKey("DataExtended"))
{
- LLSDArray dataBlock = (LLSDArray)map["Data"];
- LLSDArray dataExtendedBlock = (LLSDArray)map["DataExtended"];
+ OSDArray dataBlock = (OSDArray)map["Data"];
+ OSDArray dataExtendedBlock = (OSDArray)map["DataExtended"];
for (int i = 0; i < dataBlock.Count; i++)
{
ParcelPrimOwners poe = new ParcelPrimOwners();
- poe.OwnerID = ((LLSDMap)dataBlock[i])["OwnerID"].AsUUID();
- poe.Count = ((LLSDMap)dataBlock[i])["Count"].AsInteger();
- poe.IsGroupOwned = ((LLSDMap)dataBlock[i])["IsGroupOwned"].AsBoolean();
- poe.OnlineStatus = ((LLSDMap)dataBlock[i])["OnlineStatus"].AsBoolean();
- if (((LLSDMap)dataExtendedBlock[i]).ContainsKey("TimeStamp"))
+ poe.OwnerID = ((OSDMap)dataBlock[i])["OwnerID"].AsUUID();
+ poe.Count = ((OSDMap)dataBlock[i])["Count"].AsInteger();
+ poe.IsGroupOwned = ((OSDMap)dataBlock[i])["IsGroupOwned"].AsBoolean();
+ poe.OnlineStatus = ((OSDMap)dataBlock[i])["OnlineStatus"].AsBoolean();
+ if (((OSDMap)dataExtendedBlock[i]).ContainsKey("TimeStamp"))
{
- byte[] bytes = (((LLSDMap)dataExtendedBlock[i])["TimeStamp"].AsBinary());
+ byte[] bytes = (((OSDMap)dataExtendedBlock[i])["TimeStamp"].AsBinary());
if (BitConverter.IsLittleEndian)
Array.Reverse(bytes);
diff --git a/OpenMetaverse/Permissions.cs b/OpenMetaverse/Permissions.cs
index c7053471..79edef72 100644
--- a/OpenMetaverse/Permissions.cs
+++ b/OpenMetaverse/Permissions.cs
@@ -90,21 +90,21 @@ namespace OpenMetaverse
OwnerMask = (PermissionMask)ownerMask;
}
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDMap permissions = new LLSDMap(5);
- permissions["BaseMask"] = LLSD.FromUInteger((uint)BaseMask);
- permissions["EveryoneMask"] = LLSD.FromUInteger((uint)EveryoneMask);
- permissions["GroupMask"] = LLSD.FromUInteger((uint)GroupMask);
- permissions["NextOwnerMask"] = LLSD.FromUInteger((uint)NextOwnerMask);
- permissions["OwnerMask"] = LLSD.FromUInteger((uint)OwnerMask);
+ OSDMap permissions = new OSDMap(5);
+ permissions["BaseMask"] = OSD.FromUInteger((uint)BaseMask);
+ permissions["EveryoneMask"] = OSD.FromUInteger((uint)EveryoneMask);
+ permissions["GroupMask"] = OSD.FromUInteger((uint)GroupMask);
+ permissions["NextOwnerMask"] = OSD.FromUInteger((uint)NextOwnerMask);
+ permissions["OwnerMask"] = OSD.FromUInteger((uint)OwnerMask);
return permissions;
}
- public static Permissions FromLLSD(LLSD llsd)
+ public static Permissions FromOSD(OSD llsd)
{
Permissions permissions = new Permissions();
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)llsd;
byte[] bytes = map["BaseMask"].AsBinary();
permissions.BaseMask = (PermissionMask)Utils.BytesToUInt(bytes);
diff --git a/OpenMetaverse/Primitives/Primitive.cs b/OpenMetaverse/Primitives/Primitive.cs
index c5112ea1..beec6eb1 100644
--- a/OpenMetaverse/Primitives/Primitive.cs
+++ b/OpenMetaverse/Primitives/Primitive.cs
@@ -722,34 +722,34 @@ namespace OpenMetaverse
///
///
///
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDMap map = new LLSDMap();
+ OSDMap map = new OSDMap();
- map["simulate_lod"] = LLSD.FromInteger(Softness);
- map["gravity"] = LLSD.FromReal(Gravity);
- map["air_friction"] = LLSD.FromReal(Drag);
- map["wind_sensitivity"] = LLSD.FromReal(Wind);
- map["tension"] = LLSD.FromReal(Tension);
- map["user_force"] = LLSD.FromVector3(Force);
+ map["simulate_lod"] = OSD.FromInteger(Softness);
+ map["gravity"] = OSD.FromReal(Gravity);
+ map["air_friction"] = OSD.FromReal(Drag);
+ map["wind_sensitivity"] = OSD.FromReal(Wind);
+ map["tension"] = OSD.FromReal(Tension);
+ map["user_force"] = OSD.FromVector3(Force);
return map;
}
- public static FlexibleData FromLLSD(LLSD llsd)
+ public static FlexibleData FromOSD(OSD osd)
{
FlexibleData flex = new FlexibleData();
- if (llsd.Type == LLSDType.Map)
+ if (osd.Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
flex.Softness = map["simulate_lod"].AsInteger();
flex.Gravity = (float)map["gravity"].AsReal();
flex.Drag = (float)map["air_friction"].AsReal();
flex.Wind = (float)map["wind_sensitivity"].AsReal();
flex.Tension = (float)map["tension"].AsReal();
- flex.Force = ((LLSDArray)map["user_force"]).AsVector3();
+ flex.Force = ((OSDArray)map["user_force"]).AsVector3();
}
return flex;
@@ -819,28 +819,28 @@ namespace OpenMetaverse
return data;
}
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDMap map = new LLSDMap();
+ OSDMap map = new OSDMap();
- map["color"] = LLSD.FromColor4(Color);
- map["intensity"] = LLSD.FromReal(Intensity);
- map["radius"] = LLSD.FromReal(Radius);
- map["cutoff"] = LLSD.FromReal(Cutoff);
- map["falloff"] = LLSD.FromReal(Falloff);
+ map["color"] = OSD.FromColor4(Color);
+ map["intensity"] = OSD.FromReal(Intensity);
+ map["radius"] = OSD.FromReal(Radius);
+ map["cutoff"] = OSD.FromReal(Cutoff);
+ map["falloff"] = OSD.FromReal(Falloff);
return map;
}
- public static LightData FromLLSD(LLSD llsd)
+ public static LightData FromOSD(OSD osd)
{
LightData light = new LightData();
- if (llsd.Type == LLSDType.Map)
+ if (osd.Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
- light.Color = ((LLSDArray)map["color"]).AsColor4();
+ light.Color = ((OSDArray)map["color"]).AsColor4();
light.Intensity = (float)map["intensity"].AsReal();
light.Radius = (float)map["radius"].AsReal();
light.Cutoff = (float)map["cutoff"].AsReal();
@@ -893,23 +893,23 @@ namespace OpenMetaverse
return data;
}
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDMap map = new LLSDMap();
+ OSDMap map = new OSDMap();
- map["texture"] = LLSD.FromUUID(SculptTexture);
- map["type"] = LLSD.FromInteger((int)Type);
+ map["texture"] = OSD.FromUUID(SculptTexture);
+ map["type"] = OSD.FromInteger((int)Type);
return map;
}
- public static SculptData FromLLSD(LLSD llsd)
+ public static SculptData FromOSD(OSD osd)
{
SculptData sculpt = new SculptData();
- if (llsd.Type == LLSDType.Map)
+ if (osd.Type == OSDType.Map)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
sculpt.SculptTexture = map["texture"].AsUUID();
sculpt.Type = (SculptType)map["type"].AsInteger();
@@ -1138,73 +1138,73 @@ namespace OpenMetaverse
#region Public Methods
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDMap path = new LLSDMap(14);
- path["begin"] = LLSD.FromReal(PrimData.PathBegin);
- path["curve"] = LLSD.FromInteger((int)PrimData.PathCurve);
- path["end"] = LLSD.FromReal(PrimData.PathEnd);
- path["radius_offset"] = LLSD.FromReal(PrimData.PathRadiusOffset);
- path["revolutions"] = LLSD.FromReal(PrimData.PathRevolutions);
- path["scale_x"] = LLSD.FromReal(PrimData.PathScaleX);
- path["scale_y"] = LLSD.FromReal(PrimData.PathScaleY);
- path["shear_x"] = LLSD.FromReal(PrimData.PathShearX);
- path["shear_y"] = LLSD.FromReal(PrimData.PathShearY);
- path["skew"] = LLSD.FromReal(PrimData.PathSkew);
- path["taper_x"] = LLSD.FromReal(PrimData.PathTaperX);
- path["taper_y"] = LLSD.FromReal(PrimData.PathTaperY);
- path["twist"] = LLSD.FromReal(PrimData.PathTwist);
- path["twist_begin"] = LLSD.FromReal(PrimData.PathTwistBegin);
+ OSDMap path = new OSDMap(14);
+ path["begin"] = OSD.FromReal(PrimData.PathBegin);
+ path["curve"] = OSD.FromInteger((int)PrimData.PathCurve);
+ path["end"] = OSD.FromReal(PrimData.PathEnd);
+ path["radius_offset"] = OSD.FromReal(PrimData.PathRadiusOffset);
+ path["revolutions"] = OSD.FromReal(PrimData.PathRevolutions);
+ path["scale_x"] = OSD.FromReal(PrimData.PathScaleX);
+ path["scale_y"] = OSD.FromReal(PrimData.PathScaleY);
+ path["shear_x"] = OSD.FromReal(PrimData.PathShearX);
+ path["shear_y"] = OSD.FromReal(PrimData.PathShearY);
+ path["skew"] = OSD.FromReal(PrimData.PathSkew);
+ path["taper_x"] = OSD.FromReal(PrimData.PathTaperX);
+ path["taper_y"] = OSD.FromReal(PrimData.PathTaperY);
+ path["twist"] = OSD.FromReal(PrimData.PathTwist);
+ path["twist_begin"] = OSD.FromReal(PrimData.PathTwistBegin);
- LLSDMap profile = new LLSDMap(4);
- profile["begin"] = LLSD.FromReal(PrimData.ProfileBegin);
- profile["curve"] = LLSD.FromInteger((int)PrimData.ProfileCurve);
- profile["hole"] = LLSD.FromInteger((int)PrimData.ProfileHole);
- profile["end"] = LLSD.FromReal(PrimData.ProfileEnd);
- profile["hollow"] = LLSD.FromReal(PrimData.ProfileHollow);
+ OSDMap profile = new OSDMap(4);
+ profile["begin"] = OSD.FromReal(PrimData.ProfileBegin);
+ profile["curve"] = OSD.FromInteger((int)PrimData.ProfileCurve);
+ profile["hole"] = OSD.FromInteger((int)PrimData.ProfileHole);
+ profile["end"] = OSD.FromReal(PrimData.ProfileEnd);
+ profile["hollow"] = OSD.FromReal(PrimData.ProfileHollow);
- LLSDMap volume = new LLSDMap(2);
+ OSDMap volume = new OSDMap(2);
volume["path"] = path;
volume["profile"] = profile;
- LLSDMap prim = new LLSDMap(9);
- prim["name"] = LLSD.FromString(Properties.Name);
- prim["description"] = LLSD.FromString(Properties.Description);
- prim["phantom"] = LLSD.FromBoolean(((Flags & PrimFlags.Phantom) != 0));
- prim["physical"] = LLSD.FromBoolean(((Flags & PrimFlags.Physics) != 0));
- prim["position"] = LLSD.FromVector3(Position);
- prim["rotation"] = LLSD.FromQuaternion(Rotation);
- prim["scale"] = LLSD.FromVector3(Scale);
- prim["material"] = LLSD.FromInteger((int)PrimData.Material);
- prim["shadows"] = LLSD.FromBoolean(((Flags & PrimFlags.CastShadows) != 0));
- prim["textures"] = Textures.GetLLSD();
+ OSDMap prim = new OSDMap(9);
+ prim["name"] = OSD.FromString(Properties.Name);
+ prim["description"] = OSD.FromString(Properties.Description);
+ prim["phantom"] = OSD.FromBoolean(((Flags & PrimFlags.Phantom) != 0));
+ prim["physical"] = OSD.FromBoolean(((Flags & PrimFlags.Physics) != 0));
+ prim["position"] = OSD.FromVector3(Position);
+ prim["rotation"] = OSD.FromQuaternion(Rotation);
+ prim["scale"] = OSD.FromVector3(Scale);
+ prim["material"] = OSD.FromInteger((int)PrimData.Material);
+ prim["shadows"] = OSD.FromBoolean(((Flags & PrimFlags.CastShadows) != 0));
+ prim["textures"] = Textures.GetOSD();
prim["volume"] = volume;
if (ParentID != 0)
- prim["parentid"] = LLSD.FromInteger(ParentID);
+ prim["parentid"] = OSD.FromInteger(ParentID);
- prim["light"] = Light.GetLLSD();
- prim["flex"] = Flexible.GetLLSD();
- prim["sculpt"] = Sculpt.GetLLSD();
+ prim["light"] = Light.GetOSD();
+ prim["flex"] = Flexible.GetOSD();
+ prim["sculpt"] = Sculpt.GetOSD();
return prim;
}
- public static Primitive FromLLSD(LLSD llsd)
+ public static Primitive FromOSD(OSD osd)
{
Primitive prim = new Primitive();
Primitive.ConstructionData data;
- LLSDMap map = (LLSDMap)llsd;
- LLSDMap volume = (LLSDMap)map["volume"];
- LLSDMap path = (LLSDMap)volume["path"];
- LLSDMap profile = (LLSDMap)volume["profile"];
+ OSDMap map = (OSDMap)osd;
+ OSDMap volume = (OSDMap)map["volume"];
+ OSDMap path = (OSDMap)volume["path"];
+ OSDMap profile = (OSDMap)volume["profile"];
#region Path/Profile
data.profileCurve = (byte)0;
data.State = 0;
data.Material = (Material)map["material"].AsInteger();
- data.PCode = PCode.Prim; // TODO: Put this in LLSD
+ data.PCode = PCode.Prim; // TODO: Put this in SD
data.PathBegin = (float)path["begin"].AsReal();
data.PathCurve = (PathCurve)path["curve"].AsInteger();
@@ -1241,13 +1241,13 @@ namespace OpenMetaverse
prim.Flags |= PrimFlags.CastShadows;
prim.ParentID = (uint)map["parentid"].AsInteger();
- prim.Position = ((LLSDArray)map["position"]).AsVector3();
- prim.Rotation = ((LLSDArray)map["rotation"]).AsQuaternion();
- prim.Scale = ((LLSDArray)map["scale"]).AsVector3();
- prim.Flexible = FlexibleData.FromLLSD(map["flex"]);
- prim.Light = LightData.FromLLSD(map["light"]);
- prim.Sculpt = SculptData.FromLLSD(map["sculpt"]);
- prim.Textures = TextureEntry.FromLLSD(map["textures"]);
+ prim.Position = ((OSDArray)map["position"]).AsVector3();
+ prim.Rotation = ((OSDArray)map["rotation"]).AsQuaternion();
+ prim.Scale = ((OSDArray)map["scale"]).AsVector3();
+ prim.Flexible = FlexibleData.FromOSD(map["flex"]);
+ prim.Light = LightData.FromOSD(map["light"]);
+ prim.Sculpt = SculptData.FromOSD(map["sculpt"]);
+ prim.Textures = TextureEntry.FromOSD(map["textures"]);
if (!string.IsNullOrEmpty(map["name"].AsString()))
{
prim.Properties.Name = map["name"].AsString();
diff --git a/OpenMetaverse/Primitives/TextureEntry.cs b/OpenMetaverse/Primitives/TextureEntry.cs
index da462646..08cf4f28 100644
--- a/OpenMetaverse/Primitives/TextureEntry.cs
+++ b/OpenMetaverse/Primitives/TextureEntry.cs
@@ -462,39 +462,39 @@ namespace OpenMetaverse
hasAttribute = TextureAttributes.None;
}
- public LLSD GetLLSD(int faceNumber)
+ public OSD GetOSD(int faceNumber)
{
- LLSDMap tex = new LLSDMap(10);
- if (faceNumber >= 0) tex["face_number"] = LLSD.FromInteger(faceNumber);
- tex["colors"] = LLSD.FromColor4(RGBA);
- tex["scales"] = LLSD.FromReal(RepeatU);
- tex["scalet"] = LLSD.FromReal(RepeatV);
- tex["offsets"] = LLSD.FromReal(OffsetU);
- tex["offsett"] = LLSD.FromReal(OffsetV);
- tex["imagerot"] = LLSD.FromReal(Rotation);
- tex["bump"] = LLSD.FromInteger((int)Bump);
- tex["shiny"] = LLSD.FromInteger((int)Shiny);
- tex["fullbright"] = LLSD.FromBoolean(Fullbright);
- tex["media_flags"] = LLSD.FromInteger(Convert.ToInt32(MediaFlags));
- tex["mapping"] = LLSD.FromInteger((int)TexMapType);
- tex["glow"] = LLSD.FromReal(Glow);
+ OSDMap tex = new OSDMap(10);
+ if (faceNumber >= 0) tex["face_number"] = OSD.FromInteger(faceNumber);
+ tex["colors"] = OSD.FromColor4(RGBA);
+ tex["scales"] = OSD.FromReal(RepeatU);
+ tex["scalet"] = OSD.FromReal(RepeatV);
+ tex["offsets"] = OSD.FromReal(OffsetU);
+ tex["offsett"] = OSD.FromReal(OffsetV);
+ tex["imagerot"] = OSD.FromReal(Rotation);
+ tex["bump"] = OSD.FromInteger((int)Bump);
+ tex["shiny"] = OSD.FromInteger((int)Shiny);
+ tex["fullbright"] = OSD.FromBoolean(Fullbright);
+ tex["media_flags"] = OSD.FromInteger(Convert.ToInt32(MediaFlags));
+ tex["mapping"] = OSD.FromInteger((int)TexMapType);
+ tex["glow"] = OSD.FromReal(Glow);
if (TextureID != Primitive.TextureEntry.WHITE_TEXTURE)
- tex["imageid"] = LLSD.FromUUID(TextureID);
+ tex["imageid"] = OSD.FromUUID(TextureID);
else
- tex["imageid"] = LLSD.FromUUID(UUID.Zero);
+ tex["imageid"] = OSD.FromUUID(UUID.Zero);
return tex;
}
- public static TextureEntryFace FromLLSD(LLSD llsd, TextureEntryFace defaultFace, out int faceNumber)
+ public static TextureEntryFace FromOSD(OSD osd, TextureEntryFace defaultFace, out int faceNumber)
{
- LLSDMap map = (LLSDMap)llsd;
+ OSDMap map = (OSDMap)osd;
TextureEntryFace face = new TextureEntryFace(defaultFace);
faceNumber = (map.ContainsKey("face_number")) ? map["face_number"].AsInteger() : -1;
Color4 rgba = face.RGBA;
- rgba = ((LLSDArray)map["colors"]).AsColor4();
+ rgba = ((OSDArray)map["colors"]).AsColor4();
face.RGBA = rgba;
face.RepeatU = (float)map["scales"].AsReal();
face.RepeatV = (float)map["scalet"].AsReal();
@@ -627,37 +627,37 @@ namespace OpenMetaverse
///
///
///
- public LLSD GetLLSD()
+ public OSD GetOSD()
{
- LLSDArray array = new LLSDArray();
+ OSDArray array = new OSDArray();
// Always add default texture
- array.Add(DefaultTexture.GetLLSD(-1));
+ array.Add(DefaultTexture.GetOSD(-1));
for (int i = 0; i < MAX_FACES; i++)
{
if (FaceTextures[i] != null)
- array.Add(FaceTextures[i].GetLLSD(i));
+ array.Add(FaceTextures[i].GetOSD(i));
}
return array;
}
- public static TextureEntry FromLLSD(LLSD llsd)
+ public static TextureEntry FromOSD(OSD osd)
{
- LLSDArray array = (LLSDArray)llsd;
- LLSDMap faceLLSD;
+ OSDArray array = (OSDArray)osd;
+ OSDMap faceSD;
if (array.Count > 0)
{
int faceNumber;
- faceLLSD = (LLSDMap)array[0];
- TextureEntryFace defaultFace = TextureEntryFace.FromLLSD(faceLLSD, null, out faceNumber);
+ faceSD = (OSDMap)array[0];
+ TextureEntryFace defaultFace = TextureEntryFace.FromOSD(faceSD, null, out faceNumber);
TextureEntry te = new TextureEntry(defaultFace);
for (int i = 1; i < array.Count; i++)
{
- TextureEntryFace tex = TextureEntryFace.FromLLSD(array[i], defaultFace, out faceNumber);
+ TextureEntryFace tex = TextureEntryFace.FromOSD(array[i], defaultFace, out faceNumber);
if (faceNumber >= 0 && faceNumber < te.FaceTextures.Length)
te.FaceTextures[faceNumber] = tex;
}
@@ -666,7 +666,7 @@ namespace OpenMetaverse
}
else
{
- throw new ArgumentException("LLSD contains no elements");
+ throw new ArgumentException("SD contains no elements");
}
}
diff --git a/OpenMetaverse/StructuredData/BinaryLLSD.cs b/OpenMetaverse/StructuredData/BinaryLLSD.cs
new file mode 100644
index 00000000..a0fb80f3
--- /dev/null
+++ b/OpenMetaverse/StructuredData/BinaryLLSD.cs
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) 2007-2008, openmetaverse.org
+ * All rights reserved.
+ *
+ * - Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * - Neither the name of the openmetaverse.org nor the names
+ * of its contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ *
+ * This implementation is based upon the description at
+ *
+ * http://wiki.secondlife.com/wiki/LLSD
+ *
+ * and (partially) tested against the (supposed) reference implementation at
+ *
+ * http://svn.secondlife.com/svn/linden/release/indra/lib/python/indra/base/osd.py
+ *
+ */
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenMetaverse.StructuredData
+{
+ ///
+ ///
+ ///
+ public static partial class LLSDParser
+ {
+ private const int initialBufferSize = 128;
+ private const int int32Length = 4;
+ private const int doubleLength = 8;
+
+ private static byte[] binaryHead = Encoding.ASCII.GetBytes("\n");
+ private const byte undefBinaryValue = (byte)'!';
+ private const byte trueBinaryValue = (byte)'1';
+ private const byte falseBinaryValue = (byte)'0';
+ private const byte integerBinaryMarker = (byte)'i';
+ private const byte realBinaryMarker = (byte)'r';
+ private const byte uuidBinaryMarker = (byte)'u';
+ private const byte binaryBinaryMarker = (byte)'b';
+ private const byte stringBinaryMarker = (byte)'s';
+ private const byte uriBinaryMarker = (byte)'l';
+ private const byte dateBinaryMarker = (byte)'d';
+ private const byte arrayBeginBinaryMarker = (byte)'[';
+ private const byte arrayEndBinaryMarker = (byte)']';
+ private const byte mapBeginBinaryMarker = (byte)'{';
+ private const byte mapEndBinaryMarker = (byte)'}';
+ private const byte keyBinaryMarker = (byte)'k';
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static OSD DeserializeLLSDBinary(byte[] binaryData)
+ {
+
+ MemoryStream stream = new MemoryStream(binaryData);
+ OSD osd = DeserializeLLSDBinary(stream);
+ stream.Close();
+ return osd;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static OSD DeserializeLLSDBinary(MemoryStream stream)
+ {
+ SkipWhiteSpace(stream);
+
+ bool result = FindByteArray(stream, binaryHead);
+ if (!result)
+ throw new OSDException("No binary encoded SD.");
+
+ return ParseLLSDBinaryElement(stream);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static byte[] SerializeLLSDBinary(OSD osd)
+ {
+ MemoryStream stream = SerializeLLSDBinaryStream(osd);
+ byte[] binaryData = stream.ToArray();
+ stream.Close();
+
+ return binaryData;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static MemoryStream SerializeLLSDBinaryStream(OSD data)
+ {
+ MemoryStream stream = new MemoryStream(initialBufferSize);
+
+ stream.Write(binaryHead, 0, binaryHead.Length);
+ SerializeLLSDBinaryElement(stream, data);
+ return stream;
+ }
+
+ private static void SerializeLLSDBinaryElement(MemoryStream stream, OSD osd)
+ {
+ switch (osd.Type)
+ {
+ case OSDType.Unknown:
+ stream.WriteByte(undefBinaryValue);
+ break;
+ case OSDType.Boolean:
+ stream.Write(osd.AsBinary(), 0, 1);
+ break;
+ case OSDType.Integer:
+ stream.WriteByte(integerBinaryMarker);
+ stream.Write(osd.AsBinary(), 0, int32Length);
+ break;
+ case OSDType.Real:
+ stream.WriteByte(realBinaryMarker);
+ stream.Write(osd.AsBinary(), 0, doubleLength);
+ break;
+ case OSDType.UUID:
+ stream.WriteByte(uuidBinaryMarker);
+ stream.Write(osd.AsBinary(), 0, 16);
+ break;
+ case OSDType.String:
+ stream.WriteByte(stringBinaryMarker);
+ byte[] rawString = osd.AsBinary();
+ byte[] stringLengthNetEnd = HostToNetworkIntBytes(rawString.Length);
+ stream.Write(stringLengthNetEnd, 0, int32Length);
+ stream.Write(rawString, 0, rawString.Length);
+ break;
+ case OSDType.Binary:
+ stream.WriteByte(binaryBinaryMarker);
+ byte[] rawBinary = osd.AsBinary();
+ byte[] binaryLengthNetEnd = HostToNetworkIntBytes(rawBinary.Length);
+ stream.Write(binaryLengthNetEnd, 0, int32Length);
+ stream.Write(rawBinary, 0, rawBinary.Length);
+ break;
+ case OSDType.Date:
+ stream.WriteByte(dateBinaryMarker);
+ stream.Write(osd.AsBinary(), 0, doubleLength);
+ break;
+ case OSDType.URI:
+ stream.WriteByte(uriBinaryMarker);
+ byte[] rawURI = osd.AsBinary();
+ byte[] uriLengthNetEnd = HostToNetworkIntBytes(rawURI.Length);
+ stream.Write(uriLengthNetEnd, 0, int32Length);
+ stream.Write(rawURI, 0, rawURI.Length);
+ break;
+ case OSDType.Array:
+ SerializeLLSDBinaryArray(stream, (OSDArray)osd);
+ break;
+ case OSDType.Map:
+ SerializeLLSDBinaryMap(stream, (OSDMap)osd);
+ break;
+ default:
+ throw new OSDException("Binary serialization: Not existing element discovered.");
+
+ }
+ }
+
+ private static void SerializeLLSDBinaryArray(MemoryStream stream, OSDArray osdArray)
+ {
+ stream.WriteByte(arrayBeginBinaryMarker);
+ byte[] binaryNumElementsHostEnd = HostToNetworkIntBytes(osdArray.Count);
+ stream.Write(binaryNumElementsHostEnd, 0, int32Length);
+
+ foreach (OSD osd in osdArray)
+ {
+ SerializeLLSDBinaryElement(stream, osd);
+ }
+ stream.WriteByte(arrayEndBinaryMarker);
+ }
+
+ private static void SerializeLLSDBinaryMap(MemoryStream stream, OSDMap osdMap)
+ {
+ stream.WriteByte(mapBeginBinaryMarker);
+ byte[] binaryNumElementsNetEnd = HostToNetworkIntBytes(osdMap.Count);
+ stream.Write(binaryNumElementsNetEnd, 0, int32Length);
+
+ foreach (KeyValuePair kvp in osdMap)
+ {
+ stream.WriteByte(keyBinaryMarker);
+ byte[] binaryKey = Encoding.UTF8.GetBytes(kvp.Key);
+ byte[] binaryKeyLength = HostToNetworkIntBytes(binaryKey.Length);
+ stream.Write(binaryKeyLength, 0, int32Length);
+ stream.Write(binaryKey, 0, binaryKey.Length);
+ SerializeLLSDBinaryElement(stream, kvp.Value);
+ }
+ stream.WriteByte(mapEndBinaryMarker);
+ }
+
+ private static OSD ParseLLSDBinaryElement(MemoryStream stream)
+ {
+ SkipWhiteSpace(stream);
+ OSD osd;
+
+ int marker = stream.ReadByte();
+ if (marker < 0)
+ throw new OSDException("Binary LLSD parsing: Unexpected end of stream.");
+
+ switch ((byte)marker)
+ {
+ case undefBinaryValue:
+ osd = new OSD();
+ break;
+ case trueBinaryValue:
+ osd = OSD.FromBoolean(true);
+ break;
+ case falseBinaryValue:
+ osd = OSD.FromBoolean(false);
+ break;
+ case integerBinaryMarker:
+ int integer = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ osd = OSD.FromInteger(integer);
+ break;
+ case realBinaryMarker:
+ double dbl = NetworkToHostDouble(ConsumeBytes(stream, doubleLength));
+ osd = OSD.FromReal(dbl);
+ break;
+ case uuidBinaryMarker:
+ osd = OSD.FromUUID(new UUID(ConsumeBytes(stream, 16), 0));
+ break;
+ case binaryBinaryMarker:
+ int binaryLength = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ osd = OSD.FromBinary(ConsumeBytes(stream, binaryLength));
+ break;
+ case stringBinaryMarker:
+ int stringLength = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ string ss = Encoding.UTF8.GetString(ConsumeBytes(stream, stringLength));
+ osd = OSD.FromString(ss);
+ break;
+ case uriBinaryMarker:
+ int uriLength = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ string sUri = Encoding.UTF8.GetString(ConsumeBytes(stream, uriLength));
+ Uri uri;
+ try
+ {
+ uri = new Uri(sUri, UriKind.RelativeOrAbsolute);
+ }
+ catch
+ {
+ throw new OSDException("Binary LLSD parsing: Invalid Uri format detected.");
+ }
+ osd = OSD.FromUri(uri);
+ break;
+ case dateBinaryMarker:
+ double timestamp = NetworkToHostDouble(ConsumeBytes(stream, doubleLength));
+ DateTime dateTime = DateTime.SpecifyKind(Utils.Epoch, DateTimeKind.Utc);
+ dateTime = dateTime.AddSeconds(timestamp);
+ osd = OSD.FromDate(dateTime.ToLocalTime());
+ break;
+ case arrayBeginBinaryMarker:
+ osd = ParseLLSDBinaryArray(stream);
+ break;
+ case mapBeginBinaryMarker:
+ osd = ParseLLSDBinaryMap(stream);
+ break;
+ default:
+ throw new OSDException("Binary LLSD parsing: Unknown type marker.");
+
+ }
+ return osd;
+ }
+
+ private static OSD ParseLLSDBinaryArray(MemoryStream stream)
+ {
+ int numElements = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ int crrElement = 0;
+ OSDArray osdArray = new OSDArray();
+ while (crrElement < numElements)
+ {
+ osdArray.Add(ParseLLSDBinaryElement(stream));
+ crrElement++;
+ }
+
+ if (!FindByte(stream, arrayEndBinaryMarker))
+ throw new OSDException("Binary LLSD parsing: Missing end marker in array.");
+
+ return (OSD)osdArray;
+ }
+
+ private static OSD ParseLLSDBinaryMap(MemoryStream stream)
+ {
+ int numElements = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ int crrElement = 0;
+ OSDMap osdMap = new OSDMap();
+ while (crrElement < numElements)
+ {
+ if (!FindByte(stream, keyBinaryMarker))
+ throw new OSDException("Binary LLSD parsing: Missing key marker in map.");
+ int keyLength = NetworkToHostInt(ConsumeBytes(stream, int32Length));
+ string key = Encoding.UTF8.GetString(ConsumeBytes(stream, keyLength));
+ osdMap[key] = ParseLLSDBinaryElement(stream);
+ crrElement++;
+ }
+
+ if (!FindByte(stream, mapEndBinaryMarker))
+ throw new OSDException("Binary LLSD parsing: Missing end marker in map.");
+
+ return (OSD)osdMap;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public static void SkipWhiteSpace(MemoryStream stream)
+ {
+ int bt;
+
+ while (((bt = stream.ReadByte()) > 0) &&
+ ((byte)bt == ' ' || (byte)bt == '\t' ||
+ (byte)bt == '\n' || (byte)bt == '\r')
+ )
+ {
+ }
+ stream.Seek(-1, SeekOrigin.Current);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool FindByte(MemoryStream stream, byte toFind)
+ {
+ int bt = stream.ReadByte();
+ if (bt < 0)
+ return false;
+ if ((byte)bt == toFind)
+ return true;
+ else
+ {
+ stream.Seek(-1L, SeekOrigin.Current);
+ return false;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool FindByteArray(MemoryStream stream, byte[] toFind)
+ {
+ int lastIndexToFind = toFind.Length - 1;
+ int crrIndex = 0;
+ bool found = true;
+ int bt;
+ long lastPosition = stream.Position;
+
+ while (found &&
+ ((bt = stream.ReadByte()) > 0) &&
+ (crrIndex <= lastIndexToFind)
+ )
+ {
+ if (toFind[crrIndex] == (byte)bt)
+ {
+ found = true;
+ crrIndex++;
+ }
+ else
+ found = false;
+ }
+
+ if (found && crrIndex > lastIndexToFind)
+ {
+ stream.Seek(-1L, SeekOrigin.Current);
+ return true;
+ }
+ else
+ {
+ stream.Position = lastPosition;
+ return false;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static byte[] ConsumeBytes(MemoryStream stream, int consumeBytes)
+ {
+ byte[] bytes = new byte[consumeBytes];
+ if (stream.Read(bytes, 0, consumeBytes) < consumeBytes)
+ throw new OSDException("Binary LLSD parsing: Unexpected end of stream.");
+ return bytes;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static int NetworkToHostInt(byte[] binaryNetEnd)
+ {
+ if (binaryNetEnd == null)
+ return -1;
+
+ int intNetEnd = BitConverter.ToInt32(binaryNetEnd, 0);
+ int intHostEnd = System.Net.IPAddress.NetworkToHostOrder(intNetEnd);
+ return intHostEnd;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static double NetworkToHostDouble(byte[] binaryNetEnd)
+ {
+ if (binaryNetEnd == null)
+ return -1d;
+ long longNetEnd = BitConverter.ToInt64(binaryNetEnd, 0);
+ long longHostEnd = System.Net.IPAddress.NetworkToHostOrder(longNetEnd);
+ byte[] binaryHostEnd = BitConverter.GetBytes(longHostEnd);
+ double doubleHostEnd = BitConverter.ToDouble(binaryHostEnd, 0);
+ return doubleHostEnd;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static byte[] HostToNetworkIntBytes(int intHostEnd)
+ {
+ int intNetEnd = System.Net.IPAddress.HostToNetworkOrder(intHostEnd);
+ byte[] bytesNetEnd = BitConverter.GetBytes(intNetEnd);
+ return bytesNetEnd;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenMetaverse/LLSD/NotationLLSD.cs b/OpenMetaverse/StructuredData/NotationLLSD.cs
similarity index 65%
rename from OpenMetaverse/LLSD/NotationLLSD.cs
rename to OpenMetaverse/StructuredData/NotationLLSD.cs
index c567f214..0d6a70b1 100644
--- a/OpenMetaverse/LLSD/NotationLLSD.cs
+++ b/OpenMetaverse/StructuredData/NotationLLSD.cs
@@ -73,82 +73,52 @@ namespace OpenMetaverse.StructuredData
private const char doubleQuotesNotationMarker = '"';
private const char singleQuotesNotationMarker = '\'';
- ///
- ///
- ///
- ///
- ///
- public static LLSD DeserializeNotation(string notationData)
+ public static OSD DeserializeLLSDNotation(string notationData)
{
StringReader reader = new StringReader(notationData);
- LLSD llsd = DeserializeNotation(reader);
+ OSD osd = DeserializeLLSDNotation(reader);
reader.Close();
- return llsd;
+ return osd;
}
- ///
- ///
- ///
- ///
- ///
- public static LLSD DeserializeNotation(StringReader reader)
+ public static OSD DeserializeLLSDNotation(StringReader reader)
{
- LLSD llsd = DeserializeNotationElement(reader);
- return llsd;
+ OSD osd = DeserializeLLSDNotationElement(reader);
+ return osd;
}
- ///
- ///
- ///
- ///
- ///
- public static string SerializeNotation(LLSD llsd)
+ public static string SerializeLLSDNotation(OSD osd)
{
- StringWriter writer = SerializeNotationStream(llsd);
+ StringWriter writer = SerializeLLSDNotationStream(osd);
string s = writer.ToString();
writer.Close();
return s;
}
- ///
- ///
- ///
- ///
- ///
- public static StringWriter SerializeNotationStream(LLSD llsd)
+ public static StringWriter SerializeLLSDNotationStream(OSD osd)
{
StringWriter writer = new StringWriter();
- SerializeNotationElement(writer, llsd);
+ SerializeLLSDNotationElement(writer, osd);
return writer;
}
- ///
- ///
- ///
- ///
- ///
- public static string SerializeNotationFormatted(LLSD llsd)
+ public static string SerializeLLSDNotationFormatted(OSD osd)
{
- StringWriter writer = SerializeNotationStreamFormatted(llsd);
+ StringWriter writer = SerializeLLSDNotationStreamFormatted(osd);
string s = writer.ToString();
writer.Close();
return s;
}
- ///
- ///
- ///
- ///
- ///
- public static StringWriter SerializeNotationStreamFormatted(LLSD llsd)
+ public static StringWriter SerializeLLSDNotationStreamFormatted(OSD osd)
{
StringWriter writer = new StringWriter();
string indent = String.Empty;
- SerializeNotationElementFormatted(writer, indent, llsd);
+ SerializeLLSDNotationElementFormatted(writer, indent, osd);
return writer;
}
@@ -157,117 +127,117 @@ namespace OpenMetaverse.StructuredData
///
///
///
- private static LLSD DeserializeNotationElement(StringReader reader)
+ private static OSD DeserializeLLSDNotationElement(StringReader reader)
{
int character = ReadAndSkipWhitespace(reader);
if (character < 0)
- return new LLSD(); // server returned an empty file, so we're going to pass along a null LLSD object
+ return new OSD(); // server returned an empty file, so we're going to pass along a null LLSD object
- LLSD llsd;
+ OSD osd;
int matching;
switch ((char)character)
{
case undefNotationValue:
- llsd = new LLSD();
+ osd = new OSD();
break;
case trueNotationValueOne:
- llsd = LLSD.FromBoolean(true);
+ osd = OSD.FromBoolean(true);
break;
case trueNotationValueTwo:
matching = BufferCharactersEqual(reader, trueNotationValueTwoFull, 1);
if (matching > 1 && matching < trueNotationValueTwoFull.Length)
- throw new LLSDException("Notation LLSD parsing: True value parsing error:");
- llsd = LLSD.FromBoolean(true);
+ throw new OSDException("Notation LLSD parsing: True value parsing error:");
+ osd = OSD.FromBoolean(true);
break;
case trueNotationValueThree:
matching = BufferCharactersEqual(reader, trueNotationValueThreeFull, 1);
if (matching > 1 && matching < trueNotationValueThreeFull.Length)
- throw new LLSDException("Notation LLSD parsing: True value parsing error:");
- llsd = LLSD.FromBoolean(true);
+ throw new OSDException("Notation LLSD parsing: True value parsing error:");
+ osd = OSD.FromBoolean(true);
break;
case falseNotationValueOne:
- llsd = LLSD.FromBoolean(false);
+ osd = OSD.FromBoolean(false);
break;
case falseNotationValueTwo:
matching = BufferCharactersEqual(reader, falseNotationValueTwoFull, 1);
if (matching > 1 && matching < falseNotationValueTwoFull.Length)
- throw new LLSDException("Notation LLSD parsing: True value parsing error:");
- llsd = LLSD.FromBoolean(false);
+ throw new OSDException("Notation LLSD parsing: True value parsing error:");
+ osd = OSD.FromBoolean(false);
break;
case falseNotationValueThree:
matching = BufferCharactersEqual(reader, falseNotationValueThreeFull, 1);
if (matching > 1 && matching < falseNotationValueThreeFull.Length)
- throw new LLSDException("Notation LLSD parsing: True value parsing error:");
- llsd = LLSD.FromBoolean(false);
+ throw new OSDException("Notation LLSD parsing: True value parsing error:");
+ osd = OSD.FromBoolean(false);
break;
case integerNotationMarker:
- llsd = DeserializeNotationInteger(reader);
+ osd = DeserializeLLSDNotationInteger(reader);
break;
case realNotationMarker:
- llsd = DeserializeNotationReal(reader);
+ osd = DeserializeLLSDNotationReal(reader);
break;
case uuidNotationMarker:
char[] uuidBuf = new char[36];
if (reader.Read(uuidBuf, 0, 36) < 36)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in UUID.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in UUID.");
UUID lluuid;
if (!UUID.TryParse(new String(uuidBuf), out lluuid))
- throw new LLSDException("Notation LLSD parsing: Invalid UUID discovered.");
- llsd = LLSD.FromUUID(lluuid);
+ throw new OSDException("Notation LLSD parsing: Invalid UUID discovered.");
+ osd = OSD.FromUUID(lluuid);
break;
case binaryNotationMarker:
byte[] bytes = new byte[0];
int bChar = reader.Peek();
if (bChar < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
if ((char)bChar == sizeBeginNotationMarker)
{
- throw new LLSDException("Notation LLSD parsing: Raw binary encoding not supported.");
+ throw new OSDException("Notation LLSD parsing: Raw binary encoding not supported.");
}
else if (Char.IsDigit((char)bChar))
{
char[] charsBaseEncoding = new char[2];
if (reader.Read(charsBaseEncoding, 0, 2) < 2)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
int baseEncoding;
if (!Int32.TryParse(new String(charsBaseEncoding), out baseEncoding))
- throw new LLSDException("Notation LLSD parsing: Invalid binary encoding base.");
+ throw new OSDException("Notation LLSD parsing: Invalid binary encoding base.");
if (baseEncoding == 64)
{
if (reader.Read() < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in binary.");
string bytes64 = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
bytes = Convert.FromBase64String(bytes64);
}
else
{
- throw new LLSDException("Notation LLSD parsing: Encoding base" + baseEncoding + " + not supported.");
+ throw new OSDException("Notation LLSD parsing: Encoding base" + baseEncoding + " + not supported.");
}
}
- llsd = LLSD.FromBinary(bytes);
+ osd = OSD.FromBinary(bytes);
break;
case stringNotationMarker:
int numChars = GetLengthInBrackets(reader);
if (reader.Read() < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in string.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in string.");
char[] chars = new char[numChars];
if (reader.Read(chars, 0, numChars) < numChars)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in string.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in string.");
if (reader.Read() < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in string.");
- llsd = LLSD.FromString(new String(chars));
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in string.");
+ osd = OSD.FromString(new String(chars));
break;
case singleQuotesNotationMarker:
string sOne = GetStringDelimitedBy(reader, singleQuotesNotationMarker);
- llsd = LLSD.FromString(sOne);
+ osd = OSD.FromString(sOne);
break;
case doubleQuotesNotationMarker:
string sTwo = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
- llsd = LLSD.FromString(sTwo);
+ osd = OSD.FromString(sTwo);
break;
case uriNotationMarker:
if (reader.Read() < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in string.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in string.");
string sUri = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
Uri uri;
@@ -277,32 +247,32 @@ namespace OpenMetaverse.StructuredData
}
catch
{
- throw new LLSDException("Notation LLSD parsing: Invalid Uri format detected.");
+ throw new OSDException("Notation LLSD parsing: Invalid Uri format detected.");
}
- llsd = LLSD.FromUri(uri);
+ osd = OSD.FromUri(uri);
break;
case dateNotationMarker:
if (reader.Read() < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in date.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in date.");
string date = GetStringDelimitedBy(reader, doubleQuotesNotationMarker);
DateTime dt;
if (!DateTime.TryParse(date, out dt))
- throw new LLSDException("Notation LLSD parsing: Invalid date discovered.");
- llsd = LLSD.FromDate(dt);
+ throw new OSDException("Notation LLSD parsing: Invalid date discovered.");
+ osd = OSD.FromDate(dt);
break;
case arrayBeginNotationMarker:
- llsd = DeserializeNotationArray(reader);
+ osd = DeserializeLLSDNotationArray(reader);
break;
case mapBeginNotationMarker:
- llsd = DeserializeNotationMap(reader);
+ osd = DeserializeLLSDNotationMap(reader);
break;
default:
- throw new LLSDException("Notation LLSD parsing: Unknown type marker '" + (char)character + "'.");
+ throw new OSDException("Notation LLSD parsing: Unknown type marker '" + (char)character + "'.");
}
- return llsd;
+ return osd;
}
- private static LLSD DeserializeNotationInteger(StringReader reader)
+ private static OSD DeserializeLLSDNotationInteger(StringReader reader)
{
int character;
StringBuilder s = new StringBuilder();
@@ -320,12 +290,12 @@ namespace OpenMetaverse.StructuredData
}
int integer;
if (!Int32.TryParse(s.ToString(), out integer))
- throw new LLSDException("Notation LLSD parsing: Can't parse integer value." + s.ToString());
+ throw new OSDException("Notation LLSD parsing: Can't parse integer value." + s.ToString());
- return LLSD.FromInteger(integer);
+ return OSD.FromInteger(integer);
}
- private static LLSD DeserializeNotationReal(StringReader reader)
+ private static OSD DeserializeLLSDNotationReal(StringReader reader)
{
int character;
StringBuilder s = new StringBuilder();
@@ -345,156 +315,156 @@ namespace OpenMetaverse.StructuredData
}
double dbl;
if (!Utils.TryParseDouble(s.ToString(), out dbl))
- throw new LLSDException("Notation LLSD parsing: Can't parse real value: " + s.ToString());
+ throw new OSDException("Notation LLSD parsing: Can't parse real value: " + s.ToString());
- return LLSD.FromReal(dbl);
+ return OSD.FromReal(dbl);
}
- private static LLSD DeserializeNotationArray(StringReader reader)
+ private static OSD DeserializeLLSDNotationArray(StringReader reader)
{
int character;
- LLSDArray llsdArray = new LLSDArray();
+ OSDArray osdArray = new OSDArray();
while (((character = PeekAndSkipWhitespace(reader)) > 0) &&
((char)character != arrayEndNotationMarker))
{
- llsdArray.Add(DeserializeNotationElement(reader));
+ osdArray.Add(DeserializeLLSDNotationElement(reader));
character = ReadAndSkipWhitespace(reader);
if (character < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of array discovered.");
+ throw new OSDException("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.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of array discovered.");
- return (LLSD)llsdArray;
+ return (OSD)osdArray;
}
- private static LLSD DeserializeNotationMap(StringReader reader)
+ private static OSD DeserializeLLSDNotationMap(StringReader reader)
{
int character;
- LLSDMap llsdMap = new LLSDMap();
+ OSDMap osdMap = new OSDMap();
while (((character = PeekAndSkipWhitespace(reader)) > 0) &&
((char)character != mapEndNotationMarker))
{
- LLSD llsdKey = DeserializeNotationElement(reader);
- if (llsdKey.Type != LLSDType.String)
- throw new LLSDException("Notation LLSD parsing: Invalid key in map");
- string key = llsdKey.AsString();
+ OSD osdKey = DeserializeLLSDNotationElement(reader);
+ if (osdKey.Type != OSDType.String)
+ throw new OSDException("Notation LLSD parsing: Invalid key in map");
+ string key = osdKey.AsString();
character = ReadAndSkipWhitespace(reader);
if ((char)character != keyNotationDelimiter)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of stream in map.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of stream in map.");
if ((char)character != keyNotationDelimiter)
- throw new LLSDException("Notation LLSD parsing: Invalid delimiter in map.");
+ throw new OSDException("Notation LLSD parsing: Invalid delimiter in map.");
- llsdMap[key] = DeserializeNotationElement(reader);
+ osdMap[key] = DeserializeLLSDNotationElement(reader);
character = ReadAndSkipWhitespace(reader);
if (character < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of map discovered.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of map discovered.");
else if ((char)character == kommaNotationDelimiter)
continue;
else if ((char)character == mapEndNotationMarker)
break;
}
if (character < 0)
- throw new LLSDException("Notation LLSD parsing: Unexpected end of map discovered.");
+ throw new OSDException("Notation LLSD parsing: Unexpected end of map discovered.");
- return (LLSD)llsdMap;
+ return (OSD)osdMap;
}
- private static void SerializeNotationElement(StringWriter writer, LLSD llsd)
+ private static void SerializeLLSDNotationElement(StringWriter writer, OSD osd)
{
- switch (llsd.Type)
+ switch (osd.Type)
{
- case LLSDType.Unknown:
+ case OSDType.Unknown:
writer.Write(undefNotationValue);
break;
- case LLSDType.Boolean:
- if (llsd.AsBoolean())
+ case OSDType.Boolean:
+ if (osd.AsBoolean())
writer.Write(trueNotationValueTwo);
else
writer.Write(falseNotationValueTwo);
break;
- case LLSDType.Integer:
+ case OSDType.Integer:
writer.Write(integerNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.Real:
+ case OSDType.Real:
writer.Write(realNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.UUID:
+ case OSDType.UUID:
writer.Write(uuidNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.String:
+ case OSDType.String:
writer.Write(singleQuotesNotationMarker);
- writer.Write(EscapeCharacter(llsd.AsString(), singleQuotesNotationMarker));
+ writer.Write(EscapeCharacter(osd.AsString(), singleQuotesNotationMarker));
writer.Write(singleQuotesNotationMarker);
break;
- case LLSDType.Binary:
+ case OSDType.Binary:
writer.Write(binaryNotationMarker);
writer.Write("64");
writer.Write(doubleQuotesNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.Date:
+ case OSDType.Date:
writer.Write(dateNotationMarker);
writer.Write(doubleQuotesNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.URI:
+ case OSDType.URI:
writer.Write(uriNotationMarker);
writer.Write(doubleQuotesNotationMarker);
- writer.Write(EscapeCharacter(llsd.AsString(), doubleQuotesNotationMarker));
+ writer.Write(EscapeCharacter(osd.AsString(), doubleQuotesNotationMarker));
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.Array:
- SerializeNotationArray(writer, (LLSDArray)llsd);
+ case OSDType.Array:
+ SerializeLLSDNotationArray(writer, (OSDArray)osd);
break;
- case LLSDType.Map:
- SerializeNotationMap(writer, (LLSDMap)llsd);
+ case OSDType.Map:
+ SerializeLLSDNotationMap(writer, (OSDMap)osd);
break;
default:
- throw new LLSDException("Notation serialization: Not existing element discovered.");
+ throw new OSDException("Notation serialization: Not existing element discovered.");
}
}
- private static void SerializeNotationArray(StringWriter writer, LLSDArray llsdArray)
+ private static void SerializeLLSDNotationArray(StringWriter writer, OSDArray osdArray)
{
writer.Write(arrayBeginNotationMarker);
- int lastIndex = llsdArray.Count - 1;
+ int lastIndex = osdArray.Count - 1;
for (int idx = 0; idx <= lastIndex; idx++)
{
- SerializeNotationElement(writer, llsdArray[idx]);
+ SerializeLLSDNotationElement(writer, osdArray[idx]);
if (idx < lastIndex)
writer.Write(kommaNotationDelimiter);
}
writer.Write(arrayEndNotationMarker);
}
- private static void SerializeNotationMap(StringWriter writer, LLSDMap llsdMap)
+ private static void SerializeLLSDNotationMap(StringWriter writer, OSDMap osdMap)
{
writer.Write(mapBeginNotationMarker);
- int lastIndex = llsdMap.Count - 1;
+ int lastIndex = osdMap.Count - 1;
int idx = 0;
- foreach (KeyValuePair kvp in llsdMap)
+ foreach (KeyValuePair kvp in osdMap)
{
writer.Write(singleQuotesNotationMarker);
writer.Write(EscapeCharacter(kvp.Key, singleQuotesNotationMarker));
writer.Write(singleQuotesNotationMarker);
writer.Write(keyNotationDelimiter);
- SerializeNotationElement(writer, kvp.Value);
+ SerializeLLSDNotationElement(writer, kvp.Value);
if (idx < lastIndex)
writer.Write(kommaNotationDelimiter);
@@ -503,80 +473,80 @@ namespace OpenMetaverse.StructuredData
writer.Write(mapEndNotationMarker);
}
- private static void SerializeNotationElementFormatted(StringWriter writer, string indent, LLSD llsd)
+ private static void SerializeLLSDNotationElementFormatted(StringWriter writer, string indent, OSD osd)
{
- switch (llsd.Type)
+ switch (osd.Type)
{
- case LLSDType.Unknown:
+ case OSDType.Unknown:
writer.Write(undefNotationValue);
break;
- case LLSDType.Boolean:
- if (llsd.AsBoolean())
+ case OSDType.Boolean:
+ if (osd.AsBoolean())
writer.Write(trueNotationValueTwo);
else
writer.Write(falseNotationValueTwo);
break;
- case LLSDType.Integer:
+ case OSDType.Integer:
writer.Write(integerNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.Real:
+ case OSDType.Real:
writer.Write(realNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.UUID:
+ case OSDType.UUID:
writer.Write(uuidNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
break;
- case LLSDType.String:
+ case OSDType.String:
writer.Write(singleQuotesNotationMarker);
- writer.Write(EscapeCharacter(llsd.AsString(), singleQuotesNotationMarker));
+ writer.Write(EscapeCharacter(osd.AsString(), singleQuotesNotationMarker));
writer.Write(singleQuotesNotationMarker);
break;
- case LLSDType.Binary:
+ case OSDType.Binary:
writer.Write(binaryNotationMarker);
writer.Write("64");
writer.Write(doubleQuotesNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.Date:
+ case OSDType.Date:
writer.Write(dateNotationMarker);
writer.Write(doubleQuotesNotationMarker);
- writer.Write(llsd.AsString());
+ writer.Write(osd.AsString());
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.URI:
+ case OSDType.URI:
writer.Write(uriNotationMarker);
writer.Write(doubleQuotesNotationMarker);
- writer.Write(EscapeCharacter(llsd.AsString(), doubleQuotesNotationMarker));
+ writer.Write(EscapeCharacter(osd.AsString(), doubleQuotesNotationMarker));
writer.Write(doubleQuotesNotationMarker);
break;
- case LLSDType.Array:
- SerializeNotationArrayFormatted(writer, indent + baseIndent, (LLSDArray)llsd);
+ case OSDType.Array:
+ SerializeLLSDNotationArrayFormatted(writer, indent + baseIndent, (OSDArray)osd);
break;
- case LLSDType.Map:
- SerializeNotationMapFormatted(writer, indent + baseIndent, (LLSDMap)llsd);
+ case OSDType.Map:
+ SerializeLLSDNotationMapFormatted(writer, indent + baseIndent, (OSDMap)osd);
break;
default:
- throw new LLSDException("Notation serialization: Not existing element discovered.");
+ throw new OSDException("Notation serialization: Not existing element discovered.");
}
}
- private static void SerializeNotationArrayFormatted(StringWriter writer, string intend, LLSDArray llsdArray)
+ private static void SerializeLLSDNotationArrayFormatted(StringWriter writer, string intend, OSDArray osdArray)
{
writer.Write(Helpers.NewLine);
writer.Write(intend);
writer.Write(arrayBeginNotationMarker);
- int lastIndex = llsdArray.Count - 1;
+ int lastIndex = osdArray.Count - 1;
for (int idx = 0; idx <= lastIndex; idx++)
{
- if (llsdArray[idx].Type != LLSDType.Array && llsdArray[idx].Type != LLSDType.Map)
+ if (osdArray[idx].Type != OSDType.Array && osdArray[idx].Type != OSDType.Map)
writer.Write(Helpers.NewLine);
writer.Write(intend + baseIndent);
- SerializeNotationElementFormatted(writer, intend, llsdArray[idx]);
+ SerializeLLSDNotationElementFormatted(writer, intend, osdArray[idx]);
if (idx < lastIndex)
{
writer.Write(kommaNotationDelimiter);
@@ -587,23 +557,23 @@ namespace OpenMetaverse.StructuredData
writer.Write(arrayEndNotationMarker);
}
- private static void SerializeNotationMapFormatted(StringWriter writer, string intend, LLSDMap llsdMap)
+ private static void SerializeLLSDNotationMapFormatted(StringWriter writer, string intend, OSDMap osdMap)
{
writer.Write(Helpers.NewLine);
writer.Write(intend);
writer.Write(mapBeginNotationMarker);
writer.Write(Helpers.NewLine);
- int lastIndex = llsdMap.Count - 1;
+ int lastIndex = osdMap.Count - 1;
int idx = 0;
- foreach (KeyValuePair kvp in llsdMap)
+ foreach (KeyValuePair kvp in osdMap)
{
writer.Write(intend + baseIndent);
writer.Write(singleQuotesNotationMarker);
writer.Write(EscapeCharacter(kvp.Key, singleQuotesNotationMarker));
writer.Write(singleQuotesNotationMarker);
writer.Write(keyNotationDelimiter);
- SerializeNotationElementFormatted(writer, intend, kvp.Value);
+ SerializeLLSDNotationElementFormatted(writer, intend, kvp.Value);
if (idx < lastIndex)
{
writer.Write(Helpers.NewLine);
@@ -674,10 +644,10 @@ namespace OpenMetaverse.StructuredData
s.Append((char)character);
}
if (character < 0)
- throw new LLSDException("Notation LLSD parsing: Can't parse length value cause unexpected end of stream.");
+ throw new OSDException("Notation LLSD parsing: Can't parse length value cause unexpected end of stream.");
int length;
if (!Int32.TryParse(s.ToString(), out length))
- throw new LLSDException("Notation LLSD parsing: Can't parse length value.");
+ throw new OSDException("Notation LLSD parsing: Can't parse length value.");
return length;
}
@@ -736,7 +706,7 @@ namespace OpenMetaverse.StructuredData
}
if (character < 0)
- throw new LLSDException("Notation LLSD parsing: Can't parse text because unexpected end of stream while expecting a '"
+ throw new OSDException("Notation LLSD parsing: Can't parse text because unexpected end of stream while expecting a '"
+ delimiter + "' character.");
return s.ToString();
diff --git a/OpenMetaverse/LLSD/LLSD.cs b/OpenMetaverse/StructuredData/StructuredData.cs
similarity index 65%
rename from OpenMetaverse/LLSD/LLSD.cs
rename to OpenMetaverse/StructuredData/StructuredData.cs
index 7dfd44c5..df973bc3 100644
--- a/OpenMetaverse/LLSD/LLSD.cs
+++ b/OpenMetaverse/StructuredData/StructuredData.cs
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2008, openmetaverse.org
+ * Copyright (c) 2008, openmetaverse.org
* All rights reserved.
*
* - Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public enum LLSDType
+ public enum OSDType
{
///
Unknown,
@@ -64,17 +64,17 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDException : Exception
+ public class OSDException : Exception
{
- public LLSDException(string message) : base(message) { }
+ public OSDException(string message) : base(message) { }
}
///
///
///
- public partial class LLSD
+ public partial class OSD
{
- public virtual LLSDType Type { get { return LLSDType.Unknown; } }
+ public virtual OSDType Type { get { return OSDType.Unknown; } }
public virtual bool AsBoolean() { return false; }
public virtual int AsInteger() { return 0; }
@@ -87,113 +87,113 @@ namespace OpenMetaverse.StructuredData
public override string ToString() { return "undef"; }
- public static LLSD FromBoolean(bool value) { return new LLSDBoolean(value); }
- public static LLSD FromInteger(int value) { return new LLSDInteger(value); }
- public static LLSD FromInteger(uint value) { return new LLSDInteger((int)value); }
- public static LLSD FromInteger(short value) { return new LLSDInteger((int)value); }
- public static LLSD FromInteger(ushort value) { return new LLSDInteger((int)value); }
- public static LLSD FromInteger(sbyte value) { return new LLSDInteger((int)value); }
- public static LLSD FromInteger(byte value) { return new LLSDInteger((int)value); }
- public static LLSD FromUInteger(uint value) { return new LLSDBinary(value); }
- public static LLSD FromReal(double value) { return new LLSDReal(value); }
- public static LLSD FromReal(float value) { return new LLSDReal((double)value); }
- public static LLSD FromString(string value) { return new LLSDString(value); }
- public static LLSD FromUUID(UUID value) { return new LLSDUUID(value); }
- public static LLSD FromDate(DateTime value) { return new LLSDDate(value); }
- public static LLSD FromUri(Uri value) { return new LLSDURI(value); }
- public static LLSD FromBinary(byte[] value) { return new LLSDBinary(value); }
- public static LLSD FromBinary(long value) { return new LLSDBinary(value); }
- public static LLSD FromBinary(ulong value) { return new LLSDBinary(value); }
+ public static OSD FromBoolean(bool value) { return new OSDBoolean(value); }
+ public static OSD FromInteger(int value) { return new OSDInteger(value); }
+ public static OSD FromInteger(uint value) { return new OSDInteger((int)value); }
+ public static OSD FromInteger(short value) { return new OSDInteger((int)value); }
+ public static OSD FromInteger(ushort value) { return new OSDInteger((int)value); }
+ public static OSD FromInteger(sbyte value) { return new OSDInteger((int)value); }
+ public static OSD FromInteger(byte value) { return new OSDInteger((int)value); }
+ public static OSD FromUInteger(uint value) { return new OSDBinary(value); }
+ public static OSD FromReal(double value) { return new OSDReal(value); }
+ public static OSD FromReal(float value) { return new OSDReal((double)value); }
+ public static OSD FromString(string value) { return new OSDString(value); }
+ public static OSD FromUUID(UUID value) { return new OSDUUID(value); }
+ public static OSD FromDate(DateTime value) { return new OSDDate(value); }
+ public static OSD FromUri(Uri value) { return new OSDURI(value); }
+ public static OSD FromBinary(byte[] value) { return new OSDBinary(value); }
+ public static OSD FromBinary(long value) { return new OSDBinary(value); }
+ public static OSD FromBinary(ulong value) { return new OSDBinary(value); }
- public static LLSD FromVector2(Vector2 value)
+ public static OSD FromVector2(Vector2 value)
{
- LLSDArray array = new LLSDArray();
- array.Add(LLSD.FromReal(value.X));
- array.Add(LLSD.FromReal(value.Y));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.X));
+ array.Add(OSD.FromReal(value.Y));
return array;
}
- public static LLSD FromVector3(Vector3 value)
+ public static OSD FromVector3(Vector3 value)
{
- LLSDArray array = new LLSDArray();
- array.Add(LLSD.FromReal(value.X));
- array.Add(LLSD.FromReal(value.Y));
- array.Add(LLSD.FromReal(value.Z));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.X));
+ array.Add(OSD.FromReal(value.Y));
+ array.Add(OSD.FromReal(value.Z));
return array;
}
- public static LLSD FromVector3d(Vector3d value)
+ public static OSD FromVector3d(Vector3d value)
{
- LLSDArray array = new LLSDArray();
- array.Add(LLSD.FromReal(value.X));
- array.Add(LLSD.FromReal(value.Y));
- array.Add(LLSD.FromReal(value.Z));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.X));
+ array.Add(OSD.FromReal(value.Y));
+ array.Add(OSD.FromReal(value.Z));
return array;
}
- public static LLSD FromVector4(Vector4 value)
+ public static OSD FromVector4(Vector4 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));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.X));
+ array.Add(OSD.FromReal(value.Y));
+ array.Add(OSD.FromReal(value.Z));
+ array.Add(OSD.FromReal(value.W));
return array;
}
- public static LLSD FromQuaternion(Quaternion value)
+ public static OSD 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));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.X));
+ array.Add(OSD.FromReal(value.Y));
+ array.Add(OSD.FromReal(value.Z));
+ array.Add(OSD.FromReal(value.W));
return array;
}
- public static LLSD FromColor4(Color4 value)
+ public static OSD 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));
+ OSDArray array = new OSDArray();
+ array.Add(OSD.FromReal(value.R));
+ array.Add(OSD.FromReal(value.G));
+ array.Add(OSD.FromReal(value.B));
+ array.Add(OSD.FromReal(value.A));
return array;
}
- public static LLSD FromObject(object value)
+ public static OSD FromObject(object value)
{
- if (value == null) { return new LLSD(); }
- else if (value is bool) { return new LLSDBoolean((bool)value); }
- else if (value is int) { return new LLSDInteger((int)value); }
- else if (value is uint) { return new LLSDBinary((uint)value); }
- else if (value is short) { return new LLSDInteger((int)(short)value); }
- else if (value is ushort) { return new LLSDInteger((int)(ushort)value); }
- else if (value is sbyte) { return new LLSDInteger((int)(sbyte)value); }
- else if (value is byte) { return new LLSDInteger((int)(byte)value); }
- else if (value is double) { return new LLSDReal((double)value); }
- else if (value is float) { return new LLSDReal((double)(float)value); }
- else if (value is string) { return new LLSDString((string)value); }
- else if (value is UUID) { return new LLSDUUID((UUID)value); }
- else if (value is DateTime) { return new LLSDDate((DateTime)value); }
- else if (value is Uri) { return new LLSDURI((Uri)value); }
- else if (value is byte[]) { return new LLSDBinary((byte[])value); }
- else if (value is long) { return new LLSDBinary((long)value); }
- else if (value is ulong) { return new LLSDBinary((ulong)value); }
+ if (value == null) { return new OSD(); }
+ else if (value is bool) { return new OSDBoolean((bool)value); }
+ else if (value is int) { return new OSDInteger((int)value); }
+ else if (value is uint) { return new OSDBinary((uint)value); }
+ else if (value is short) { return new OSDInteger((int)(short)value); }
+ else if (value is ushort) { return new OSDInteger((int)(ushort)value); }
+ else if (value is sbyte) { return new OSDInteger((int)(sbyte)value); }
+ else if (value is byte) { return new OSDInteger((int)(byte)value); }
+ else if (value is double) { return new OSDReal((double)value); }
+ else if (value is float) { return new OSDReal((double)(float)value); }
+ else if (value is string) { return new OSDString((string)value); }
+ else if (value is UUID) { return new OSDUUID((UUID)value); }
+ else if (value is DateTime) { return new OSDDate((DateTime)value); }
+ else if (value is Uri) { return new OSDURI((Uri)value); }
+ else if (value is byte[]) { return new OSDBinary((byte[])value); }
+ else if (value is long) { return new OSDBinary((long)value); }
+ else if (value is ulong) { return new OSDBinary((ulong)value); }
else if (value is Vector2) { return FromVector2((Vector2)value); }
else if (value is Vector3) { return FromVector3((Vector3)value); }
else if (value is Vector3d) { return FromVector3d((Vector3d)value); }
else if (value is Vector4) { return FromVector4((Vector4)value); }
else if (value is Quaternion) { return FromQuaternion((Quaternion)value); }
else if (value is Color4) { return FromColor4((Color4)value); }
- else return new LLSD();
+ else return new OSD();
}
- public static object ToObject(Type type, LLSD value)
+ public static object ToObject(Type type, OSD value)
{
if (type == typeof(ulong))
{
- if (value.Type == LLSDType.Binary)
+ if (value.Type == OSDType.Binary)
{
byte[] bytes = value.AsBinary();
return Utils.BytesToUInt64(bytes);
@@ -205,7 +205,7 @@ namespace OpenMetaverse.StructuredData
}
else if (type == typeof(uint))
{
- if (value.Type == LLSDType.Binary)
+ if (value.Type == OSDType.Binary)
{
byte[] bytes = value.AsBinary();
return Utils.BytesToUInt(bytes);
@@ -253,22 +253,22 @@ namespace OpenMetaverse.StructuredData
}
else if (type == typeof(Vector3))
{
- if (value.Type == LLSDType.Array)
- return ((LLSDArray)value).AsVector3();
+ if (value.Type == OSDType.Array)
+ return ((OSDArray)value).AsVector3();
else
return Vector3.Zero;
}
else if (type == typeof(Vector4))
{
- if (value.Type == LLSDType.Array)
- return ((LLSDArray)value).AsVector4();
+ if (value.Type == OSDType.Array)
+ return ((OSDArray)value).AsVector4();
else
return Vector4.Zero;
}
else if (type == typeof(Quaternion))
{
- if (value.Type == LLSDType.Array)
- return ((LLSDArray)value).AsQuaternion();
+ if (value.Type == OSDType.Array)
+ return ((OSDArray)value).AsQuaternion();
else
return Quaternion.Identity;
}
@@ -279,27 +279,27 @@ namespace OpenMetaverse.StructuredData
}
///
- /// Uses reflection to create an LLSDMap from all of the LLSD
+ /// Uses reflection to create an SDMap from all of the SD
/// serializable types in an object
///
/// Class or struct containing serializable types
- /// An LLSDMap holding the serialized values from the
+ /// An SDMap holding the serialized values from the
/// container object
- public static LLSDMap SerializeMembers(object obj)
+ public static OSDMap SerializeMembers(object obj)
{
Type t = obj.GetType();
FieldInfo[] fields = t.GetFields();
- LLSDMap map = new LLSDMap(fields.Length);
+ OSDMap map = new OSDMap(fields.Length);
for (int i = 0; i < fields.Length; i++)
{
FieldInfo field = fields[i];
if (!Attribute.IsDefined(field, typeof(NonSerializedAttribute)))
{
- LLSD serializedField = LLSD.FromObject(field.GetValue(obj));
+ OSD serializedField = OSD.FromObject(field.GetValue(obj));
- if (serializedField.Type != LLSDType.Unknown || field.FieldType == typeof(string) || field.FieldType == typeof(byte[]))
+ if (serializedField.Type != OSDType.Unknown || field.FieldType == typeof(string) || field.FieldType == typeof(byte[]))
map.Add(field.Name, serializedField);
}
}
@@ -309,13 +309,13 @@ namespace OpenMetaverse.StructuredData
///
/// Uses reflection to deserialize member variables in an object from
- /// an LLSDMap
+ /// an SDMap
///
/// Reference to an object to fill with deserialized
/// values
/// Serialized values to put in the target
/// object
- public static void DeserializeMembers(ref object obj, LLSDMap serialized)
+ public static void DeserializeMembers(ref object obj, OSDMap serialized)
{
Type t = obj.GetType();
FieldInfo[] fields = t.GetFields();
@@ -325,7 +325,7 @@ namespace OpenMetaverse.StructuredData
FieldInfo field = fields[i];
if (!Attribute.IsDefined(field, typeof(NonSerializedAttribute)))
{
- LLSD serializedField;
+ OSD serializedField;
if (serialized.TryGetValue(field.Name, out serializedField))
field.SetValue(obj, ToObject(field.FieldType, serializedField));
}
@@ -336,16 +336,16 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDBoolean : LLSD
+ public class OSDBoolean : OSD
{
private bool value;
private static byte[] trueBinary = { 0x31 };
private static byte[] falseBinary = { 0x30 };
- public override LLSDType Type { get { return LLSDType.Boolean; } }
+ public override OSDType Type { get { return OSDType.Boolean; } }
- public LLSDBoolean(bool value)
+ public OSDBoolean(bool value)
{
this.value = value;
}
@@ -362,13 +362,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDInteger : LLSD
+ public class OSDInteger : OSD
{
private int value;
- public override LLSDType Type { get { return LLSDType.Integer; } }
+ public override OSDType Type { get { return OSDType.Integer; } }
- public LLSDInteger(int value)
+ public OSDInteger(int value)
{
this.value = value;
}
@@ -385,13 +385,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDReal : LLSD
+ public class OSDReal : OSD
{
private double value;
- public override LLSDType Type { get { return LLSDType.Real; } }
+ public override OSDType Type { get { return OSDType.Real; } }
- public LLSDReal(double value)
+ public OSDReal(double value)
{
this.value = value;
}
@@ -416,13 +416,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDString : LLSD
+ public class OSDString : OSD
{
private string value;
- public override LLSDType Type { get { return LLSDType.String; } }
+ public override OSDType Type { get { return OSDType.String; } }
- public LLSDString(string value)
+ public OSDString(string value)
{
// Refuse to hold null pointers
if (value != null)
@@ -484,13 +484,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDUUID : LLSD
+ public class OSDUUID : OSD
{
private UUID value;
- public override LLSDType Type { get { return LLSDType.UUID; } }
+ public override OSDType Type { get { return OSDType.UUID; } }
- public LLSDUUID(UUID value)
+ public OSDUUID(UUID value)
{
this.value = value;
}
@@ -505,13 +505,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDDate : LLSD
+ public class OSDDate : OSD
{
private DateTime value;
- public override LLSDType Type { get { return LLSDType.Date; } }
+ public override OSDType Type { get { return OSDType.Date; } }
- public LLSDDate(DateTime value)
+ public OSDDate(DateTime value)
{
this.value = value;
}
@@ -539,13 +539,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDURI : LLSD
+ public class OSDURI : OSD
{
private Uri value;
- public override LLSDType Type { get { return LLSDType.URI; } }
+ public override OSDType Type { get { return OSDType.URI; } }
- public LLSDURI(Uri value)
+ public OSDURI(Uri value)
{
this.value = value;
}
@@ -559,13 +559,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDBinary : LLSD
+ public class OSDBinary : OSD
{
private byte[] value;
- public override LLSDType Type { get { return LLSDType.Binary; } }
+ public override OSDType Type { get { return OSDType.Binary; } }
- public LLSDBinary(byte[] value)
+ public OSDBinary(byte[] value)
{
if (value != null)
this.value = value;
@@ -573,17 +573,17 @@ namespace OpenMetaverse.StructuredData
this.value = new byte[0];
}
- public LLSDBinary(uint value)
+ public OSDBinary(uint value)
{
this.value = Utils.UIntToBytes(value);
}
- public LLSDBinary(long value)
+ public OSDBinary(long value)
{
this.value = Utils.Int64ToBytes(value);
}
- public LLSDBinary(ulong value)
+ public OSDBinary(ulong value)
{
this.value = Utils.UInt64ToBytes(value);
}
@@ -600,35 +600,35 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDMap : LLSD, IDictionary
+ public class OSDMap : OSD, IDictionary
{
- private Dictionary value;
+ private Dictionary value;
- public override LLSDType Type { get { return LLSDType.Map; } }
+ public override OSDType Type { get { return OSDType.Map; } }
- public LLSDMap()
+ public OSDMap()
{
- value = new Dictionary();
+ value = new Dictionary();
}
- public LLSDMap(int capacity)
+ public OSDMap(int capacity)
{
- value = new Dictionary(capacity);
+ value = new Dictionary(capacity);
}
- public LLSDMap(Dictionary value)
+ public OSDMap(Dictionary value)
{
if (value != null)
this.value = value;
else
- this.value = new Dictionary();
+ this.value = new Dictionary();
}
public override bool AsBoolean() { return value.Count > 0; }
public override string ToString()
{
- return LLSDParser.SerializeNotationFormatted(this);
+ return LLSDParser.SerializeLLSDNotationFormatted(this);
}
#region IDictionary Implementation
@@ -636,16 +636,16 @@ namespace OpenMetaverse.StructuredData
public int Count { get { return value.Count; } }
public bool IsReadOnly { get { return false; } }
public ICollection Keys { get { return value.Keys; } }
- public ICollection Values { get { return value.Values; } }
- public LLSD this[string key]
+ public ICollection Values { get { return value.Values; } }
+ public OSD this[string key]
{
get
{
- LLSD llsd;
+ OSD llsd;
if (this.value.TryGetValue(key, out llsd))
return llsd;
else
- return new LLSD();
+ return new OSD();
}
set { this.value[key] = value; }
}
@@ -655,12 +655,12 @@ namespace OpenMetaverse.StructuredData
return value.ContainsKey(key);
}
- public void Add(string key, LLSD llsd)
+ public void Add(string key, OSD llsd)
{
value.Add(key, llsd);
}
- public void Add(KeyValuePair kvp)
+ public void Add(KeyValuePair kvp)
{
value.Add(kvp.Key, kvp.Value);
}
@@ -670,7 +670,7 @@ namespace OpenMetaverse.StructuredData
return value.Remove(key);
}
- public bool TryGetValue(string key, out LLSD llsd)
+ public bool TryGetValue(string key, out OSD llsd)
{
return value.TryGetValue(key, out llsd);
}
@@ -680,19 +680,19 @@ namespace OpenMetaverse.StructuredData
value.Clear();
}
- public bool Contains(KeyValuePair kvp)
+ public bool Contains(KeyValuePair kvp)
{
// This is a bizarre function... we don't really implement it
// properly, hopefully no one wants to use it
return value.ContainsKey(kvp.Key);
}
- public void CopyTo(KeyValuePair[] array, int index)
+ public void CopyTo(KeyValuePair[] array, int index)
{
throw new NotImplementedException();
}
- public bool Remove(KeyValuePair kvp)
+ public bool Remove(KeyValuePair kvp)
{
return this.value.Remove(kvp.Key);
}
@@ -702,7 +702,7 @@ namespace OpenMetaverse.StructuredData
return value.GetEnumerator();
}
- IEnumerator> IEnumerable>.GetEnumerator()
+ IEnumerator> IEnumerable>.GetEnumerator()
{
return null;
}
@@ -718,28 +718,28 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public class LLSDArray : LLSD, IList
+ public class OSDArray : OSD, IList
{
- private List value;
+ private List value;
- public override LLSDType Type { get { return LLSDType.Array; } }
+ public override OSDType Type { get { return OSDType.Array; } }
- public LLSDArray()
+ public OSDArray()
{
- value = new List();
+ value = new List();
}
- public LLSDArray(int capacity)
+ public OSDArray(int capacity)
{
- value = new List(capacity);
+ value = new List(capacity);
}
- public LLSDArray(List value)
+ public OSDArray(List value)
{
if (value != null)
this.value = value;
else
- this.value = new List();
+ this.value = new List();
}
public Vector2 AsVector2()
@@ -832,25 +832,25 @@ namespace OpenMetaverse.StructuredData
public override string ToString()
{
- return LLSDParser.SerializeNotationFormatted(this);
+ return LLSDParser.SerializeLLSDNotationFormatted(this);
}
#region IList Implementation
public int Count { get { return value.Count; } }
public bool IsReadOnly { get { return false; } }
- public LLSD this[int index]
+ public OSD this[int index]
{
get { return value[index]; }
set { this.value[index] = value; }
}
- public int IndexOf(LLSD llsd)
+ public int IndexOf(OSD llsd)
{
return value.IndexOf(llsd);
}
- public void Insert(int index, LLSD llsd)
+ public void Insert(int index, OSD llsd)
{
value.Insert(index, llsd);
}
@@ -860,7 +860,7 @@ namespace OpenMetaverse.StructuredData
value.RemoveAt(index);
}
- public void Add(LLSD llsd)
+ public void Add(OSD llsd)
{
value.Add(llsd);
}
@@ -868,7 +868,7 @@ namespace OpenMetaverse.StructuredData
public void Add(string str)
{
// This is so common that we throw a little helper in here
- value.Add(LLSD.FromString(str));
+ value.Add(OSD.FromString(str));
}
public void Clear()
@@ -876,7 +876,7 @@ namespace OpenMetaverse.StructuredData
value.Clear();
}
- public bool Contains(LLSD llsd)
+ public bool Contains(OSD llsd)
{
return value.Contains(llsd);
}
@@ -885,19 +885,19 @@ namespace OpenMetaverse.StructuredData
{
for (int i = 0; i < value.Count; i++)
{
- if (value[i].Type == LLSDType.String && value[i].AsString() == element)
+ if (value[i].Type == OSDType.String && value[i].AsString() == element)
return true;
}
return false;
}
- public void CopyTo(LLSD[] array, int index)
+ public void CopyTo(OSD[] array, int index)
{
throw new NotImplementedException();
}
- public bool Remove(LLSD llsd)
+ public bool Remove(OSD llsd)
{
return value.Remove(llsd);
}
@@ -907,7 +907,7 @@ namespace OpenMetaverse.StructuredData
return value.GetEnumerator();
}
- IEnumerator IEnumerable.GetEnumerator()
+ IEnumerator IEnumerable.GetEnumerator()
{
return value.GetEnumerator();
}
diff --git a/OpenMetaverse/LLSD/XmlLLSD.cs b/OpenMetaverse/StructuredData/XmlLLSD.cs
similarity index 77%
rename from OpenMetaverse/LLSD/XmlLLSD.cs
rename to OpenMetaverse/StructuredData/XmlLLSD.cs
index f4ac3f3c..4709bcea 100644
--- a/OpenMetaverse/LLSD/XmlLLSD.cs
+++ b/OpenMetaverse/StructuredData/XmlLLSD.cs
@@ -48,9 +48,9 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static LLSD DeserializeXml(byte[] xmlData)
+ public static OSD DeserializeLLSDXml(byte[] xmlData)
{
- return DeserializeXml(new XmlTextReader(new MemoryStream(xmlData, false)));
+ return DeserializeLLSDXml(new XmlTextReader(new MemoryStream(xmlData, false)));
}
///
@@ -58,10 +58,10 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static LLSD DeserializeXml(string xmlData)
+ public static OSD DeserializeLLSDXml(string xmlData)
{
byte[] bytes = Utils.StringToBytes(xmlData);
- return DeserializeXml(new XmlTextReader(new MemoryStream(bytes, false)));
+ return DeserializeLLSDXml(new XmlTextReader(new MemoryStream(bytes, false)));
}
///
@@ -69,13 +69,13 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static LLSD DeserializeXml(XmlTextReader xmlData)
+ public static OSD DeserializeLLSDXml(XmlTextReader xmlData)
{
xmlData.Read();
SkipWhitespace(xmlData);
xmlData.Read();
- LLSD ret = ParseXmlElement(xmlData);
+ OSD ret = ParseLLSDXmlElement(xmlData);
return ret;
}
@@ -85,9 +85,9 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static byte[] SerializeXmlBytes(LLSD data)
+ public static byte[] SerializeLLSDXmlBytes(OSD data)
{
- return Encoding.UTF8.GetBytes(SerializeXmlString(data));
+ return Encoding.UTF8.GetBytes(SerializeLLSDXmlString(data));
}
///
@@ -95,14 +95,14 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static string SerializeXmlString(LLSD data)
+ public static string SerializeLLSDXmlString(OSD data)
{
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
writer.Formatting = Formatting.None;
writer.WriteStartElement(String.Empty, "llsd", String.Empty);
- SerializeXmlElement(writer, data);
+ SerializeLLSDXmlElement(writer, data);
writer.WriteEndElement();
writer.Close();
@@ -115,50 +115,50 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static void SerializeXmlElement(XmlTextWriter writer, LLSD data)
+ public static void SerializeLLSDXmlElement(XmlTextWriter writer, OSD data)
{
switch (data.Type)
{
- case LLSDType.Unknown:
+ case OSDType.Unknown:
writer.WriteStartElement(String.Empty, "undef", String.Empty);
writer.WriteEndElement();
break;
- case LLSDType.Boolean:
+ case OSDType.Boolean:
writer.WriteStartElement(String.Empty, "boolean", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.Integer:
+ case OSDType.Integer:
writer.WriteStartElement(String.Empty, "integer", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.Real:
+ case OSDType.Real:
writer.WriteStartElement(String.Empty, "real", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.String:
+ case OSDType.String:
writer.WriteStartElement(String.Empty, "string", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.UUID:
+ case OSDType.UUID:
writer.WriteStartElement(String.Empty, "uuid", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.Date:
+ case OSDType.Date:
writer.WriteStartElement(String.Empty, "date", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.URI:
+ case OSDType.URI:
writer.WriteStartElement(String.Empty, "uri", String.Empty);
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.Binary:
+ case OSDType.Binary:
writer.WriteStartElement(String.Empty, "binary", String.Empty);
writer.WriteStartAttribute(String.Empty, "encoding", String.Empty);
writer.WriteString("base64");
@@ -166,25 +166,25 @@ namespace OpenMetaverse.StructuredData
writer.WriteString(data.AsString());
writer.WriteEndElement();
break;
- case LLSDType.Map:
- LLSDMap map = (LLSDMap)data;
+ case OSDType.Map:
+ OSDMap map = (OSDMap)data;
writer.WriteStartElement(String.Empty, "map", String.Empty);
- foreach (KeyValuePair kvp in map)
+ foreach (KeyValuePair kvp in map)
{
writer.WriteStartElement(String.Empty, "key", String.Empty);
writer.WriteString(kvp.Key);
writer.WriteEndElement();
- SerializeXmlElement(writer, kvp.Value);
+ SerializeLLSDXmlElement(writer, kvp.Value);
}
writer.WriteEndElement();
break;
- case LLSDType.Array:
- LLSDArray array = (LLSDArray)data;
+ case OSDType.Array:
+ OSDArray array = (OSDArray)data;
writer.WriteStartElement(String.Empty, "array", String.Empty);
for (int i = 0; i < array.Count; i++)
{
- SerializeXmlElement(writer, array[i]);
+ SerializeLLSDXmlElement(writer, array[i]);
}
writer.WriteEndElement();
break;
@@ -197,19 +197,19 @@ namespace OpenMetaverse.StructuredData
///
///
///
- public static bool TryValidate(XmlTextReader xmlData, out string error)
+ public static bool TryValidateLLSDXml(XmlTextReader xmlData, out string error)
{
lock (XmlValidationLock)
{
LastXmlErrors = String.Empty;
XmlTextReader = xmlData;
- CreateSchema();
+ CreateLLSDXmlSchema();
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.ValidationType = ValidationType.Schema;
readerSettings.Schemas.Add(XmlSchema);
- readerSettings.ValidationEventHandler += new ValidationEventHandler(SchemaValidationHandler);
+ readerSettings.ValidationEventHandler += new ValidationEventHandler(LLSDXmlSchemaValidationHandler);
XmlReader reader = XmlReader.Create(xmlData, readerSettings);
@@ -241,15 +241,15 @@ namespace OpenMetaverse.StructuredData
///
///
///
- private static LLSD ParseXmlElement(XmlTextReader reader)
+ private static OSD ParseLLSDXmlElement(XmlTextReader reader)
{
SkipWhitespace(reader);
if (reader.NodeType != XmlNodeType.Element)
- throw new LLSDException("Expected an element");
+ throw new OSDException("Expected an element");
string type = reader.LocalName;
- LLSD ret;
+ OSD ret;
switch (type)
{
@@ -257,18 +257,18 @@ namespace OpenMetaverse.StructuredData
if (reader.IsEmptyElement)
{
reader.Read();
- return new LLSD();
+ return new OSD();
}
reader.Read();
SkipWhitespace(reader);
- ret = new LLSD();
+ ret = new OSD();
break;
case "boolean":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromBoolean(false);
+ return OSD.FromBoolean(false);
}
if (reader.Read())
@@ -277,35 +277,35 @@ namespace OpenMetaverse.StructuredData
if (!String.IsNullOrEmpty(s) && (s == "true" || s == "1"))
{
- ret = LLSD.FromBoolean(true);
+ ret = OSD.FromBoolean(true);
break;
}
}
- ret = LLSD.FromBoolean(false);
+ ret = OSD.FromBoolean(false);
break;
case "integer":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromInteger(0);
+ return OSD.FromInteger(0);
}
if (reader.Read())
{
int value = 0;
Int32.TryParse(reader.ReadString().Trim(), out value);
- ret = LLSD.FromInteger(value);
+ ret = OSD.FromInteger(value);
break;
}
- ret = LLSD.FromInteger(0);
+ ret = OSD.FromInteger(0);
break;
case "real":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromReal(0d);
+ return OSD.FromReal(0d);
}
if (reader.Read())
@@ -318,105 +318,105 @@ namespace OpenMetaverse.StructuredData
else
Utils.TryParseDouble(str, out value);
- ret = LLSD.FromReal(value);
+ ret = OSD.FromReal(value);
break;
}
- ret = LLSD.FromReal(0d);
+ ret = OSD.FromReal(0d);
break;
case "uuid":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromUUID(UUID.Zero);
+ return OSD.FromUUID(UUID.Zero);
}
if (reader.Read())
{
UUID value = UUID.Zero;
UUID.TryParse(reader.ReadString().Trim(), out value);
- ret = LLSD.FromUUID(value);
+ ret = OSD.FromUUID(value);
break;
}
- ret = LLSD.FromUUID(UUID.Zero);
+ ret = OSD.FromUUID(UUID.Zero);
break;
case "date":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromDate(Utils.Epoch);
+ return OSD.FromDate(Utils.Epoch);
}
if (reader.Read())
{
DateTime value = Utils.Epoch;
DateTime.TryParse(reader.ReadString().Trim(), out value);
- ret = LLSD.FromDate(value);
+ ret = OSD.FromDate(value);
break;
}
- ret = LLSD.FromDate(Utils.Epoch);
+ ret = OSD.FromDate(Utils.Epoch);
break;
case "string":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromString(String.Empty);
+ return OSD.FromString(String.Empty);
}
if (reader.Read())
{
- ret = LLSD.FromString(reader.ReadString());
+ ret = OSD.FromString(reader.ReadString());
break;
}
- ret = LLSD.FromString(String.Empty);
+ ret = OSD.FromString(String.Empty);
break;
case "binary":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromBinary(new byte[0]);
+ return OSD.FromBinary(new byte[0]);
}
if (reader.GetAttribute("encoding") != null && reader.GetAttribute("encoding") != "base64")
- throw new LLSDException("Unsupported binary encoding: " + reader.GetAttribute("encoding"));
+ throw new OSDException("Unsupported binary encoding: " + reader.GetAttribute("encoding"));
if (reader.Read())
{
try
{
- ret = LLSD.FromBinary(Convert.FromBase64String(reader.ReadString().Trim()));
+ ret = OSD.FromBinary(Convert.FromBase64String(reader.ReadString().Trim()));
break;
}
catch (FormatException ex)
{
- throw new LLSDException("Binary decoding exception: " + ex.Message);
+ throw new OSDException("Binary decoding exception: " + ex.Message);
}
}
- ret = LLSD.FromBinary(new byte[0]);
+ ret = OSD.FromBinary(new byte[0]);
break;
case "uri":
if (reader.IsEmptyElement)
{
reader.Read();
- return LLSD.FromUri(new Uri(String.Empty, UriKind.RelativeOrAbsolute));
+ return OSD.FromUri(new Uri(String.Empty, UriKind.RelativeOrAbsolute));
}
if (reader.Read())
{
- ret = LLSD.FromUri(new Uri(reader.ReadString(), UriKind.RelativeOrAbsolute));
+ ret = OSD.FromUri(new Uri(reader.ReadString(), UriKind.RelativeOrAbsolute));
break;
}
- ret = LLSD.FromUri(new Uri(String.Empty, UriKind.RelativeOrAbsolute));
+ ret = OSD.FromUri(new Uri(String.Empty, UriKind.RelativeOrAbsolute));
break;
case "map":
- return ParseXmlMap(reader);
+ return ParseLLSDXmlMap(reader);
case "array":
- return ParseXmlArray(reader);
+ return ParseLLSDXmlArray(reader);
default:
reader.Read();
ret = null;
@@ -425,7 +425,7 @@ namespace OpenMetaverse.StructuredData
if (reader.NodeType != XmlNodeType.EndElement || reader.LocalName != type)
{
- throw new LLSDException("Expected " + type + ">");
+ throw new OSDException("Expected " + type + ">");
}
else
{
@@ -434,12 +434,12 @@ namespace OpenMetaverse.StructuredData
}
}
- private static LLSDMap ParseXmlMap(XmlTextReader reader)
+ private static OSDMap ParseLLSDXmlMap(XmlTextReader reader)
{
if (reader.NodeType != XmlNodeType.Element || reader.LocalName != "map")
throw new NotImplementedException("Expected