diff --git a/SLProxy/SLProxy.cs b/SLProxy/SLProxy.cs
index 6393fca6..f247bcab 100644
--- a/SLProxy/SLProxy.cs
+++ b/SLProxy/SLProxy.cs
@@ -189,7 +189,7 @@ namespace SLProxy {
// KeepAlive: blocks until the proxy is free to shut down
public void KeepAlive() {
- lock(keepAliveLock);
+ lock (keepAliveLock) { };
}
// SetLoginRequestDelegate: specify a callback loginRequestDelegate that will be called when the client requests login
diff --git a/SLProxy/legacy/Types.cs b/SLProxy/legacy/Types.cs
index aa6a998a..ce1993e4 100644
--- a/SLProxy/legacy/Types.cs
+++ b/SLProxy/legacy/Types.cs
@@ -1,501 +1,501 @@
-/*
- * Copyright (c) 2006, Second Life Reverse Engineering Team
- * 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 Second Life Reverse Engineering Team 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.
- */
-
-using System;
-using System.Net;
-
-namespace libsecondlife
-{
- public class U64
- {
- public uint[] Data;
-
- public U64()
- {
- Data = new uint[2];
- Data[0] = 0;
- Data[1] = 1;
- }
-
- public U64(uint left, uint right)
- {
- Data = new uint[2];
- // "backwards", due to little-endian ordering
- Data[0] = right;
- Data[1] = left;
- }
-
- public U64(int left, int right)
- {
- Data = new uint[2];
- // "backwards", due to little-endian ordering
- Data[0] = (uint)right;
- Data[1] = (uint)left;
- }
-
- public U64(byte[] bA, int pos)
- {
- Data = new uint[2];
- Data[0] = (uint)(bA[pos] + (bA[pos+1]<<8) + (bA[pos+2]<<16) + (bA[pos+3]<<24));
- Data[1] = (uint)(bA[pos+4] + (bA[pos+5]<<8) + (bA[pos+6]<<16) + (bA[pos+7]<<24));
- }
-
- public byte[] GetBytes()
- {
- byte[] bA = new byte[8];
-
- bA[0]=(byte)((Data[0]) %256); bA[1]=(byte)((Data[0]>>8) %256);
- bA[2]=(byte)((Data[0]>>16)%256); bA[3]=(byte)((Data[0]>>24)%256);
- bA[4]=(byte)((Data[1]) %256); bA[5]=(byte)((Data[1]>>8) %256);
- bA[6]=(byte)((Data[1]>>16)%256); bA[7]=(byte)((Data[1]>>24)%256);
-
- return bA;
- }
-
- public override int GetHashCode()
- {
- return (int)(Data[0] ^ Data[1]);
- }
-
- public override bool Equals(object o)
- {
- if (!(o is U64)) return false;
-
- U64 u64 = (U64)o;
-
- return (u64.Data[0] == Data[0] && u64.Data[1] == Data[1]);
- }
-
- public static bool operator==(U64 lhs, U64 rhs)
- {
- if(object.ReferenceEquals(lhs, rhs)) return true;
- if(object.ReferenceEquals(lhs, null)) return false;
- if(object.ReferenceEquals(rhs, null)) return false;
-
- return (lhs.Data[0] == rhs.Data[0] && lhs.Data[1] == rhs.Data[1]);
- }
-
- public static bool operator!=(U64 lhs, U64 rhs)
- {
- return !(lhs == rhs);
- }
-
- public static bool operator==(U64 lhs, int rhs)
- {
- if(object.ReferenceEquals(lhs, null)) return (rhs == 0);
- /* this used to ignore the upper half of the U64, and I don't think
- that's correct. */
- return (lhs.Data[0] == 0 && lhs.Data[1] == rhs);
- }
-
- public static bool operator!=(U64 lhs, int rhs)
- {
- return !(lhs == rhs);
- }
-
- public override string ToString()
- {
- ulong u64 = (Data[1] << 32) + Data[0];
- return u64.ToString();
- }
- }
-
- public class LLUUID
- {
- private byte[] data = null;
- public byte[] Data
- {
- get { return data; }
- }
-
- public LLUUID()
- {
- data = new byte[16];
- }
-
- public LLUUID(string val)
- {
- data = new byte[16];
-
- if (val.Length == 36) val = val.Replace("-", "");
-
- if (val.Length != 32) return;
-
- for(int i = 0; i < 16; ++i)
- {
- data[i] = Convert.ToByte(val.Substring(i * 2, 2), 16);
- }
- }
-
- public LLUUID(byte[] byteArray, int pos)
- {
- data = new byte[16];
-
- Array.Copy(byteArray, pos, data, 0, 16);
- }
-
- public LLUUID(bool randomize)
- {
- if (randomize) data = Guid.NewGuid().ToByteArray();
- else data = new byte[16];
- }
-
- ///
- /// Calculate an LLCRC for the given LLUUID
- ///
- /// The LLUUID to calculate the CRC value for
- /// The CRC checksum for this LLUUID
- public uint CRC()
- {
- uint retval = 0;
-
- retval += (uint)((Data[3] << 24) + (Data[2] << 16) + (Data[1] << 8) + Data[0]);
- retval += (uint)((Data[7] << 24) + (Data[6] << 16) + (Data[5] << 8) + Data[4]);
- retval += (uint)((Data[11] << 24) + (Data[10] << 16) + (Data[9] << 8) + Data[8]);
- retval += (uint)((Data[15] << 24) + (Data[14] << 16) + (Data[13] << 8) + Data[12]);
-
- return retval;
- }
-
- public static LLUUID GenerateUUID()
- {
- return new LLUUID(Guid.NewGuid().ToByteArray(), 0);
- }
-
- public override int GetHashCode()
- {
- return ToString().GetHashCode();
- }
-
- public override bool Equals(object o)
- {
- if (!(o is LLUUID)) return false;
-
- LLUUID uuid = (LLUUID)o;
-
- for (int i = 0; i < 16; ++i)
- {
- if (Data[i] != uuid.Data[i]) return false;
- }
-
- return true;
- }
-
- public static bool operator==(LLUUID lhs, LLUUID rhs)
- {
- if(object.ReferenceEquals(lhs, rhs)) return true;
- if(object.ReferenceEquals(lhs, null)) return false;
- if(object.ReferenceEquals(rhs, null)) return false;
-
- for (int i = 0; i < 16; ++i)
- {
- if (lhs.Data[i] != rhs.Data[i]) return false;
- }
-
- return true;
- }
-
- public static bool operator!=(LLUUID lhs, LLUUID rhs)
- {
- return !(lhs == rhs);
- }
-
- public static implicit operator LLUUID(string val)
- {
- return new LLUUID(val);
- }
-
- public override string ToString()
- {
- string uuid = "";
-
- for (int i = 0; i < 16; ++i)
- {
- uuid += Data[i].ToString("x2");
- }
-
- return uuid;
- }
-
- public string ToStringHyphenated()
- {
- string uuid = "";
-
- for (int i = 0; i < 16; ++i)
- {
- uuid += Data[i].ToString("x2");
-
- }
- uuid = uuid.Insert(20,"-");
- uuid = uuid.Insert(16,"-");
- uuid = uuid.Insert(12,"-");
- uuid = uuid.Insert(8,"-");
-
-
- return uuid;
- }
- }
-
- public class LLVector3
- {
- public float X;
- public float Y;
- public float Z;
-
- public LLVector3()
- {
- X = Y = Z = 0.0F;
- }
-
- public LLVector3(LLVector3d vector)
- {
- X = (float)vector.X;
- Y = (float)vector.Y;
- Z = (float)vector.Z;
- }
-
- public LLVector3(byte[] byteArray, int pos)
- {
- if(!BitConverter.IsLittleEndian)
- {
- Array.Reverse(byteArray, pos, 4);
- Array.Reverse(byteArray, pos + 4, 4);
- Array.Reverse(byteArray, pos + 8, 4);
- }
-
- X = BitConverter.ToSingle(byteArray, pos);
- Y = BitConverter.ToSingle(byteArray, pos + 4);
- Z = BitConverter.ToSingle(byteArray, pos + 8);
- }
-
- public LLVector3(float x, float y, float z)
- {
- X = x;
- Y = y;
- Z = z;
- }
-
- public byte[] GetBytes()
- {
- byte[] byteArray = new byte[12];
-
- Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 4);
- Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4);
- Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4);
-
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, 0, 4);
- Array.Reverse(byteArray, 4, 4);
- Array.Reverse(byteArray, 8, 4);
- }
-
- return byteArray;
- }
-
- public override string ToString()
- {
- return X.ToString() + " " + Y.ToString() + " " + Z.ToString();
- }
-
- public override int GetHashCode()
- {
- int x = (int)X;
- int y = (int)Y;
- int z = (int)Z;
-
- return (x ^ y ^ z);
- }
-
- public override bool Equals(object o)
- {
- if (!(o is LLVector3)) return false;
-
- LLVector3 vector = (LLVector3)o;
-
- return (X == vector.X && Y == vector.Y && Z == vector.Z);
- }
-
- public static bool operator==(LLVector3 lhs, LLVector3 rhs)
- {
- if(object.ReferenceEquals(lhs, rhs)) return true;
- if(object.ReferenceEquals(lhs, null)) return false;
- if(object.ReferenceEquals(rhs, null)) return false;
-
- return (lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z);
- }
-
- public static bool operator!=(LLVector3 lhs, LLVector3 rhs)
- {
- return !(lhs == rhs);
- }
- }
-
- public class LLVector3d
- {
- public double X;
- public double Y;
- public double Z;
-
- public LLVector3d()
- {
- X = Y = Z = 0.0D;
- }
-
- public LLVector3d(double x, double y, double z)
- {
- X = x;
- Y = y;
- Z = z;
- }
-
- public LLVector3d(byte[] byteArray, int pos)
- {
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, pos, 8);
- Array.Reverse(byteArray, pos + 8, 8);
- Array.Reverse(byteArray, pos + 16, 8);
- }
-
- X = BitConverter.ToDouble(byteArray, pos);
- Y = BitConverter.ToDouble(byteArray, pos + 8);
- Z = BitConverter.ToDouble(byteArray, pos + 16);
- }
-
- public byte[] GetBytes()
- {
- byte[] byteArray = new byte[24];
-
- Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 8);
- Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 8, 8);
- Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 16, 8);
-
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, 0, 8);
- Array.Reverse(byteArray, 8, 8);
- Array.Reverse(byteArray, 16, 8);
- }
-
- return byteArray;
- }
-
- public override string ToString()
- {
- return X.ToString() + " " + Y.ToString() + " " + Z.ToString();
- }
- }
-
- public class LLVector4
- {
- public float X;
- public float Y;
- public float Z;
- public float S;
-
- public LLVector4()
- {
- X = Y = Z = S = 0.0F;
- }
-
- public LLVector4(byte[] byteArray, int pos)
- {
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, pos, 4);
- Array.Reverse(byteArray, pos + 4, 4);
- Array.Reverse(byteArray, pos + 8, 4);
- Array.Reverse(byteArray, pos + 12, 4);
- }
-
- X = BitConverter.ToSingle(byteArray, pos);
- Y = BitConverter.ToSingle(byteArray, pos + 4);
- Z = BitConverter.ToSingle(byteArray, pos + 8);
- S = BitConverter.ToSingle(byteArray, pos + 12);
- }
-
- public byte[] GetBytes()
- {
- byte[] byteArray = new byte[16];
-
- Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 4);
- Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4);
- Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4);
- Array.Copy(BitConverter.GetBytes(S), 0, byteArray, 12, 4);
-
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, 0, 4);
- Array.Reverse(byteArray, 4, 4);
- Array.Reverse(byteArray, 8, 4);
- Array.Reverse(byteArray, 12, 4);
- }
-
- return byteArray;
- }
-
- public override string ToString()
- {
- return X.ToString() + " " + Y.ToString() + " " + Z.ToString() + " " + S.ToString();
- }
- }
-
- public class LLQuaternion
- {
- public float X;
- public float Y;
- public float Z;
- public float W;
-
- public LLQuaternion()
- {
- X = Y = Z = W = 0.0F;
- }
-
- public LLQuaternion(byte[] byteArray, int pos)
- {
- if(!BitConverter.IsLittleEndian) {
- Array.Reverse(byteArray, pos,4);
- Array.Reverse(byteArray, pos + 4, 4);
- Array.Reverse(byteArray, pos + 8, 4);
- }
-
- X = BitConverter.ToSingle(byteArray, pos);
- Y = BitConverter.ToSingle(byteArray, pos + 4);
+/*
+ * Copyright (c) 2006, Second Life Reverse Engineering Team
+ * 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 Second Life Reverse Engineering Team 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.
+ */
+
+using System;
+using System.Net;
+
+namespace libsecondlife
+{
+ public class U64
+ {
+ public uint[] Data;
+
+ public U64()
+ {
+ Data = new uint[2];
+ Data[0] = 0;
+ Data[1] = 1;
+ }
+
+ public U64(uint left, uint right)
+ {
+ Data = new uint[2];
+ // "backwards", due to little-endian ordering
+ Data[0] = right;
+ Data[1] = left;
+ }
+
+ public U64(int left, int right)
+ {
+ Data = new uint[2];
+ // "backwards", due to little-endian ordering
+ Data[0] = (uint)right;
+ Data[1] = (uint)left;
+ }
+
+ public U64(byte[] bA, int pos)
+ {
+ Data = new uint[2];
+ Data[0] = (uint)(bA[pos] + (bA[pos+1]<<8) + (bA[pos+2]<<16) + (bA[pos+3]<<24));
+ Data[1] = (uint)(bA[pos+4] + (bA[pos+5]<<8) + (bA[pos+6]<<16) + (bA[pos+7]<<24));
+ }
+
+ public byte[] GetBytes()
+ {
+ byte[] bA = new byte[8];
+
+ bA[0]=(byte)((Data[0]) %256); bA[1]=(byte)((Data[0]>>8) %256);
+ bA[2]=(byte)((Data[0]>>16)%256); bA[3]=(byte)((Data[0]>>24)%256);
+ bA[4]=(byte)((Data[1]) %256); bA[5]=(byte)((Data[1]>>8) %256);
+ bA[6]=(byte)((Data[1]>>16)%256); bA[7]=(byte)((Data[1]>>24)%256);
+
+ return bA;
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)(Data[0] ^ Data[1]);
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is U64)) return false;
+
+ U64 u64 = (U64)o;
+
+ return (u64.Data[0] == Data[0] && u64.Data[1] == Data[1]);
+ }
+
+ public static bool operator==(U64 lhs, U64 rhs)
+ {
+ if(object.ReferenceEquals(lhs, rhs)) return true;
+ if(object.ReferenceEquals(lhs, null)) return false;
+ if(object.ReferenceEquals(rhs, null)) return false;
+
+ return (lhs.Data[0] == rhs.Data[0] && lhs.Data[1] == rhs.Data[1]);
+ }
+
+ public static bool operator!=(U64 lhs, U64 rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ public static bool operator==(U64 lhs, int rhs)
+ {
+ if(object.ReferenceEquals(lhs, null)) return (rhs == 0);
+ /* this used to ignore the upper half of the U64, and I don't think
+ that's correct. */
+ return (lhs.Data[0] == 0 && lhs.Data[1] == rhs);
+ }
+
+ public static bool operator!=(U64 lhs, int rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ public override string ToString()
+ {
+ ulong u64 = (Data[1] << 32) + Data[0];
+ return u64.ToString();
+ }
+ }
+
+ public class LLUUID
+ {
+ private byte[] data = null;
+ public byte[] Data
+ {
+ get { return data; }
+ }
+
+ public LLUUID()
+ {
+ data = new byte[16];
+ }
+
+ public LLUUID(string val)
+ {
+ data = new byte[16];
+
+ if (val.Length == 36) val = val.Replace("-", "");
+
+ if (val.Length != 32) return;
+
+ for(int i = 0; i < 16; ++i)
+ {
+ data[i] = Convert.ToByte(val.Substring(i * 2, 2), 16);
+ }
+ }
+
+ public LLUUID(byte[] byteArray, int pos)
+ {
+ data = new byte[16];
+
+ Array.Copy(byteArray, pos, data, 0, 16);
+ }
+
+ public LLUUID(bool randomize)
+ {
+ if (randomize) data = Guid.NewGuid().ToByteArray();
+ else data = new byte[16];
+ }
+
+ ///
+ /// Calculate an LLCRC for the given LLUUID
+ ///
+ /// The LLUUID to calculate the CRC value for
+ /// The CRC checksum for this LLUUID
+ public uint CRC()
+ {
+ uint retval = 0;
+
+ retval += (uint)((Data[3] << 24) + (Data[2] << 16) + (Data[1] << 8) + Data[0]);
+ retval += (uint)((Data[7] << 24) + (Data[6] << 16) + (Data[5] << 8) + Data[4]);
+ retval += (uint)((Data[11] << 24) + (Data[10] << 16) + (Data[9] << 8) + Data[8]);
+ retval += (uint)((Data[15] << 24) + (Data[14] << 16) + (Data[13] << 8) + Data[12]);
+
+ return retval;
+ }
+
+ public static LLUUID GenerateUUID()
+ {
+ return new LLUUID(Guid.NewGuid().ToByteArray(), 0);
+ }
+
+ public override int GetHashCode()
+ {
+ return ToString().GetHashCode();
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is LLUUID)) return false;
+
+ LLUUID uuid = (LLUUID)o;
+
+ for (int i = 0; i < 16; ++i)
+ {
+ if (Data[i] != uuid.Data[i]) return false;
+ }
+
+ return true;
+ }
+
+ public static bool operator==(LLUUID lhs, LLUUID rhs)
+ {
+ if(object.ReferenceEquals(lhs, rhs)) return true;
+ if(object.ReferenceEquals(lhs, null)) return false;
+ if(object.ReferenceEquals(rhs, null)) return false;
+
+ for (int i = 0; i < 16; ++i)
+ {
+ if (lhs.Data[i] != rhs.Data[i]) return false;
+ }
+
+ return true;
+ }
+
+ public static bool operator!=(LLUUID lhs, LLUUID rhs)
+ {
+ return !(lhs == rhs);
+ }
+
+ public static implicit operator LLUUID(string val)
+ {
+ return new LLUUID(val);
+ }
+
+ public override string ToString()
+ {
+ string uuid = "";
+
+ for (int i = 0; i < 16; ++i)
+ {
+ uuid += Data[i].ToString("x2");
+ }
+
+ return uuid;
+ }
+
+ public string ToStringHyphenated()
+ {
+ string uuid = "";
+
+ for (int i = 0; i < 16; ++i)
+ {
+ uuid += Data[i].ToString("x2");
+
+ }
+ uuid = uuid.Insert(20,"-");
+ uuid = uuid.Insert(16,"-");
+ uuid = uuid.Insert(12,"-");
+ uuid = uuid.Insert(8,"-");
+
+
+ return uuid;
+ }
+ }
+
+ public class LLVector3
+ {
+ public float X;
+ public float Y;
+ public float Z;
+
+ public LLVector3()
+ {
+ X = Y = Z = 0.0F;
+ }
+
+ public LLVector3(LLVector3d vector)
+ {
+ X = (float)vector.X;
+ Y = (float)vector.Y;
+ Z = (float)vector.Z;
+ }
+
+ public LLVector3(byte[] byteArray, int pos)
+ {
+ if(!BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(byteArray, pos, 4);
+ Array.Reverse(byteArray, pos + 4, 4);
+ Array.Reverse(byteArray, pos + 8, 4);
+ }
+
+ X = BitConverter.ToSingle(byteArray, pos);
+ Y = BitConverter.ToSingle(byteArray, pos + 4);
+ Z = BitConverter.ToSingle(byteArray, pos + 8);
+ }
+
+ public LLVector3(float x, float y, float z)
+ {
+ X = x;
+ Y = y;
+ Z = z;
+ }
+
+ public byte[] GetBytes()
+ {
+ byte[] byteArray = new byte[12];
+
+ Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 4);
+ Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4);
+ Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4);
+
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, 0, 4);
+ Array.Reverse(byteArray, 4, 4);
+ Array.Reverse(byteArray, 8, 4);
+ }
+
+ return byteArray;
+ }
+
+ public override string ToString()
+ {
+ return X.ToString() + " " + Y.ToString() + " " + Z.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ int x = (int)X;
+ int y = (int)Y;
+ int z = (int)Z;
+
+ return (x ^ y ^ z);
+ }
+
+ public override bool Equals(object o)
+ {
+ if (!(o is LLVector3)) return false;
+
+ LLVector3 vector = (LLVector3)o;
+
+ return (X == vector.X && Y == vector.Y && Z == vector.Z);
+ }
+
+ public static bool operator==(LLVector3 lhs, LLVector3 rhs)
+ {
+ if(object.ReferenceEquals(lhs, rhs)) return true;
+ if(object.ReferenceEquals(lhs, null)) return false;
+ if(object.ReferenceEquals(rhs, null)) return false;
+
+ return (lhs.X == rhs.X && lhs.Y == rhs.Y && lhs.Z == rhs.Z);
+ }
+
+ public static bool operator!=(LLVector3 lhs, LLVector3 rhs)
+ {
+ return !(lhs == rhs);
+ }
+ }
+
+ public class LLVector3d
+ {
+ public double X;
+ public double Y;
+ public double Z;
+
+ public LLVector3d()
+ {
+ X = Y = Z = 0.0D;
+ }
+
+ public LLVector3d(double x, double y, double z)
+ {
+ X = x;
+ Y = y;
+ Z = z;
+ }
+
+ public LLVector3d(byte[] byteArray, int pos)
+ {
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, pos, 8);
+ Array.Reverse(byteArray, pos + 8, 8);
+ Array.Reverse(byteArray, pos + 16, 8);
+ }
+
+ X = BitConverter.ToDouble(byteArray, pos);
+ Y = BitConverter.ToDouble(byteArray, pos + 8);
+ Z = BitConverter.ToDouble(byteArray, pos + 16);
+ }
+
+ public byte[] GetBytes()
+ {
+ byte[] byteArray = new byte[24];
+
+ Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 8);
+ Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 8, 8);
+ Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 16, 8);
+
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, 0, 8);
+ Array.Reverse(byteArray, 8, 8);
+ Array.Reverse(byteArray, 16, 8);
+ }
+
+ return byteArray;
+ }
+
+ public override string ToString()
+ {
+ return X.ToString() + " " + Y.ToString() + " " + Z.ToString();
+ }
+ }
+
+ public class LLVector4
+ {
+ public float X;
+ public float Y;
+ public float Z;
+ public float S;
+
+ public LLVector4()
+ {
+ X = Y = Z = S = 0.0F;
+ }
+
+ public LLVector4(byte[] byteArray, int pos)
+ {
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, pos, 4);
+ Array.Reverse(byteArray, pos + 4, 4);
+ Array.Reverse(byteArray, pos + 8, 4);
+ Array.Reverse(byteArray, pos + 12, 4);
+ }
+
+ X = BitConverter.ToSingle(byteArray, pos);
+ Y = BitConverter.ToSingle(byteArray, pos + 4);
+ Z = BitConverter.ToSingle(byteArray, pos + 8);
+ S = BitConverter.ToSingle(byteArray, pos + 12);
+ }
+
+ public byte[] GetBytes()
+ {
+ byte[] byteArray = new byte[16];
+
+ Array.Copy(BitConverter.GetBytes(X), 0, byteArray, 0, 4);
+ Array.Copy(BitConverter.GetBytes(Y), 0, byteArray, 4, 4);
+ Array.Copy(BitConverter.GetBytes(Z), 0, byteArray, 8, 4);
+ Array.Copy(BitConverter.GetBytes(S), 0, byteArray, 12, 4);
+
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, 0, 4);
+ Array.Reverse(byteArray, 4, 4);
+ Array.Reverse(byteArray, 8, 4);
+ Array.Reverse(byteArray, 12, 4);
+ }
+
+ return byteArray;
+ }
+
+ public override string ToString()
+ {
+ return X.ToString() + " " + Y.ToString() + " " + Z.ToString() + " " + S.ToString();
+ }
+ }
+
+ public class LLQuaternion
+ {
+ public float X;
+ public float Y;
+ public float Z;
+ public float W;
+
+ public LLQuaternion()
+ {
+ X = Y = Z = W = 0.0F;
+ }
+
+ public LLQuaternion(byte[] byteArray, int pos)
+ {
+ if(!BitConverter.IsLittleEndian) {
+ Array.Reverse(byteArray, pos,4);
+ Array.Reverse(byteArray, pos + 4, 4);
+ Array.Reverse(byteArray, pos + 8, 4);
+ }
+
+ X = BitConverter.ToSingle(byteArray, pos);
+ Y = BitConverter.ToSingle(byteArray, pos + 4);
Z = BitConverter.ToSingle(byteArray, pos + 8);
float xyzsum = 1 - X * X - Y * Y - Z * Z;
- W = (xyzsum > 0) ? (float)Math.Sqrt(xyzsum) : 0;
- }
-
- public LLQuaternion(float x, float y, float z, float w)
- {
- X = x;
- Y = y;
- Z = z;
- W = w;
- }
-
- public byte[] GetBytes()
+ W = (xyzsum > 0) ? (float)Math.Sqrt(xyzsum) : 0;
+ }
+
+ public LLQuaternion(float x, float y, float z, float w)
+ {
+ X = x;
+ Y = y;
+ Z = z;
+ W = w;
+ }
+
+ public byte[] GetBytes()
{
byte[] bytes = new byte[12];
float norm;
@@ -522,109 +522,109 @@ namespace libsecondlife
throw new Exception("Quaternion <" + X + "," + Y + "," + Z + "," + W + "> normalized to zero");
}
- return bytes;
- }
-
- public override string ToString()
- {
- return "<" + X.ToString() + " " + Y.ToString() + " " + Z.ToString() + " " + W.ToString() + ">";
- }
- }
-
- public class DataConvert
- {
- private static byte[] ba;
-
- public static float toFloat(object Data, int offset)
- {
- ba = (byte[])Data;
- if(!BitConverter.IsLittleEndian)
- Array.Reverse(ba, offset, 4);
- return BitConverter.ToSingle(ba, offset);
- }
-
- public static float toFloat(object Data)
- {
- return toFloat(Data, 0);
- }
-
- public static double toDouble(object Data, int offset)
- {
- ba = (byte[])Data;
- if(!BitConverter.IsLittleEndian)
- Array.Reverse(ba, offset, 8);
- return BitConverter.ToDouble(ba, offset);
- }
-
- public static double toDouble(object Data)
- {
- return toDouble(Data, 0);
- }
-
- public static byte toU8(object Data, int offset)
- {
- ba = (byte[])Data;
- return ba[offset];
- }
-
- public static byte toU8(object Data)
- {
- return toU8(Data,0);
- }
-
- public static ushort toU16(object Data, int offset)
- {
- return (ushort)(toU8(Data,0) | (ushort)toU8(Data,1) << 8);
- }
-
- public static ushort toU16(object Data)
- {
- return toU16(Data, 0);
- }
-
- public static uint toU32(object Data, int offset)
- {
- return ((uint)(toU16(Data,0)) | ((uint)(toU16(Data,2) << 16)));
- }
-
- public static uint toU32(object Data)
- {
- return toU32(Data, 0);
- }
-
- public static String toChoppedString(object Data)
- {
- return System.Text.Encoding.UTF8.GetString((byte[])Data).Replace("\0", "");
- }
-
- public static byte[] from(byte data) {
- return new byte[1]{data};
- }
-
- public static byte[] from(ushort data) {
- return new byte[2]{(byte)(data%256),(byte)(data>>8)};
- }
-
- public static byte[] from(uint data) {
- return new byte[4] {(byte) (data%256),(byte)((data>> 8)%256),
- (byte)((data>>16)%256),(byte)((data>>24)%256)};
- }
-
- public static byte[] from(float data)
- {
- ba = BitConverter.GetBytes(data);
- if(!BitConverter.IsLittleEndian)
- Array.Reverse(ba, 0, 4);
- return ba;
- }
-
- public static byte[] from(double data)
- {
- ba = BitConverter.GetBytes(data);
- if(!BitConverter.IsLittleEndian)
- Array.Reverse(ba, 0, 8);
- return ba;
- }
-
- }
-}
+ return bytes;
+ }
+
+ public override string ToString()
+ {
+ return "<" + X.ToString() + " " + Y.ToString() + " " + Z.ToString() + " " + W.ToString() + ">";
+ }
+ }
+
+ public class DataConvert
+ {
+ private static byte[] ba;
+
+ public static float toFloat(object Data, int offset)
+ {
+ ba = (byte[])Data;
+ if(!BitConverter.IsLittleEndian)
+ Array.Reverse(ba, offset, 4);
+ return BitConverter.ToSingle(ba, offset);
+ }
+
+ public static float toFloat(object Data)
+ {
+ return toFloat(Data, 0);
+ }
+
+ public static double toDouble(object Data, int offset)
+ {
+ ba = (byte[])Data;
+ if(!BitConverter.IsLittleEndian)
+ Array.Reverse(ba, offset, 8);
+ return BitConverter.ToDouble(ba, offset);
+ }
+
+ public static double toDouble(object Data)
+ {
+ return toDouble(Data, 0);
+ }
+
+ public static byte toU8(object Data, int offset)
+ {
+ ba = (byte[])Data;
+ return ba[offset];
+ }
+
+ public static byte toU8(object Data)
+ {
+ return toU8(Data,0);
+ }
+
+ public static ushort toU16(object Data, int offset)
+ {
+ return (ushort)(toU8(Data,0) | (ushort)toU8(Data,1) << 8);
+ }
+
+ public static ushort toU16(object Data)
+ {
+ return toU16(Data, 0);
+ }
+
+ public static uint toU32(object Data, int offset)
+ {
+ return ((uint)(toU16(Data,0)) | ((uint)(toU16(Data,2) << 16)));
+ }
+
+ public static uint toU32(object Data)
+ {
+ return toU32(Data, 0);
+ }
+
+ public static String toChoppedString(object Data)
+ {
+ return System.Text.Encoding.UTF8.GetString((byte[])Data).Replace("\0", "");
+ }
+
+ public static byte[] from(byte data) {
+ return new byte[1]{data};
+ }
+
+ public static byte[] from(ushort data) {
+ return new byte[2]{(byte)(data%256),(byte)(data>>8)};
+ }
+
+ public static byte[] from(uint data) {
+ return new byte[4] {(byte) (data%256),(byte)((data>> 8)%256),
+ (byte)((data>>16)%256),(byte)((data>>24)%256)};
+ }
+
+ public static byte[] from(float data)
+ {
+ ba = BitConverter.GetBytes(data);
+ if(!BitConverter.IsLittleEndian)
+ Array.Reverse(ba, 0, 4);
+ return ba;
+ }
+
+ public static byte[] from(double data)
+ {
+ ba = BitConverter.GetBytes(data);
+ if(!BitConverter.IsLittleEndian)
+ Array.Reverse(ba, 0, 8);
+ return ba;
+ }
+
+ }
+}
diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs
index 16cac018..e868862c 100644
--- a/libsecondlife-cs/ObjectManager.cs
+++ b/libsecondlife-cs/ObjectManager.cs
@@ -512,7 +512,7 @@ namespace libsecondlife
packet.ObjectData.RayTargetID = LLUUID.Zero;
packet.ObjectData.BypassRaycast = 1;
- packet.ObjectData.TextureEntry = prim.Textures.ToBytes();
+ packet.ObjectData.TextureEntry = prim.Textures.GetBytes();
Client.Network.SendPacket(packet, simulator);
}
diff --git a/libsecondlife-cs/ParticleSystem.cs b/libsecondlife-cs/ParticleSystem.cs
index d2485aa8..83e84afa 100644
--- a/libsecondlife-cs/ParticleSystem.cs
+++ b/libsecondlife-cs/ParticleSystem.cs
@@ -9,44 +9,22 @@ namespace libsecondlife
///
public class ParticleSystem
{
- public uint PartStartRGBA;
- public uint PartEndRGBA;
-
- public LLVector3 PartStartScale = LLVector3.Zero;
- public LLVector3 PartEndScale = LLVector3.Zero;
-
- public float PartMaxAge;
- public float SrcMaxAge;
-
- public LLVector3 SrcAccel = LLVector3.Zero;
-
- public float SrcAngleBegin;
- public float SrcAngleEnd;
-
- public int SrcBurstPartCount;
- public float SrcBurstRadius;
- public float SrcBurstRate;
- public float SrcBurstSpeedMin;
- public float SrcBurstSpeedMax;
-
- public LLVector3 SrcOmega = LLVector3.Zero;
-
- public LLUUID SrcTargetKey = LLUUID.Zero;
- public LLUUID SrcTexture = LLUUID.Zero;
-
- public SourcePattern SrcPattern;
- public ParticleFlags PartFlags;
-
- public uint Version; //???
- public uint StartTick; //???
-
+ ///
+ ///
+ ///
public enum SourcePattern : byte
{
+ ///
None = 0,
+ ///
Drop = 0x01,
+ ///
Explode = 0x02,
+ ///
Angle = 0x04,
+ ///
AngleCone = 0x08,
+ ///
AngleConeEmpty = 0x10
}
@@ -56,18 +34,71 @@ namespace libsecondlife
[Flags]
public enum ParticleFlags : ushort
{
+ ///
None = 0,
+ ///
InterpColor = 0x001,
+ ///
InterpScale = 0x002,
+ ///
Bounce = 0x004,
+ ///
Wind = 0x008,
+ ///
FollowSrc = 0x010,
+ ///
FollowVelocity = 0x20,
+ ///
TargetPos = 0x40,
+ ///
TargetLinear = 0x080,
+ ///
Emissive = 0x100
}
+ ///
+ public uint PartStartRGBA;
+ ///
+ public uint PartEndRGBA;
+ ///
+ public LLVector3 PartStartScale = LLVector3.Zero;
+ ///
+ public LLVector3 PartEndScale = LLVector3.Zero;
+ ///
+ public float PartMaxAge;
+ ///
+ public float SrcMaxAge;
+ ///
+ public LLVector3 SrcAccel = LLVector3.Zero;
+ ///
+ public float SrcAngleBegin;
+ ///
+ public float SrcAngleEnd;
+ ///
+ public int SrcBurstPartCount;
+ ///
+ public float SrcBurstRadius;
+ ///
+ public float SrcBurstRate;
+ ///
+ public float SrcBurstSpeedMin;
+ ///
+ public float SrcBurstSpeedMax;
+ ///
+ public LLVector3 SrcOmega = LLVector3.Zero;
+ ///
+ public LLUUID SrcTargetKey = LLUUID.Zero;
+ /// Texture that will be applied to the particles
+ public LLUUID SrcTexture = LLUUID.Zero;
+ ///
+ public SourcePattern SrcPattern;
+ /// Various options that describe the behavior of this system
+ public ParticleFlags PartFlags;
+ /// Unknown
+ public uint Version;
+ /// Unknown
+ public uint StartTick;
+
///
///
///
@@ -85,6 +116,27 @@ namespace libsecondlife
FromBytes(data, pos);
}
+ public byte[] GetBytes()
+ {
+ byte[] bytes = new byte[0];
+ // FIXME: Finish ParticleSystem.GetBytes()
+ return bytes;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetXml(string name)
+ {
+ string xml = "";
+ // FIXME: Finish ParticleSystem.GetXml()
+ xml += "";
+
+ return xml;
+ }
+
///
///
///
diff --git a/libsecondlife-cs/Prims.cs b/libsecondlife-cs/Prims.cs
index 2e86e8b3..eb56abac 100644
--- a/libsecondlife-cs/Prims.cs
+++ b/libsecondlife-cs/Prims.cs
@@ -25,6 +25,7 @@
*/
using System;
+using System.Xml;
namespace libsecondlife
{
@@ -84,29 +85,29 @@ namespace libsecondlife
///
public int PathTwist = 0;
///
+ public uint ProfileHollow = 0;
+ ///
+ public float PathRevolutions = 0;
+ ///
+ public LLQuaternion Rotation = LLQuaternion.Identity;
+ ///
+ public uint State;
+ ///
+ public string Text;
+ ///
public ObjectManager.PCode PCode;
///
+ public ObjectFlags Flags;
+ ///
public TextureEntry Textures;
///
public TextureAnimation TextureAnim;
- ///
- public uint ProfileHollow = 0;
- ///
- public float PathRevolutions = 0;
- ///
- public LLQuaternion Rotation = LLQuaternion.Identity;
- ///
- public uint State;
- ///
- public string Text;
///
public PrimFlexibleData Flexible;
///
public PrimLightData Light;
///
public ParticleSystem ParticleSys;
- ///
- public ObjectFlags Flags;
private SecondLife Client;
@@ -404,22 +405,80 @@ namespace libsecondlife
return totalLength;
}
+ ///
+ ///
+ ///
+ ///
+ public string GetXml()
+ {
+ string xml = "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += Position.GetXml("Position");
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += Scale.GetXml("Scale");
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += Rotation.GetXml("Rotation");
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += Textures.GetXml("Textures");
+ xml += TextureAnim.GetXml("TextureAnim");
+ xml += Flexible.GetXml("Flexible");
+ xml += Light.GetXml("Light");
+ xml += ParticleSys.GetXml("ParticleSys");
+ xml += "";
+
+ return xml;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static PrimObject FromXml(XmlNode primXml)
+ {
+ // FIXME: Finish PrimObject.FromXml()
+ return null;
+ }
+
public override string ToString()
{
string output = "";
- output += (Name != "") ? Name : "Unnamed";
- output += ": " + ((Description != "") ? Description : "No description") + Environment.NewLine;
- output += "ID: " + ID + Environment.NewLine;
- output += "GroupID: " + GroupID + Environment.NewLine;
- output += "ParentID: " + ParentID + Environment.NewLine;
- output += "LocalID: " + LocalID + Environment.NewLine;
- output += "Flags: " + Flags + Environment.NewLine;
- output += "State: " + State + Environment.NewLine;
- output += "PCode: " + PCode + Environment.NewLine;
- output += "Material: " + Material + Environment.NewLine;
- output += "PathBegin: " + PathBegin + Environment.NewLine;
- output += "PathEnd: " + PathEnd + Environment.NewLine;
+ output += (Name.Length != 0) ? Name : "Unnamed";
+ output += ": " + ((Description.Length != 0) ? Description : "No description") + Environment.NewLine;
+ output += "ID: " + ID + ", ";
+ output += "GroupID: " + GroupID + ", ";
+ output += "ParentID: " + ParentID + ", ";
+ output += "LocalID: " + LocalID + ", ";
+ output += "Flags: " + Flags + ", ";
+ output += "State: " + State + ", ";
+ output += "PCode: " + PCode + ", ";
+ output += "Material: " + Material + ", ";
return output;
}
@@ -489,7 +548,7 @@ namespace libsecondlife
///
///
///
- public byte[] ToBytes()
+ public byte[] GetBytes()
{
byte[] data = new byte[16];
int i = 0;
@@ -519,6 +578,24 @@ namespace libsecondlife
Wind = data[i++] / 10.0f;
Force = new LLVector3(data, i);
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetXml(string name)
+ {
+ string xml = "<" + name + ">";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "" + name + ">";
+
+ return xml;
+ }
}
///
@@ -556,7 +633,7 @@ namespace libsecondlife
///
///
///
- public byte[] ToBytes()
+ public byte[] GetBytes()
{
byte[] data = new byte[16];
int i = 0;
@@ -578,6 +655,23 @@ namespace libsecondlife
return data;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetXml(string name)
+ {
+ string xml = "<" + name + ">";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "";
+ xml += "" + name + ">";
+
+ return xml;
+ }
+
private void FromBytes(byte[] data, int pos)
{
int i = pos;
diff --git a/libsecondlife-cs/Textures.cs b/libsecondlife-cs/Textures.cs
index b06234f2..dcb18f85 100644
--- a/libsecondlife-cs/Textures.cs
+++ b/libsecondlife-cs/Textures.cs
@@ -138,7 +138,7 @@ namespace libsecondlife
///
///
///
- public byte[] ToBytes()
+ public byte[] GetBytes()
{
if (DefaultTexture == null)
{
@@ -248,7 +248,7 @@ namespace libsecondlife
binWriter.Write(DefaultTexture.TextureID.Data);
foreach (KeyValuePair kv in TextureIDs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key.Data);
}
@@ -256,7 +256,7 @@ namespace libsecondlife
binWriter.Write(DefaultTexture.RGBA);
foreach (KeyValuePair kv in RGBAs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -264,7 +264,7 @@ namespace libsecondlife
binWriter.Write(RepeatShort(DefaultTexture.RepeatU));
foreach (KeyValuePair kv in RepeatUs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -272,7 +272,7 @@ namespace libsecondlife
binWriter.Write(RepeatShort(DefaultTexture.RepeatV));
foreach (KeyValuePair kv in RepeatVs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -280,7 +280,7 @@ namespace libsecondlife
binWriter.Write(OffsetShort(DefaultTexture.OffsetU));
foreach (KeyValuePair kv in OffsetUs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -288,7 +288,7 @@ namespace libsecondlife
binWriter.Write(OffsetShort(DefaultTexture.OffsetV));
foreach (KeyValuePair kv in OffsetVs)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -296,7 +296,7 @@ namespace libsecondlife
binWriter.Write(RotationShort(DefaultTexture.Rotation));
foreach (KeyValuePair kv in Rotations)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -304,7 +304,7 @@ namespace libsecondlife
binWriter.Write(DefaultTexture.Flags1);
foreach (KeyValuePair kv in Flag1s)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
@@ -312,14 +312,14 @@ namespace libsecondlife
binWriter.Write(DefaultTexture.Flags2);
foreach (KeyValuePair kv in Flag2s)
{
- binWriter.Write(FaceBitfieldToBytes(kv.Value));
+ binWriter.Write(GetFaceBitfieldBytes(kv.Value));
binWriter.Write(kv.Key);
}
return memStream.GetBuffer();
}
- private byte[] FaceBitfieldToBytes(uint bitfield)
+ private byte[] GetFaceBitfieldBytes(uint bitfield)
{
int byteLength = 0;
uint tmpBitfield = bitfield;
@@ -342,6 +342,20 @@ namespace libsecondlife
return bytes;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetXml(string name)
+ {
+ string xml = "";
+ // FIXME: Write GetXml for TextureEntry
+ xml += "";
+
+ return xml;
+ }
+
private bool ReadFaceBitfield(byte[] data, ref int pos, ref uint faceBits, ref uint bitfieldSize)
{
faceBits = 0;
@@ -792,12 +806,33 @@ namespace libsecondlife
///
///
///
- public byte[] ToBytes()
+ public byte[] GetBytes()
{
byte[] bytes = new byte[0];
+ // FIXME: Finish TextureAnimation GetBytes() function
return bytes;
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ public string GetXml(string name)
+ {
+ string xml = "";
+ xml += "" + Flags + "";
+ xml += "" + Face + "";
+ xml += "" + SizeX + "";
+ xml += "" + SizeY + "";
+ xml += "" + Start + "";
+ xml += "" + Length + "";
+ xml += "" + Rate + "";
+ xml += "";
+
+ return xml;
+ }
+
private void FromBytes(byte[] data, int pos)
{
int i = pos;
diff --git a/libsecondlife-cs/Types.cs b/libsecondlife-cs/Types.cs
index 8b6de1b2..3f8f6f84 100644
--- a/libsecondlife-cs/Types.cs
+++ b/libsecondlife-cs/Types.cs
@@ -346,6 +346,16 @@ namespace libsecondlife
return byteArray;
}
+ ///
+ /// Convert to a single xml node
+ ///
+ /// The desired name of the xml node
+ /// A line of xml data containing the values for this data type
+ public string GetXml(string name)
+ {
+ return "<" + name + " x=\"" + X + "\" y=\"" + Y + "\" z=\"" + Z + "\" />";
+ }
+
///
///
///
@@ -746,6 +756,16 @@ namespace libsecondlife
return bytes;
}
+ ///
+ /// Convert to a single xml node
+ ///
+ /// The desired name of the xml node
+ /// A line of xml data containing the values for this data type
+ public string GetXml(string name)
+ {
+ return "<" + name + " x=\"" + X + "\" y=\"" + Y + "\" z=\"" + Z + "\" w=\"" + W + "\" />";
+ }
+
public override int GetHashCode()
{
float sum = X + Y + Z + W;
diff --git a/libsecondlife-cs/examples/Teleport/Teleport.cs b/libsecondlife-cs/examples/Teleport/Teleport.cs
index f6f4f457..19b5ca78 100644
--- a/libsecondlife-cs/examples/Teleport/Teleport.cs
+++ b/libsecondlife-cs/examples/Teleport/Teleport.cs
@@ -41,7 +41,7 @@ namespace Teleport
if (success)
{
// Get the current sim name
- while (app.Client.Network.CurrentSim.Region.Name == null)
+ while (app.Client.Network.CurrentSim.Region.Name == "")
{
System.Threading.Thread.Sleep(100);
}