diff --git a/SLImageUpload/frmSLImageUpload.cs b/SLImageUpload/frmSLImageUpload.cs index 5ed5ae99..44596f4b 100644 --- a/SLImageUpload/frmSLImageUpload.cs +++ b/SLImageUpload/frmSLImageUpload.cs @@ -65,7 +65,7 @@ namespace SLImageUpload if (this.InvokeRequired) BeginInvoke(new MethodInvoker(UpdateAssetID)); else - txtAssetID.Text = AssetID.ToStringHyphenated(); + txtAssetID.Text = AssetID.ToString(); } private void LoadImage() @@ -234,7 +234,7 @@ namespace SLImageUpload if (eventSuccess && lookupSuccess) { - Client.Log("Will send uploaded image to avatar " + SendToID.ToStringHyphenated(), Helpers.LogLevel.Info); + Client.Log("Will send uploaded image to avatar " + SendToID.ToString(), Helpers.LogLevel.Info); } else { @@ -275,24 +275,24 @@ namespace SLImageUpload item.Permissions.NextOwnerMask = PermissionMask.All; Client.Inventory.RequestUpdateItem(item); - Client.Log("Created inventory item " + itemID.ToStringHyphenated(), Helpers.LogLevel.Info); - MessageBox.Show("Created inventory item " + itemID.ToStringHyphenated()); + Client.Log("Created inventory item " + itemID.ToString(), Helpers.LogLevel.Info); + MessageBox.Show("Created inventory item " + itemID.ToString()); // FIXME: We should be watching the callback for RequestUpdateItem instead of a dumb sleep System.Threading.Thread.Sleep(2000); if (SendToID != LLUUID.Zero) { - Client.Log("Sending item to " + SendToID.ToStringHyphenated(), Helpers.LogLevel.Info); + Client.Log("Sending item to " + SendToID.ToString(), Helpers.LogLevel.Info); Client.Inventory.GiveItem(itemID, name, AssetType.Texture, SendToID, true); - MessageBox.Show("Sent item to " + SendToID.ToStringHyphenated()); + MessageBox.Show("Sent item to " + SendToID.ToString()); } } else { - Client.DebugLog("Created inventory item " + itemID.ToStringHyphenated() + " but failed to fetch it," + + Client.DebugLog("Created inventory item " + itemID.ToString() + " but failed to fetch it," + " cannot update permissions or send to another avatar"); - MessageBox.Show("Created inventory item " + itemID.ToStringHyphenated() + " but failed to fetch it," + + MessageBox.Show("Created inventory item " + itemID.ToString() + " but failed to fetch it," + " cannot update permissions or send to another avatar"); } } diff --git a/importprimscript/importprimscript.cs b/importprimscript/importprimscript.cs index ea7bc15c..497c820f 100644 --- a/importprimscript/importprimscript.cs +++ b/importprimscript/importprimscript.cs @@ -213,7 +213,7 @@ namespace importprimscript { if (success) { - Console.WriteLine("Finished uploading image " + filename + ", AssetID: " + assetID.ToStringHyphenated()); + Console.WriteLine("Finished uploading image " + filename + ", AssetID: " + assetID.ToString()); newAssetID = assetID; } else diff --git a/libsecondlife/AgentManager.cs b/libsecondlife/AgentManager.cs index 5e019e56..62b660a5 100644 --- a/libsecondlife/AgentManager.cs +++ b/libsecondlife/AgentManager.cs @@ -2133,8 +2133,8 @@ namespace libsecondlife } else { - Client.Log("Got an AgentDataUpdate packet for avatar " + p.AgentData.AgentID.ToStringHyphenated() + - " instead of " + Client.Self.AgentID.ToStringHyphenated() + ", this shouldn't happen", Helpers.LogLevel.Error); + Client.Log("Got an AgentDataUpdate packet for avatar " + p.AgentData.AgentID.ToString() + + " instead of " + Client.Self.AgentID.ToString() + ", this shouldn't happen", Helpers.LogLevel.Error); } } diff --git a/libsecondlife/AppearanceManager.cs b/libsecondlife/AppearanceManager.cs index cdddf874..7f4a08ca 100644 --- a/libsecondlife/AppearanceManager.cs +++ b/libsecondlife/AppearanceManager.cs @@ -426,7 +426,7 @@ namespace libsecondlife } else { - Client.Log("Failed to download folder contents of + " + folder.ToStringHyphenated(), + Client.Log("Failed to download folder contents of + " + folder.ToString(), Helpers.LogLevel.Error); return false; } @@ -847,7 +847,7 @@ namespace libsecondlife face.TextureID = texture.Value; Client.DebugLog("Setting texture " + ((TextureIndex)texture.Key).ToString() + " to " + - texture.Value.ToStringHyphenated()); + texture.Value.ToString()); } } } @@ -978,7 +978,7 @@ namespace libsecondlife LLUUID transactionID = Assets.RequestUpload(bake.BakedTexture, true, true, false); Client.DebugLog(String.Format("Bake {0} completed. Uploading asset {1}", bake.BakeType, - bake.BakedTexture.AssetID.ToStringHyphenated())); + bake.BakedTexture.AssetID.ToString())); // Add it to a pending uploads list lock (PendingUploads) PendingUploads.Add(bake.BakedTexture.AssetID, BakeTypeToAgentTextureIndex(bake.BakeType)); @@ -1038,7 +1038,7 @@ namespace libsecondlife { // For each missing element we need to bake our own texture Client.DebugLog("Cache response, index: " + block.TextureIndex + ", ID: " + - block.TextureID.ToStringHyphenated()); + block.TextureID.ToString()); // FIXME: Use this. Right now we treat baked images on other sims as if they were missing string host = Helpers.FieldToUTF8String(block.HostName); @@ -1181,7 +1181,7 @@ namespace libsecondlife } else { - Client.Log("Wearable " + kvp.Key + "(" + download.AssetID.ToStringHyphenated() + ") failed to download, " + download.Status.ToString(),Helpers.LogLevel.Warning); + Client.Log("Wearable " + kvp.Key + "(" + download.AssetID.ToString() + ") failed to download, " + download.Status.ToString(),Helpers.LogLevel.Warning); } break; @@ -1261,7 +1261,7 @@ namespace libsecondlife } } else - Client.Log("Received an image download callback for an image we did not request " + image.ID.ToStringHyphenated(), Helpers.LogLevel.Warning); + Client.Log("Received an image download callback for an image we did not request " + image.ID.ToString(), Helpers.LogLevel.Warning); } } @@ -1278,11 +1278,11 @@ namespace libsecondlife AgentTextures[(int)index] = upload.AssetID; Client.DebugLog("Upload complete, AgentTextures " + index.ToString() + " set to " + - upload.AssetID.ToStringHyphenated()); + upload.AssetID.ToString()); } else { - Client.Log("Asset upload " + upload.AssetID.ToStringHyphenated() + " failed", + Client.Log("Asset upload " + upload.AssetID.ToString() + " failed", Helpers.LogLevel.Warning); } @@ -1301,7 +1301,7 @@ namespace libsecondlife else { // TEMP - Client.DebugLog("Upload " + upload.AssetID.ToStringHyphenated() + " was not found in PendingUploads"); + Client.DebugLog("Upload " + upload.AssetID.ToString() + " was not found in PendingUploads"); } } } diff --git a/libsecondlife/AssetManager.cs b/libsecondlife/AssetManager.cs index c1e77e8c..e1ff47c6 100644 --- a/libsecondlife/AssetManager.cs +++ b/libsecondlife/AssetManager.cs @@ -595,7 +595,7 @@ namespace libsecondlife { Client.Log( String.Format("Beginning asset upload [Single Packet], ID: {0}, AssetID: {1}, Size: {2}", - upload.ID.ToStringHyphenated(), upload.AssetID.ToStringHyphenated(), upload.Size), + upload.ID.ToString(), upload.AssetID.ToString(), upload.Size), Helpers.LogLevel.Info); // The whole asset will fit in this packet, makes things easy @@ -606,7 +606,7 @@ namespace libsecondlife { Client.Log( String.Format("Beginning asset upload [Multiple Packets], ID: {0}, AssetID: {1}, Size: {2}", - upload.ID.ToStringHyphenated(), upload.AssetID.ToStringHyphenated(), upload.Size), + upload.ID.ToString(), upload.AssetID.ToString(), upload.Size), Helpers.LogLevel.Info); // Asset is too big, send in multiple packets @@ -831,7 +831,7 @@ namespace libsecondlife if (download.Size == 0) { Client.Log("Timed out while waiting for the asset header to download for " + - download.ID.ToStringHyphenated(), Helpers.LogLevel.Warning); + download.ID.ToString(), Helpers.LogLevel.Warning); // Abort the transfer TransferAbortPacket abort = new TransferAbortPacket(); @@ -861,12 +861,12 @@ namespace libsecondlife //Client.DebugLog(String.Format("Transfer packet {0}, received {1}/{2}/{3} bytes for asset {4}", // asset.TransferData.Packet, asset.TransferData.Data.Length, transfer.Transferred, transfer.Size, - // transfer.AssetID.ToStringHyphenated())); + // transfer.AssetID.ToString())); // Check if we downloaded the full asset if (download.Transferred >= download.Size) { - Client.DebugLog("Transfer for asset " + download.AssetID.ToStringHyphenated() + " completed"); + Client.DebugLog("Transfer for asset " + download.AssetID.ToString() + " completed"); download.Success = true; lock (Transfers) Transfers.Remove(download.ID); @@ -921,7 +921,7 @@ namespace libsecondlife upload = (AssetUpload)transfer; //Client.DebugLog(String.Format("ACK for upload {0} of asset type {1} ({2}/{3})", - // upload.AssetID.ToStringHyphenated(), upload.Type, upload.Transferred, upload.Size)); + // upload.AssetID.ToString(), upload.Type, upload.Transferred, upload.Size)); if (OnUploadProgress != null) { @@ -1035,7 +1035,7 @@ namespace libsecondlife if (!String.IsNullOrEmpty(download.Filename)) Client.DebugLog("Xfer download for asset " + download.Filename + " completed"); else - Client.DebugLog("Xfer download for asset " + download.VFileID.ToStringHyphenated() + " completed"); + Client.DebugLog("Xfer download for asset " + download.VFileID.ToString() + " completed"); download.Success = true; lock (Transfers) Transfers.Remove(download.ID); @@ -1070,7 +1070,7 @@ namespace libsecondlife transfer = (ImageDownload)Transfers[data.ImageID.ID]; //Client.DebugLog("Received first " + data.ImageData.Data.Length + " bytes for image " + - // data.ImageID.ID.ToStringHyphenated()); + // data.ImageID.ID.ToString()); transfer.Codec = data.ImageID.Codec; transfer.PacketCount = data.ImageID.Packets; @@ -1124,7 +1124,7 @@ namespace libsecondlife if (transfer.Size == 0) { Client.Log("Timed out while waiting for the image header to download for " + - transfer.ID.ToStringHyphenated(), Helpers.LogLevel.Warning); + transfer.ID.ToString(), Helpers.LogLevel.Warning); transfer.Success = false; Transfers.Remove(transfer.ID); @@ -1138,7 +1138,7 @@ namespace libsecondlife transfer.Transferred += image.ImageData.Data.Length; //Client.DebugLog("Received " + image.ImageData.Data.Length + "/" + transfer.Transferred + - // "/" + transfer.Size + " bytes for image " + image.ImageID.ID.ToStringHyphenated()); + // "/" + transfer.Size + " bytes for image " + image.ImageID.ID.ToString()); // Check if we downloaded the full image if (transfer.Transferred >= transfer.Size) diff --git a/libsecondlife/AssetTypes.cs b/libsecondlife/AssetTypes.cs index 974a1d49..d0341a4a 100644 --- a/libsecondlife/AssetTypes.cs +++ b/libsecondlife/AssetTypes.cs @@ -362,10 +362,10 @@ namespace libsecondlife data.Append("\t\tgroup_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.GroupMask)); data.Append(NL); data.Append("\t\teveryone_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.EveryoneMask)); data.Append(NL); data.Append("\t\tnext_owner_mask\t"); data.Append(Helpers.UIntToHexString((uint)Permissions.NextOwnerMask)); data.Append(NL); - data.Append("\t\tcreator_id\t"); data.Append(Creator.ToStringHyphenated()); data.Append(NL); - data.Append("\t\towner_id\t"); data.Append(Owner.ToStringHyphenated()); data.Append(NL); - data.Append("\t\tlast_owner_id\t"); data.Append(LastOwner.ToStringHyphenated()); data.Append(NL); - data.Append("\t\tgroup_id\t"); data.Append(Group.ToStringHyphenated()); data.Append(NL); + data.Append("\t\tcreator_id\t"); data.Append(Creator.ToString()); data.Append(NL); + data.Append("\t\towner_id\t"); data.Append(Owner.ToString()); data.Append(NL); + data.Append("\t\tlast_owner_id\t"); data.Append(LastOwner.ToString()); data.Append(NL); + data.Append("\t\tgroup_id\t"); data.Append(Group.ToString()); data.Append(NL); if (GroupOwned) data.Append("\t\tgroup_owned\t1\n"); data.Append("\t}\n"); data.Append("\tsale_info\t0\n"); @@ -384,7 +384,7 @@ namespace libsecondlife data.Append("textures "); data.Append(Textures.Count); data.Append(NL); foreach (KeyValuePair texture in Textures) { - data.Append(texture.Key); data.Append(" "); data.Append(texture.Value.ToStringHyphenated()); data.Append(NL); + data.Append(texture.Key); data.Append(" "); data.Append(texture.Value.ToString()); data.Append(NL); } AssetData = Helpers.StringToField(data.ToString()); diff --git a/libsecondlife/Capabilities.cs b/libsecondlife/Capabilities.cs index c9e8ad1e..fd70e9d4 100644 --- a/libsecondlife/Capabilities.cs +++ b/libsecondlife/Capabilities.cs @@ -167,7 +167,7 @@ namespace libsecondlife private void seedRequest_OnCapsResponse(LLSD response, HttpRequestState state) { - if (response.Type == LLSDType.Map) + if (response != null && response.Type == LLSDType.Map) { LLSDMap respTable = (LLSDMap)response; diff --git a/libsecondlife/EstateTools.cs b/libsecondlife/EstateTools.cs index 22ebbe75..d77896c2 100644 --- a/libsecondlife/EstateTools.cs +++ b/libsecondlife/EstateTools.cs @@ -254,7 +254,7 @@ namespace libsecondlife /// Key of Avatar to kick public void KickUser(LLUUID userID) { - EstateOwnerMessage("kickestate", userID.ToStringHyphenated()); + EstateOwnerMessage("kickestate", userID.ToString()); } /// Ban an avatar from an estate @@ -262,9 +262,9 @@ namespace libsecondlife { List listParams = new List(); uint flag = (uint)EstateAccessDelta.BanUser; - listParams.Add(Client.Self.AgentID.ToStringHyphenated()); + listParams.Add(Client.Self.AgentID.ToString()); listParams.Add(flag.ToString()); - listParams.Add(userID.ToStringHyphenated()); + listParams.Add(userID.ToString()); EstateOwnerMessage("estateaccessdelta", listParams); } @@ -273,9 +273,9 @@ namespace libsecondlife { List listParams = new List(); uint flag = (uint)EstateAccessDelta.BanUser; - listParams.Add(Client.Self.AgentID.ToStringHyphenated()); + listParams.Add(Client.Self.AgentID.ToString()); listParams.Add(flag.ToString()); - listParams.Add(userID.ToStringHyphenated()); + listParams.Add(userID.ToString()); EstateOwnerMessage("estateaccessdelta", listParams); } @@ -300,7 +300,7 @@ namespace libsecondlife List listParams = new List(); listParams.Add("-1"); listParams.Add("-1"); - listParams.Add(Client.Self.AgentID.ToStringHyphenated()); + listParams.Add(Client.Self.AgentID.ToString()); listParams.Add(Client.Self.FirstName + " " + Client.Self.LastName); listParams.Add(message); EstateOwnerMessage("simulatormessage", listParams); @@ -313,8 +313,8 @@ namespace libsecondlife public void TeleportHomeUser(LLUUID pest) { List listParams = new List(); - listParams.Add(Client.Self.AgentID.ToStringHyphenated()); - listParams.Add(pest.ToStringHyphenated()); + listParams.Add(Client.Self.AgentID.ToString()); + listParams.Add(pest.ToString()); EstateOwnerMessage("teleporthomeuser", listParams); } diff --git a/libsecondlife/GridManager.cs b/libsecondlife/GridManager.cs index 5e2c37fd..f3d42e12 100644 --- a/libsecondlife/GridManager.cs +++ b/libsecondlife/GridManager.cs @@ -96,7 +96,7 @@ namespace libsecondlife output.Append(Name); output.Append(Helpers.NewLine); output.Append("RegionHandle: " + RegionHandle); output.Append(Helpers.NewLine); output.Append(String.Format("X: {0} Y: {1}", X, Y)); output.Append(Helpers.NewLine); - output.Append("MapImageID: " + MapImageID.ToStringHyphenated()); output.Append(Helpers.NewLine); + output.Append("MapImageID: " + MapImageID.ToString()); output.Append(Helpers.NewLine); output.Append("Access: " + Access); output.Append(Helpers.NewLine); output.Append("RegionFlags: " + RegionFlags); output.Append(Helpers.NewLine); output.Append("WaterHeight: " + WaterHeight); output.Append(Helpers.NewLine); diff --git a/libsecondlife/Helpers.cs b/libsecondlife/Helpers.cs index 6acf9b9a..77c7ff90 100644 --- a/libsecondlife/Helpers.cs +++ b/libsecondlife/Helpers.cs @@ -157,6 +157,16 @@ namespace libsecondlife return (float)((bytes[pos] | (bytes[pos + 1] << 8)) / 32767.0f) * TWO_PI; } + public static byte TEGlowByte(float glow) + { + return (byte)(glow * 255.0f); + } + + public static float TEGlowFloat(byte[] bytes, int pos) + { + return (float)bytes[pos] / 255.0f; + } + /// /// Converts an unsigned integer to a hexadecimal string /// @@ -1128,8 +1138,12 @@ namespace libsecondlife StructuredData.LLSDMap map = (StructuredData.LLSDMap)llsd; List prims = new List(map.Count); - foreach (StructuredData.LLSD value in map.Values) - prims.Add(Primitive.FromLLSD(value)); + foreach (KeyValuePair kvp in map) + { + Primitive prim = Primitive.FromLLSD(kvp.Value); + prim.LocalID = UInt32.Parse(kvp.Key); + prims.Add(prim); + } return prims; } diff --git a/libsecondlife/Inventory.cs b/libsecondlife/Inventory.cs index 8d2b4b58..adcd5ed4 100644 --- a/libsecondlife/Inventory.cs +++ b/libsecondlife/Inventory.cs @@ -161,7 +161,7 @@ namespace libsecondlife // while we're waiting for the parent's data to come in. // As soon as we get the parent, the tree repairs itself. Client.DebugLog("Attempting to update inventory child of " + - item.ParentUUID.ToStringHyphenated() + + item.ParentUUID.ToString() + " when we have no local reference to that folder"); if (Client.Settings.FETCH_MISSING_INVENTORY) @@ -275,8 +275,8 @@ namespace libsecondlife { // Log a warning if there is a UUID mismatch, this will cause problems if (value.UUID != uuid) - Client.Log("Inventory[uuid]: uuid " + uuid.ToStringHyphenated() + " is not equal to value.UUID " + - value.UUID.ToStringHyphenated(), Helpers.LogLevel.Warning); + Client.Log("Inventory[uuid]: uuid " + uuid.ToString() + " is not equal to value.UUID " + + value.UUID.ToString(), Helpers.LogLevel.Warning); UpdateNodeFor(value); } diff --git a/libsecondlife/InventoryManager.cs b/libsecondlife/InventoryManager.cs index 0f3c230f..ea8f4ae5 100644 --- a/libsecondlife/InventoryManager.cs +++ b/libsecondlife/InventoryManager.cs @@ -2147,7 +2147,7 @@ namespace libsecondlife } else { - _Client.Log("Don't have a reference to FolderID " + reply.AgentData.FolderID.ToStringHyphenated() + + _Client.Log("Don't have a reference to FolderID " + reply.AgentData.FolderID.ToString() + " or it is not a folder", Helpers.LogLevel.Error); return; } @@ -2314,7 +2314,7 @@ namespace libsecondlife _Client.Log(String.Format( "MoveInventoryItemHandler: Item {0} is moving to Folder {1} with new name \"{2}\". Someone write this function!", - move.InventoryData[i].ItemID.ToStringHyphenated(), move.InventoryData[i].FolderID.ToStringHyphenated(), + move.InventoryData[i].ItemID.ToString(), move.InventoryData[i].FolderID.ToString(), newName), Helpers.LogLevel.Warning); } } @@ -2565,7 +2565,7 @@ namespace libsecondlife { if (loginSuccess) { - _Client.DebugLog("Setting InventoryRoot to " + replyData.InventoryRoot.ToStringHyphenated()); + _Client.DebugLog("Setting InventoryRoot to " + replyData.InventoryRoot.ToString()); InventoryFolder rootFolder = new InventoryFolder(replyData.InventoryRoot); rootFolder.Name = String.Empty; rootFolder.ParentUUID = LLUUID.Zero; diff --git a/libsecondlife/LLSD/LLSD.cs b/libsecondlife/LLSD/LLSD.cs index cc0dfcee..84463617 100644 --- a/libsecondlife/LLSD/LLSD.cs +++ b/libsecondlife/LLSD/LLSD.cs @@ -186,7 +186,7 @@ namespace libsecondlife.StructuredData this.value = value; } - public override string AsString() { return value.ToStringHyphenated(); } + public override string AsString() { return value.ToString(); } public override LLUUID AsUUID() { return value; } } diff --git a/libsecondlife/LLSD/XmlLLSD.cs b/libsecondlife/LLSD/XmlLLSD.cs index 2407173b..99223834 100644 --- a/libsecondlife/LLSD/XmlLLSD.cs +++ b/libsecondlife/LLSD/XmlLLSD.cs @@ -19,6 +19,12 @@ namespace libsecondlife.StructuredData return DeserializeXml(new XmlTextReader(new MemoryStream(xmlData, false))); } + public static LLSD DeserializeXml(string xmlData) + { + byte[] bytes = Helpers.StringToField(xmlData); + return DeserializeXml(new XmlTextReader(new MemoryStream(bytes, false))); + } + public static LLSD DeserializeXml(XmlTextReader xmlData) { xmlData.Read(); diff --git a/libsecondlife/ObjectManager.cs b/libsecondlife/ObjectManager.cs index d2474abd..47511df3 100644 --- a/libsecondlife/ObjectManager.cs +++ b/libsecondlife/ObjectManager.cs @@ -1466,8 +1466,8 @@ namespace libsecondlife prim.OwnerID = block.OwnerID; prim.MediaURL = Helpers.FieldToUTF8String(block.MediaURL); prim.Text = Helpers.FieldToUTF8String(block.Text); - prim.TextColor = new LLColor(block.TextColor, 0); - // Alpha is inversed to help zero encoding + prim.TextColor = new LLColor(block.TextColor, 0, false); + // Only alpha is inversed prim.TextColor.A = (byte)(255 - prim.TextColor.A); // Sound information @@ -1485,11 +1485,9 @@ namespace libsecondlife prim.Data = data; // Textures, texture animations, particle system, and extra params - prim.Textures = new LLObject.TextureEntry(block.TextureEntry, 0, + prim.Textures = new LLObject.TextureEntry(block.TextureEntry, 0, block.TextureEntry.Length); - LLUUID test = new LLUUID("73818c3a-acc3-30b8-5060-0e6cf693cddf"); - prim.TextureAnim = new Primitive.TextureAnimation(block.TextureAnim, 0); prim.ParticleSys = new Primitive.ParticleSystem(block.PSBlock, 0); prim.SetExtraParamsFromBytes(block.ExtraParams, 0); @@ -1699,7 +1697,8 @@ namespace libsecondlife // Textures // FIXME: Why are we ignoring the first four bytes here? - update.Textures = new LLObject.TextureEntry(block.TextureEntry, 4, block.TextureEntry.Length - 4); + if (block.TextureEntry.Length != 0) + update.Textures = new LLObject.TextureEntry(block.TextureEntry, 4, block.TextureEntry.Length - 4); #endregion Decode update data @@ -1896,7 +1895,8 @@ namespace libsecondlife prim.Text = text; // Text color - prim.TextColor = new LLColor(block.Data, i); + prim.TextColor = new LLColor(block.Data, i, false); + // FIXME: Is alpha inversed here as well? i += 4; } else diff --git a/libsecondlife/Prims.cs b/libsecondlife/Prims.cs index 27209ae1..95e6be19 100644 --- a/libsecondlife/Prims.cs +++ b/libsecondlife/Prims.cs @@ -282,7 +282,7 @@ namespace libsecondlife { if (data.Length >= 16) { - Color = new LLColor(data, 0); + Color = new LLColor(data, 0, false); Radius = Helpers.BytesToFloat(data, 4); Cutoff = Helpers.BytesToFloat(data, 8); Falloff = Helpers.BytesToFloat(data, 12); diff --git a/libsecondlife/TextureEntry.cs b/libsecondlife/TextureEntry.cs index 981a82d7..8c70d7a4 100644 --- a/libsecondlife/TextureEntry.cs +++ b/libsecondlife/TextureEntry.cs @@ -31,112 +31,114 @@ using libsecondlife.StructuredData; namespace libsecondlife { + #region Enumerations + + /// + /// The type of bump-mapping applied to a face + /// + public enum Bumpiness : byte + { + /// + None = 0, + /// + Brightness = 1, + /// + Darkness = 2, + /// + Woodgrain = 3, + /// + Bark = 4, + /// + Bricks = 5, + /// + Checker = 6, + /// + Concrete = 7, + /// + Crustytile = 8, + /// + Cutstone = 9, + /// + Discs = 10, + /// + Gravel = 11, + /// + Petridish = 12, + /// + Siding = 13, + /// + Stonetile = 14, + /// + Stucco = 15, + /// + Suction = 16, + /// + Weave = 17 + } + + /// + /// The level of shininess applied to a face + /// + public enum Shininess + { + /// + None = 0, + /// + Low = 0x40, + /// + Medium = 0x80, + /// + High = 0xC0 + } + + /// + /// The texture mapping style used for a face + /// + public enum MappingType + { + /// + Default = 0, + /// + Planar = 2 + } + + /// + /// Flags in the TextureEntry block that describe which properties are + /// set + /// + [Flags] + public enum TextureAttributes : uint + { + /// + None = 0, + /// + TextureID = 1 << 0, + /// + RGBA = 1 << 1, + /// + RepeatU = 1 << 2, + /// + RepeatV = 1 << 3, + /// + OffsetU = 1 << 4, + /// + OffsetV = 1 << 5, + /// + Rotation = 1 << 6, + /// + Material = 1 << 7, + /// + Media = 1 << 8, + /// + Glow = 1 << 9, + /// + All = 0xFFFFFFFF + } + + #endregion Enumerations + public abstract partial class LLObject { - #region Enumerations - - /// - /// The type of bump-mapping applied to a face - /// - public enum Bumpiness : byte - { - /// - None = 0, - /// - Brightness = 1, - /// - Darkness = 2, - /// - Woodgrain = 3, - /// - Bark = 4, - /// - Bricks = 5, - /// - Checker = 6, - /// - Concrete = 7, - /// - Crustytile = 8, - /// - Cutstone = 9, - /// - Discs = 10, - /// - Gravel = 11, - /// - Petridish = 12, - /// - Siding = 13, - /// - Stonetile = 14, - /// - Stucco = 15, - /// - Suction = 16, - /// - Weave = 17 - } - - /// - /// The level of shininess applied to a face - /// - public enum Shininess - { - /// - None = 0, - /// - Low = 0x40, - /// - Medium = 0x80, - /// - High = 0xC0 - } - - /// - /// The texture mapping style used for a face - /// - public enum Mapping - { - /// - Default = 0, - /// - Planar = 2 - } - - /// - /// Flags in the TextureEntry block that describe which properties are - /// set - /// - [Flags] - public enum TextureAttributes : uint - { - /// - None = 0, - /// - TextureID = 1 << 0, - /// - RGBA = 1 << 1, - /// - RepeatU = 1 << 2, - /// - RepeatV = 1 << 3, - /// - OffsetU = 1 << 4, - /// - OffsetV = 1 << 5, - /// - Rotation = 1 << 6, - /// - Material = 1 << 7, - /// - Media = 1 << 8, - /// - All = 0xFFFFFFFF - } - - #endregion Enumerations - /// /// A single textured face. Don't instantiate this class yourself, use the /// methods in TextureEntry @@ -163,6 +165,7 @@ namespace libsecondlife private float offsetU; private float offsetV; private float rotation; + private float glow; private TextureAttributes hasAttribute; private LLUUID textureID; private TextureEntryFace DefaultTexture; @@ -357,12 +360,12 @@ namespace libsecondlife } } - public Mapping TexMapType + public MappingType TexMapType { get { if ((hasAttribute & TextureAttributes.Media) != 0) - return (Mapping)(media & TEX_MAP_MASK); + return (MappingType)(media & TEX_MAP_MASK); else return DefaultTexture.TexMapType; } @@ -376,6 +379,23 @@ namespace libsecondlife } } + /// + public float Glow + { + get + { + if ((hasAttribute & TextureAttributes.Glow) != 0) + return glow; + else + return DefaultTexture.glow; + } + set + { + glow = value; + hasAttribute |= TextureAttributes.Glow; + } + } + /// public LLUUID TextureID { @@ -414,16 +434,20 @@ namespace libsecondlife public LLSD ToLLSD() { LLSDMap tex = new LLSDMap(10); - tex["bump"] = LLSD.FromInteger((int)Bump); tex["colors"] = RGBA.ToLLSD(); - tex["fullbright"] = LLSD.FromBoolean(Fullbright); - tex["imageid"] = LLSD.FromUUID(TextureID); - tex["imagerot"] = LLSD.FromReal(Rotation); - tex["media_flags"] = LLSD.FromInteger(Convert.ToInt32(MediaFlags)); - tex["offsets"] = LLSD.FromReal(OffsetU); - tex["offsett"] = LLSD.FromReal(OffsetV); 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); + tex["imageid"] = LLSD.FromUUID(TextureID); + return tex; } @@ -432,16 +456,19 @@ namespace libsecondlife LLSDMap map = (LLSDMap)llsd; TextureEntryFace face = new TextureEntryFace(defaultFace); - face.Bump = (Bumpiness)map["bump"].AsInteger(); face.RGBA = LLColor.FromLLSD(map["colors"]); - face.Fullbright = map["fullbright"].AsBoolean(); - face.TextureID = map["imageid"].AsUUID(); - face.Rotation = (float)map["imagerot"].AsReal(); - face.MediaFlags = map["media_flags"].AsBoolean(); - face.OffsetU = (float)map["offsets"].AsReal(); - face.OffsetV = (float)map["offsett"].AsReal(); face.RepeatU = (float)map["scales"].AsReal(); face.RepeatV = (float)map["scalet"].AsReal(); + face.OffsetU = (float)map["offsets"].AsReal(); + face.OffsetV = (float)map["offsett"].AsReal(); + face.Rotation = (float)map["imagerot"].AsReal(); + face.Bump = (Bumpiness)map["bump"].AsInteger(); + face.Shiny = (Shininess)map["shiny"].AsInteger(); + face.Fullbright = map["fullbright"].AsBoolean(); + face.MediaFlags = map["media_flags"].AsBoolean(); + face.TexMapType = (MappingType)map["mapping"].AsInteger(); + face.Glow = (float)map["glow"].AsReal(); + face.TextureID = map["imageid"].AsUUID(); return face; } @@ -452,9 +479,10 @@ namespace libsecondlife /// public override string ToString() { - return String.Format("RGBA: {0} RepeatU: {1} RepeatV: {2} OffsetU: {3} OffsetV: {4} Rotation: {5} " + - "TextureAttributes: {6} Material: {7} Media: {8} ID: {9}", rgba, repeatU, repeatV, offsetU, - offsetV, rotation, hasAttribute.ToString(), material, media, textureID.ToStringHyphenated()); + return String.Format("Color: {0} RepeatU: {1} RepeatV: {2} OffsetU: {3} OffsetV: {4} " + + "Rotation: {5} Bump: {6} Shiny: {7} Fullbright: {8} Mapping: {9} Media: {10} Glow: {11} ID: {12}", + RGBA, RepeatU, RepeatV, OffsetU, OffsetV, Rotation, Bump, Shiny, Fullbright, TexMapType, + MediaFlags, Glow, TextureID); } } @@ -469,21 +497,20 @@ namespace libsecondlife /// of nine faces public class TextureEntry { - /// - public TextureEntryFace DefaultTexture; + /// Maximum number of faces an object can have + public const int MAX_FACES = 32; + /// public TextureEntryFace[] FaceTextures = new TextureEntryFace[MAX_FACES]; - public const int MAX_FACES = 32; - /// /// Constructor that takes a default texture UUID /// /// Texture UUID to use as the default texture public TextureEntry(LLUUID defaultTextureID) { - DefaultTexture = new TextureEntryFace(null); - DefaultTexture.TextureID = defaultTextureID; + FaceTextures[0] = new TextureEntryFace(null); + FaceTextures[0].TextureID = defaultTextureID; } /// @@ -493,19 +520,19 @@ namespace libsecondlife /// Face to use as the default face public TextureEntry(TextureEntryFace defaultFace) { - DefaultTexture = new TextureEntryFace(null); - DefaultTexture.Bump = defaultFace.Bump; - DefaultTexture.Fullbright = defaultFace.Fullbright; - DefaultTexture.MediaFlags = defaultFace.MediaFlags; - DefaultTexture.OffsetU = defaultFace.OffsetU; - DefaultTexture.OffsetV = defaultFace.OffsetV; - DefaultTexture.RepeatU = defaultFace.RepeatU; - DefaultTexture.RepeatV = defaultFace.RepeatV; - DefaultTexture.RGBA = defaultFace.RGBA; - DefaultTexture.Rotation = defaultFace.Rotation; - DefaultTexture.Shiny = defaultFace.Shiny; - DefaultTexture.TexMapType = defaultFace.TexMapType; - DefaultTexture.TextureID = defaultFace.TextureID; + FaceTextures[0] = new TextureEntryFace(null); + FaceTextures[0].Bump = defaultFace.Bump; + FaceTextures[0].Fullbright = defaultFace.Fullbright; + FaceTextures[0].MediaFlags = defaultFace.MediaFlags; + FaceTextures[0].OffsetU = defaultFace.OffsetU; + FaceTextures[0].OffsetV = defaultFace.OffsetV; + FaceTextures[0].RepeatU = defaultFace.RepeatU; + FaceTextures[0].RepeatV = defaultFace.RepeatV; + FaceTextures[0].RGBA = defaultFace.RGBA; + FaceTextures[0].Rotation = defaultFace.Rotation; + FaceTextures[0].Shiny = defaultFace.Shiny; + FaceTextures[0].TexMapType = defaultFace.TexMapType; + FaceTextures[0].TextureID = defaultFace.TextureID; } /// @@ -534,7 +561,7 @@ namespace libsecondlife if (index >= MAX_FACES) throw new Exception(index + " is outside the range of MAX_FACES"); if (FaceTextures[index] == null) - FaceTextures[index] = new TextureEntryFace(this.DefaultTexture); + FaceTextures[index] = new TextureEntryFace(FaceTextures[0]); return FaceTextures[index]; } @@ -551,7 +578,7 @@ namespace libsecondlife if (FaceTextures[index] != null) return FaceTextures[index]; else - return DefaultTexture; + return FaceTextures[0]; } /// @@ -582,7 +609,7 @@ namespace libsecondlife TextureEntryFace defaultFace = TextureEntryFace.FromLLSD(faceLLSD, null); TextureEntry te = new TextureEntry(defaultFace); - for (int i = 0; i < array.Count; i++) + for (int i = 1; i < array.Count; i++) { te.FaceTextures[i] = TextureEntryFace.FromLLSD(array[i], defaultFace); } @@ -597,23 +624,21 @@ namespace libsecondlife private void FromBytes(byte[] data, int pos, int length) { - if (length <= 0) + FaceTextures[0] = new TextureEntryFace(null); + + if (length < 16) { // No TextureEntry to process - DefaultTexture = null; + SecondLife.LogStatic("Parsing an empty TextureEntry", Helpers.LogLevel.Warning); return; } - else - { - DefaultTexture = new TextureEntryFace(null); - } uint bitfieldSize = 0; uint faceBits = 0; int i = pos; #region Texture - DefaultTexture.TextureID = new LLUUID(data, i); + FaceTextures[0].TextureID = new LLUUID(data, i); i += 16; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -628,7 +653,8 @@ namespace libsecondlife #endregion Texture #region Color - DefaultTexture.RGBA = new LLColor(data[i], data[i + 1], data[i + 2], data[i + 3]); + // Inverse set to true to reverse the zerocoding optimization where white becomes black + FaceTextures[0].RGBA = new LLColor(data, i, true); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -643,7 +669,7 @@ namespace libsecondlife #endregion Color #region RepeatU - DefaultTexture.RepeatU = Helpers.BytesToFloat(data, i); + FaceTextures[0].RepeatU = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -658,7 +684,7 @@ namespace libsecondlife #endregion RepeatU #region RepeatV - DefaultTexture.RepeatV = Helpers.BytesToFloat(data, i); + FaceTextures[0].RepeatV = Helpers.BytesToFloat(data, i); i += 4; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -673,7 +699,7 @@ namespace libsecondlife #endregion RepeatV #region OffsetU - DefaultTexture.OffsetU = Helpers.TEOffsetFloat(data, i); + FaceTextures[0].OffsetU = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -688,7 +714,7 @@ namespace libsecondlife #endregion OffsetU #region OffsetV - DefaultTexture.OffsetV = Helpers.TEOffsetFloat(data, i); + FaceTextures[0].OffsetV = Helpers.TEOffsetFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -703,7 +729,7 @@ namespace libsecondlife #endregion OffsetV #region Rotation - DefaultTexture.Rotation = Helpers.TERotationFloat(data, i); + FaceTextures[0].Rotation = Helpers.TERotationFloat(data, i); i += 2; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -718,7 +744,7 @@ namespace libsecondlife #endregion Rotation #region Material - DefaultTexture.material = data[i]; + FaceTextures[0].material = data[i]; i++; while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) @@ -733,10 +759,10 @@ namespace libsecondlife #endregion Material #region Media - DefaultTexture.media = data[i]; + FaceTextures[0].media = data[i]; i++; - while (i - pos < length && ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) + while (/*i - pos < length && */ ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) { byte tmpByte = data[i]; i++; @@ -746,6 +772,21 @@ namespace libsecondlife CreateFace(face).media = tmpByte; } #endregion Media + + #region Glow + FaceTextures[0].Glow = Helpers.TEGlowFloat(data, i); + i++; + + while (ReadFaceBitfield(data, ref i, ref faceBits, ref bitfieldSize)) + { + float tmpFloat = Helpers.TEGlowFloat(data, i); + i++; + + for (uint face = 0, bit = 1; face < bitfieldSize; face++, bit <<= 1) + if ((faceBits & bit) != 0) + CreateFace(face).Glow = tmpFloat; + } + #endregion Glow } /// @@ -754,9 +795,6 @@ namespace libsecondlife /// public byte[] ToBytes() { - if (DefaultTexture == null) - return new byte[0]; - MemoryStream memStream = new MemoryStream(); BinaryWriter binWriter = new BinaryWriter(memStream); @@ -780,62 +818,69 @@ namespace libsecondlife InitializeArray(ref materials); uint[] medias = new uint[FaceTextures.Length]; InitializeArray(ref medias); + uint[] glows = new uint[FaceTextures.Length]; + InitializeArray(ref glows); - for (int i = 0; i < FaceTextures.Length; i++) + for (int i = 1; i < FaceTextures.Length; i++) { if (FaceTextures[i] == null) continue; - if (FaceTextures[i].TextureID != DefaultTexture.TextureID) + if (FaceTextures[i].TextureID != FaceTextures[0].TextureID) { if (textures[i] == UInt32.MaxValue) textures[i] = 0; textures[i] |= (uint)(1 << i); } - if (FaceTextures[i].RGBA != DefaultTexture.RGBA) + if (FaceTextures[i].RGBA != FaceTextures[0].RGBA) { if (rgbas[i] == UInt32.MaxValue) rgbas[i] = 0; rgbas[i] |= (uint)(1 << i); } - if (FaceTextures[i].RepeatU != DefaultTexture.RepeatU) + if (FaceTextures[i].RepeatU != FaceTextures[0].RepeatU) { if (repeatus[i] == UInt32.MaxValue) repeatus[i] = 0; repeatus[i] |= (uint)(1 << i); } - if (FaceTextures[i].RepeatV != DefaultTexture.RepeatV) + if (FaceTextures[i].RepeatV != FaceTextures[0].RepeatV) { if (repeatvs[i] == UInt32.MaxValue) repeatvs[i] = 0; repeatvs[i] |= (uint)(1 << i); } - if (Helpers.TEOffsetShort(FaceTextures[i].OffsetU) != Helpers.TEOffsetShort(DefaultTexture.OffsetU)) + if (Helpers.TEOffsetShort(FaceTextures[i].OffsetU) != Helpers.TEOffsetShort(FaceTextures[0].OffsetU)) { if (offsetus[i] == UInt32.MaxValue) offsetus[i] = 0; offsetus[i] |= (uint)(1 << i); } - if (Helpers.TEOffsetShort(FaceTextures[i].OffsetV) != Helpers.TEOffsetShort(DefaultTexture.OffsetV)) + if (Helpers.TEOffsetShort(FaceTextures[i].OffsetV) != Helpers.TEOffsetShort(FaceTextures[0].OffsetV)) { if (offsetvs[i] == UInt32.MaxValue) offsetvs[i] = 0; offsetvs[i] |= (uint)(1 << i); } - if (Helpers.TERotationShort(FaceTextures[i].Rotation) != Helpers.TERotationShort(DefaultTexture.Rotation)) + if (Helpers.TERotationShort(FaceTextures[i].Rotation) != Helpers.TERotationShort(FaceTextures[0].Rotation)) { if (rotations[i] == UInt32.MaxValue) rotations[i] = 0; rotations[i] |= (uint)(1 << i); } - if (FaceTextures[i].material != DefaultTexture.material) + if (FaceTextures[i].material != FaceTextures[0].material) { if (materials[i] == UInt32.MaxValue) materials[i] = 0; materials[i] |= (uint)(1 << i); } - if (FaceTextures[i].media != DefaultTexture.media) + if (FaceTextures[i].media != FaceTextures[0].media) { if (medias[i] == UInt32.MaxValue) medias[i] = 0; medias[i] |= (uint)(1 << i); } + if (Helpers.TEGlowByte(FaceTextures[i].Glow) != Helpers.TEGlowByte(FaceTextures[0].Glow)) + { + if (glows[i] == UInt32.MaxValue) glows[i] = 0; + glows[i] |= (uint)(1 << i); + } } #endregion Bitfield Setup #region Texture - binWriter.Write(DefaultTexture.TextureID.GetBytes()); + binWriter.Write(FaceTextures[0].TextureID.GetBytes()); for (int i = 0; i < textures.Length; i++) { if (textures[i] != UInt32.MaxValue) @@ -848,20 +893,20 @@ namespace libsecondlife #endregion Texture #region Color - binWriter.Write(DefaultTexture.RGBA.GetBytes()); + binWriter.Write(FaceTextures[0].RGBA.GetInvertedBytes()); for (int i = 0; i < rgbas.Length; i++) { if (rgbas[i] != UInt32.MaxValue) { binWriter.Write(GetFaceBitfieldBytes(rgbas[i])); - binWriter.Write(FaceTextures[i].RGBA.GetBytes()); + binWriter.Write(FaceTextures[i].RGBA.GetInvertedBytes()); } } binWriter.Write((byte)0); #endregion Color #region RepeatU - binWriter.Write(DefaultTexture.RepeatU); + binWriter.Write(FaceTextures[0].RepeatU); for (int i = 0; i < repeatus.Length; i++) { if (repeatus[i] != UInt32.MaxValue) @@ -874,7 +919,7 @@ namespace libsecondlife #endregion RepeatU #region RepeatV - binWriter.Write(DefaultTexture.RepeatV); + binWriter.Write(FaceTextures[0].RepeatV); for (int i = 0; i < repeatvs.Length; i++) { if (repeatvs[i] != UInt32.MaxValue) @@ -887,7 +932,7 @@ namespace libsecondlife #endregion RepeatV #region OffsetU - binWriter.Write(Helpers.TEOffsetShort(DefaultTexture.OffsetU)); + binWriter.Write(Helpers.TEOffsetShort(FaceTextures[0].OffsetU)); for (int i = 0; i < offsetus.Length; i++) { if (offsetus[i] != UInt32.MaxValue) @@ -900,7 +945,7 @@ namespace libsecondlife #endregion OffsetU #region OffsetV - binWriter.Write(Helpers.TEOffsetShort(DefaultTexture.OffsetV)); + binWriter.Write(Helpers.TEOffsetShort(FaceTextures[0].OffsetV)); for (int i = 0; i < offsetvs.Length; i++) { if (offsetvs[i] != UInt32.MaxValue) @@ -913,7 +958,7 @@ namespace libsecondlife #endregion OffsetV #region Rotation - binWriter.Write(Helpers.TERotationShort(DefaultTexture.Rotation)); + binWriter.Write(Helpers.TERotationShort(FaceTextures[0].Rotation)); for (int i = 0; i < rotations.Length; i++) { if (rotations[i] != UInt32.MaxValue) @@ -926,7 +971,7 @@ namespace libsecondlife #endregion Rotation #region Material - binWriter.Write(DefaultTexture.material); + binWriter.Write(FaceTextures[0].material); for (int i = 0; i < materials.Length; i++) { if (materials[i] != UInt32.MaxValue) @@ -939,7 +984,7 @@ namespace libsecondlife #endregion Material #region Media - binWriter.Write(DefaultTexture.media); + binWriter.Write(FaceTextures[0].media); for (int i = 0; i < medias.Length; i++) { if (medias[i] != UInt32.MaxValue) @@ -948,8 +993,21 @@ namespace libsecondlife binWriter.Write(FaceTextures[i].media); } } + binWriter.Write((byte)0); #endregion Media + #region Glow + binWriter.Write(Helpers.TEGlowByte(FaceTextures[0].Glow)); + for (int i = 0; i < glows.Length; i++) + { + if (glows[i] != UInt32.MaxValue) + { + binWriter.Write(GetFaceBitfieldBytes(glows[i])); + binWriter.Write(Helpers.TEGlowByte(FaceTextures[i].Glow)); + } + } + #endregion Glow + return memStream.ToArray(); } @@ -961,8 +1019,6 @@ namespace libsecondlife { string output = String.Empty; - output += "Default Face: " + DefaultTexture.ToString() + Helpers.NewLine; - for (int i = 0; i < FaceTextures.Length; i++) { if (FaceTextures[i] != null) diff --git a/libsecondlife/Types.cs b/libsecondlife/Types.cs index 79c14108..ef204cae 100644 --- a/libsecondlife/Types.cs +++ b/libsecondlife/Types.cs @@ -161,17 +161,6 @@ namespace libsecondlife return retval; } - /// - /// Get a hyphenated string representation of this UUID - /// - /// A string representation of this UUID, lowercase and - /// with hyphens - /// 11f8aa9c-b071-4242-836b-13b7abe0d489 - public string ToStringHyphenated() - { - return UUID.ToString(); - } - /// /// Get a 64-bit integer representation of the first half of this UUID /// @@ -273,15 +262,14 @@ namespace libsecondlife } /// - /// Get a string representation of this UUID + /// Get a hyphenated string representation of this UUID /// /// A string representation of this UUID, lowercase and - /// without hyphens - /// 11f8aa9cb0714242836b13b7abe0d489 + /// with hyphens + /// 11f8aa9c-b071-4242-836b-13b7abe0d489 public override string ToString() { - string uuid = UUID.ToString(); - return uuid.Replace("-", String.Empty); + return UUID.ToString(); } #endregion Overrides @@ -1235,19 +1223,24 @@ namespace libsecondlife A = Helpers.Clamp(a, 0f, 1f); } - /// - /// - /// - /// - /// - public LLColor(byte[] byteArray, int pos) - { - float quanta = 1.0f / 255.0f; + public LLColor(byte[] byteArray, int pos, bool inverted) + { + const float quanta = 1.0f / 255.0f; - R = (float)byteArray[pos] * quanta; - G = (float)byteArray[pos + 1] * quanta; - B = (float)byteArray[pos + 2] * quanta; - A = (float)byteArray[pos + 3] * quanta; + if (inverted) + { + R = (float)(255 - byteArray[pos]) * quanta; + G = (float)(255 - byteArray[pos + 1]) * quanta; + B = (float)(255 - byteArray[pos + 2]) * quanta; + A = (float)(255 - byteArray[pos + 3]) * quanta; + } + else + { + R = (float)byteArray[pos] * quanta; + G = (float)byteArray[pos + 1] * quanta; + B = (float)byteArray[pos + 2] * quanta; + A = (float)byteArray[pos + 3] * quanta; + } } #endregion Constructors @@ -1262,10 +1255,22 @@ namespace libsecondlife { byte[] byteArray = new byte[4]; - byteArray[0] = Helpers.FloatToByte(R, 0.0f, 255.0f); - byteArray[1] = Helpers.FloatToByte(G, 0.0f, 255.0f); - byteArray[2] = Helpers.FloatToByte(B, 0.0f, 255.0f); - byteArray[3] = Helpers.FloatToByte(A, 0.0f, 255.0f); + byteArray[0] = Helpers.FloatToByte(R, 0f, 1f); + byteArray[1] = Helpers.FloatToByte(G, 0f, 1f); + byteArray[2] = Helpers.FloatToByte(B, 0f, 1f); + byteArray[3] = Helpers.FloatToByte(A, 0f, 1f); + + return byteArray; + } + + public byte[] GetInvertedBytes() + { + byte[] byteArray = GetBytes(); + + byteArray[0] = (byte)(255 - byteArray[0]); + byteArray[1] = (byte)(255 - byteArray[1]); + byteArray[2] = (byte)(255 - byteArray[2]); + byteArray[3] = (byte)(255 - byteArray[3]); return byteArray; } @@ -1303,7 +1308,7 @@ namespace libsecondlife { LLSDArray array = (LLSDArray)llsd; - if (array.Count == 3) + if (array.Count == 4) { return new LLColor( (float)array[0].AsReal(), diff --git a/libsecondlife/examples/Key2Name/key2name.cs b/libsecondlife/examples/Key2Name/key2name.cs index 68d25225..42a64fae 100644 --- a/libsecondlife/examples/Key2Name/key2name.cs +++ b/libsecondlife/examples/Key2Name/key2name.cs @@ -31,7 +31,7 @@ namespace Key2Name LLUUID lookup = new LLUUID(); LLUUID.TryParse(args[3], out lookup); - Console.WriteLine("Looking up name for " + lookup.ToStringHyphenated()); + Console.WriteLine("Looking up name for " + lookup.ToString()); client.Avatars.RequestAvatarName(lookup); diff --git a/libsecondlife/examples/TestClient/Commands/CloneProfileCommand.cs b/libsecondlife/examples/TestClient/Commands/CloneProfileCommand.cs index 4cd8eedb..215b8b0d 100644 --- a/libsecondlife/examples/TestClient/Commands/CloneProfileCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/CloneProfileCommand.cs @@ -71,7 +71,7 @@ namespace libsecondlife.TestClient Client.Groups.RequestJoinGroup(groupID); } - return "Synchronized our profile to the profile of " + targetID.ToStringHyphenated(); + return "Synchronized our profile to the profile of " + targetID.ToString(); } void Avatars_OnAvatarProperties(LLUUID avatarID, Avatar.AvatarProperties properties) @@ -117,11 +117,11 @@ namespace libsecondlife.TestClient void Groups_OnGroupJoined(LLUUID groupID, bool success) { Console.WriteLine(Client.ToString() + (success ? " joined " : " failed to join ") + - groupID.ToStringHyphenated()); + groupID.ToString()); if (success) { - Console.WriteLine(Client.ToString() + " setting " + groupID.ToStringHyphenated() + + Console.WriteLine(Client.ToString() + " setting " + groupID.ToString() + " as the active group"); Client.Groups.ActivateGroup(groupID); } diff --git a/libsecondlife/examples/TestClient/Commands/Communication/IMCommand.cs b/libsecondlife/examples/TestClient/Commands/Communication/IMCommand.cs index 32d7fff1..693d85a4 100644 --- a/libsecondlife/examples/TestClient/Commands/Communication/IMCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Communication/IMCommand.cs @@ -47,7 +47,7 @@ namespace libsecondlife.TestClient LLUUID id = Name2Key[ToAvatarName.ToLower()]; Client.Self.InstantMessage(id, message, id); - return "Instant Messaged " + id.ToStringHyphenated() + " with message: " + message; + return "Instant Messaged " + id.ToString() + " with message: " + message; } else { diff --git a/libsecondlife/examples/TestClient/Commands/DetectBotCommand.cs b/libsecondlife/examples/TestClient/Commands/DetectBotCommand.cs index 4ea1d4df..235b27db 100644 --- a/libsecondlife/examples/TestClient/Commands/DetectBotCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/DetectBotCommand.cs @@ -32,7 +32,7 @@ namespace libsecondlife.TestClient IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.SkirtBaked]) && IsNullOrZero(te.FaceTextures[(int)AppearanceManager.TextureIndex.UpperBaked])) { - Console.WriteLine("Avatar " + appearance.Sender.ID.ToStringHyphenated() + " may be a bot"); + Console.WriteLine("Avatar " + appearance.Sender.ID.ToString() + " may be a bot"); } } diff --git a/libsecondlife/examples/TestClient/Commands/Inventory/BackupCommand.cs b/libsecondlife/examples/TestClient/Commands/Inventory/BackupCommand.cs index 4d5c93ad..bb7952b9 100644 --- a/libsecondlife/examples/TestClient/Commands/Inventory/BackupCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Inventory/BackupCommand.cs @@ -181,7 +181,7 @@ namespace libsecondlife.TestClient { if ((qdi.WhenRequested + TimeSpan.FromSeconds(60)) < DateTime.Now) { - Client.DebugLog(Name + ": timeout on asset " + qdi.AssetID.ToStringHyphenated()); + Client.DebugLog(Name + ": timeout on asset " + qdi.AssetID.ToString()); // submit request again qdi.TransferID = Client.Assets.RequestInventoryAsset( qdi.AssetID, qdi.ItemID, qdi.TaskID, qdi.OwnerID, qdi.Type, true); @@ -336,7 +336,7 @@ namespace libsecondlife.TestClient { TextItemErrors++; Console.WriteLine("{0}: Download of asset {1} ({2}) failed with status {3}", Name, r.FileName, - r.AssetID.ToStringHyphenated(), asset.Status.ToString()); + r.AssetID.ToString(), asset.Status.ToString()); } // remove the entry diff --git a/libsecondlife/examples/TestClient/Commands/Inventory/DumpOutfitCommand.cs b/libsecondlife/examples/TestClient/Commands/Inventory/DumpOutfitCommand.cs index fdf4ebe4..251d7525 100644 --- a/libsecondlife/examples/TestClient/Commands/Inventory/DumpOutfitCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Inventory/DumpOutfitCommand.cs @@ -80,7 +80,7 @@ namespace libsecondlife.TestClient } } - return "Couldn't find avatar " + target.ToStringHyphenated(); + return "Couldn't find avatar " + target.ToString(); } private void Assets_OnImageReceived(ImageDownload image, AssetTexture assetTexture) @@ -93,12 +93,12 @@ namespace libsecondlife.TestClient { try { - File.WriteAllBytes(image.ID.ToStringHyphenated() + ".jp2", image.AssetData); - Console.WriteLine("Wrote JPEG2000 image " + image.ID.ToStringHyphenated() + ".jp2"); + File.WriteAllBytes(image.ID.ToString() + ".jp2", image.AssetData); + Console.WriteLine("Wrote JPEG2000 image " + image.ID.ToString() + ".jp2"); byte[] tgaFile = OpenJPEGNet.OpenJPEG.DecodeToTGA(image.AssetData); - File.WriteAllBytes(image.ID.ToStringHyphenated() + ".tga", tgaFile); - Console.WriteLine("Wrote TGA image " + image.ID.ToStringHyphenated() + ".tga"); + File.WriteAllBytes(image.ID.ToString() + ".tga", tgaFile); + Console.WriteLine("Wrote TGA image " + image.ID.ToString() + ".tga"); } catch (Exception e) { @@ -107,7 +107,7 @@ namespace libsecondlife.TestClient } else { - Console.WriteLine("Failed to download image " + image.ID.ToStringHyphenated()); + Console.WriteLine("Failed to download image " + image.ID.ToString()); } OutfitAssets.Remove(image.ID); diff --git a/libsecondlife/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs b/libsecondlife/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs index 2e6fe1ce..e4e4aecf 100644 --- a/libsecondlife/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Inventory/ObjectInventoryCommand.cs @@ -26,7 +26,7 @@ namespace libsecondlife.TestClient if (found != null) objectLocalID = found.LocalID; else - return "Couldn't find prim " + objectID.ToStringHyphenated(); + return "Couldn't find prim " + objectID.ToString(); List items = Client.Inventory.GetTaskInventory(objectID, objectLocalID, 1000 * 30); diff --git a/libsecondlife/examples/TestClient/Commands/Land/GridLayerCommand.cs b/libsecondlife/examples/TestClient/Commands/Land/GridLayerCommand.cs index f756b52d..0138f3f9 100644 --- a/libsecondlife/examples/TestClient/Commands/Land/GridLayerCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Land/GridLayerCommand.cs @@ -23,7 +23,7 @@ namespace libsecondlife.TestClient private void Grid_OnGridLayer(GridLayer layer) { Console.WriteLine(String.Format("Layer({0}) Bottom: {1} Left: {2} Top: {3} Right: {4}", - layer.ImageID.ToStringHyphenated(), layer.Bottom, layer.Left, layer.Top, layer.Right)); + layer.ImageID.ToString(), layer.Bottom, layer.Left, layer.Top, layer.Right)); } } } diff --git a/libsecondlife/examples/TestClient/Commands/Movement/SitOnCommand.cs b/libsecondlife/examples/TestClient/Commands/Movement/SitOnCommand.cs index d2279e31..3ef0e26b 100644 --- a/libsecondlife/examples/TestClient/Commands/Movement/SitOnCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Movement/SitOnCommand.cs @@ -34,7 +34,7 @@ namespace libsecondlife.TestClient { Client.Self.RequestSit(targetPrim.ID, LLVector3.Zero); Client.Self.Sit(); - return "Requested to sit on prim " + targetPrim.ID.ToStringHyphenated() + + return "Requested to sit on prim " + targetPrim.ID.ToString() + " (" + targetPrim.LocalID + ")"; } } diff --git a/libsecondlife/examples/TestClient/Commands/Prims/ChangePermsCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/ChangePermsCommand.cs index e31c6dfe..aa2c5b43 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/ChangePermsCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/ChangePermsCommand.cs @@ -63,9 +63,9 @@ namespace libsecondlife.TestClient // Find the requested prim rootPrim = Client.Network.CurrentSim.Objects.Find(delegate(Primitive prim) { return prim.ID == rootID; }); if (rootPrim == null) - return "Cannot find requested prim " + rootID.ToStringHyphenated(); + return "Cannot find requested prim " + rootID.ToString(); else - Client.DebugLog("Found requested prim " + rootPrim.ID.ToStringHyphenated()); + Client.DebugLog("Found requested prim " + rootPrim.ID.ToString()); if (rootPrim.ParentID != 0) { @@ -73,7 +73,7 @@ namespace libsecondlife.TestClient if (!Client.Network.CurrentSim.Objects.TryGetPrimitive(rootPrim.ParentID, out rootPrim)) return "Cannot find root prim for requested object"; else - Client.DebugLog("Set root prim to " + rootPrim.ID.ToStringHyphenated()); + Client.DebugLog("Set root prim to " + rootPrim.ID.ToString()); } // Find all of the child objects linked to this root diff --git a/libsecondlife/examples/TestClient/Commands/Prims/ExportCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/ExportCommand.cs index ac865547..58abbb9f 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/ExportCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/ExportCommand.cs @@ -137,7 +137,7 @@ namespace libsecondlife.TestClient { if (sourceID == Client.MasterKey) { - //Client.DebugLog("Master is now selecting " + targetID.ToStringHyphenated()); + //Client.DebugLog("Master is now selecting " + targetID.ToString()); SelectedObject = targetID; } } diff --git a/libsecondlife/examples/TestClient/Commands/Prims/ExportParticlesCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/ExportParticlesCommand.cs index 6dab8068..953f78e0 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/ExportParticlesCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/ExportParticlesCommand.cs @@ -102,8 +102,8 @@ namespace libsecondlife.TestClient lsl.Append(" PSYS_SRC_INNERANGLE, " + String.Format("{0:0.00000}", exportPrim.ParticleSys.InnerAngle) + "," + Environment.NewLine); lsl.Append(" PSYS_SRC_OUTERANGLE, " + String.Format("{0:0.00000}", exportPrim.ParticleSys.OuterAngle) + "," + Environment.NewLine); lsl.Append(" PSYS_SRC_OMEGA, " + exportPrim.ParticleSys.AngularVelocity.ToString() + "," + Environment.NewLine); - lsl.Append(" PSYS_SRC_TEXTURE, (key)\"" + exportPrim.ParticleSys.Texture.ToStringHyphenated() + "\"," + Environment.NewLine); - lsl.Append(" PSYS_SRC_TARGET_KEY, (key)\"" + exportPrim.ParticleSys.Target.ToStringHyphenated() + "\"" + Environment.NewLine); + lsl.Append(" PSYS_SRC_TEXTURE, (key)\"" + exportPrim.ParticleSys.Texture.ToString() + "\"," + Environment.NewLine); + lsl.Append(" PSYS_SRC_TARGET_KEY, (key)\"" + exportPrim.ParticleSys.Target.ToString() + "\"" + Environment.NewLine); lsl.Append(" ]);" + Environment.NewLine); lsl.Append(" }" + Environment.NewLine); @@ -121,7 +121,7 @@ namespace libsecondlife.TestClient } } - return "Couldn't find prim " + id.ToStringHyphenated(); + return "Couldn't find prim " + id.ToString(); } } } diff --git a/libsecondlife/examples/TestClient/Commands/Prims/FindObjectsCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/FindObjectsCommand.cs index 66bfde65..76db6de9 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/FindObjectsCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/FindObjectsCommand.cs @@ -46,7 +46,7 @@ namespace libsecondlife.TestClient foreach (Primitive p in prims) { string name = p.Properties.Name; if ((name != null) && (name.Contains(searchString))) - Console.WriteLine(String.Format("Object '{0}': {1}", name, p.ID.ToStringHyphenated())); + Console.WriteLine(String.Format("Object '{0}': {1}", name, p.ID.ToString())); } if (!complete) { diff --git a/libsecondlife/examples/TestClient/Commands/Prims/FindTextureCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/FindTextureCommand.cs index 34f55ae9..1e285d18 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/FindTextureCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/FindTextureCommand.cs @@ -31,7 +31,7 @@ namespace libsecondlife.TestClient if (prim.Textures.FaceTextures[faceIndex].TextureID == textureID) { Client.Log(String.Format("Primitive {0} ({1}) has face index {2} set to {3}", - prim.ID.ToStringHyphenated(), prim.LocalID, faceIndex, textureID.ToStringHyphenated()), + prim.ID.ToString(), prim.LocalID, faceIndex, textureID.ToString()), Helpers.LogLevel.Info); } } diff --git a/libsecondlife/examples/TestClient/Commands/Prims/ImportCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/ImportCommand.cs index 70272f2b..a7fe32fd 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/ImportCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/ImportCommand.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading; using System.IO; using libsecondlife; +using libsecondlife.StructuredData; namespace libsecondlife.TestClient { @@ -34,20 +35,18 @@ namespace libsecondlife.TestClient Primitive currentPrim; LLVector3 currentPosition; - AutoResetEvent primDone; + AutoResetEvent primDone = new AutoResetEvent(false); List primsCreated; List linkQueue; - uint rootLocalID = 0; - bool registeredCreateEvent = false; - + uint rootLocalID; ImporterState state = ImporterState.Idle; public ImportCommand(TestClient testClient) { Name = "import"; Description = "Import prims from an exported xml file. Usage: import inputfile.xml"; - primDone = new AutoResetEvent(false); - registeredCreateEvent = false; + + testClient.Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim); } public override string Execute(string[] args, LLUUID fromAgentID) @@ -56,37 +55,21 @@ namespace libsecondlife.TestClient return "Usage: import inputfile.xml"; string filename = args[0]; - Dictionary prims = new Dictionary(); + string xml; + List prims; - return "This command is currently under construction"; + try { xml = File.ReadAllText(filename); } + catch (Exception e) { return e.Message; } - try - { - //XmlReader reader = XmlReader.Create(filename); - //List listprims = Helpers.PrimListFromXml(reader); - //reader.Close(); - - // Create a dictionary indexed by the old local ID of the prims - //foreach (Primitive prim in listprims) - //{ - // prims.Add(prim.LocalID, prim); - //} - } - catch (Exception) - { - return "Failed to import the object XML file, maybe it doesn't exist or is in the wrong format?"; - } - - if (!registeredCreateEvent) - { - Client.Objects.OnNewPrim += new ObjectManager.NewPrimCallback(Objects_OnNewPrim); - registeredCreateEvent = true; - } + try { prims = Helpers.LLSDToPrimList(LLSDParser.DeserializeXml(xml)); } + catch (Exception e) { return "Failed to deserialize " + filename + ": " + e.Message; } // Build an organized structure from the imported prims Dictionary linksets = new Dictionary(); - foreach (Primitive prim in prims.Values) + for (int i = 0; i < prims.Count; i++) { + Primitive prim = prims[i]; + if (prim.ParentID == 0) { if (linksets.ContainsKey(prim.LocalID)) @@ -112,13 +95,11 @@ namespace libsecondlife.TestClient { state = ImporterState.RezzingParent; currentPrim = linkset.RootPrim; - // HACK: Offset the root prim position so it's not lying on top of the original + // HACK: Import the structure just above our head // We need a more elaborate solution for importing with relative or absolute offsets linkset.RootPrim.Position = Client.Self.SimPosition; linkset.RootPrim.Position.Z += 3.0f; currentPosition = linkset.RootPrim.Position; - // A better solution would move the bot to the desired position. - // or to check if we are within a certain distance of the desired position. // Rez the root prim with no rotation LLQuaternion rootRotation = linkset.RootPrim.Rotation; @@ -161,18 +142,15 @@ namespace libsecondlife.TestClient // Link and set the permissions + rotation state = ImporterState.Linking; Client.Objects.LinkPrims(Client.Network.CurrentSim, linkQueue); - if (primDone.WaitOne(100000 * linkset.Children.Count, false)) - { - Client.Objects.SetPermissions(Client.Network.CurrentSim, primIDs, - PermissionWho.Everyone | PermissionWho.Group | PermissionWho.NextOwner, - PermissionMask.All, true); + if (primDone.WaitOne(1000 * linkset.Children.Count, false)) Client.Objects.SetRotation(Client.Network.CurrentSim, rootLocalID, rootRotation); - } else - { Console.WriteLine("Warning: Failed to link {0} prims", linkQueue.Count); - } + + Client.Objects.SetPermissions(Client.Network.CurrentSim, primIDs, + PermissionWho.Everyone | PermissionWho.Group | PermissionWho.NextOwner, + PermissionMask.All, true); } else { diff --git a/libsecondlife/examples/TestClient/Commands/Prims/PrimInfoCommand.cs b/libsecondlife/examples/TestClient/Commands/Prims/PrimInfoCommand.cs index 877e68f8..888b919d 100644 --- a/libsecondlife/examples/TestClient/Commands/Prims/PrimInfoCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Prims/PrimInfoCommand.cs @@ -32,22 +32,13 @@ namespace libsecondlife.TestClient Client.Log("TextureEntry:", Helpers.LogLevel.Info); if (target.Textures != null) { - if (target.Textures.DefaultTexture != null) - { - Client.Log("DefaultTexture: " + target.Textures.DefaultTexture.TextureID.ToStringHyphenated(), - Helpers.LogLevel.Info); - } - else - { - Client.Log("DefaultTexture: null", Helpers.LogLevel.Info); - } - for (int i = 0; i < target.Textures.FaceTextures.Length; i++) { if (target.Textures.FaceTextures[i] != null) { Client.Log(String.Format("Face {0}: {1}", i, - target.Textures.FaceTextures[i].TextureID.ToStringHyphenated()), Helpers.LogLevel.Info); + target.Textures.FaceTextures[i].TextureID.ToString()), + Helpers.LogLevel.Info); } } } @@ -60,7 +51,7 @@ namespace libsecondlife.TestClient } else { - return "Could not find prim " + primID.ToStringHyphenated(); + return "Could not find prim " + primID.ToString(); } } else diff --git a/libsecondlife/examples/TestClient/Commands/Stats/RegionInfoCommand.cs b/libsecondlife/examples/TestClient/Commands/Stats/RegionInfoCommand.cs index 623de34a..c8b303f1 100644 --- a/libsecondlife/examples/TestClient/Commands/Stats/RegionInfoCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Stats/RegionInfoCommand.cs @@ -17,7 +17,7 @@ namespace libsecondlife.TestClient StringBuilder output = new StringBuilder(); output.AppendLine(Client.Network.CurrentSim.ToString()); output.Append("UUID: "); - output.AppendLine(Client.Network.CurrentSim.ID.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.ID.ToString()); uint x, y; Helpers.LongToUInts(Client.Network.CurrentSim.Handle, out x, out y); output.AppendLine(String.Format("Handle: {0} (X: {1} Y: {2})", Client.Network.CurrentSim.Handle, x, y)); @@ -26,21 +26,21 @@ namespace libsecondlife.TestClient output.Append("Flags: "); output.AppendLine(Client.Network.CurrentSim.Flags.ToString()); output.Append("TerrainBase0: "); - output.AppendLine(Client.Network.CurrentSim.TerrainBase0.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainBase0.ToString()); output.Append("TerrainBase1: "); - output.AppendLine(Client.Network.CurrentSim.TerrainBase1.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainBase1.ToString()); output.Append("TerrainBase2: "); - output.AppendLine(Client.Network.CurrentSim.TerrainBase2.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainBase2.ToString()); output.Append("TerrainBase3: "); - output.AppendLine(Client.Network.CurrentSim.TerrainBase3.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainBase3.ToString()); output.Append("TerrainDetail0: "); - output.AppendLine(Client.Network.CurrentSim.TerrainDetail0.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainDetail0.ToString()); output.Append("TerrainDetail1: "); - output.AppendLine(Client.Network.CurrentSim.TerrainDetail1.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainDetail1.ToString()); output.Append("TerrainDetail2: "); - output.AppendLine(Client.Network.CurrentSim.TerrainDetail2.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainDetail2.ToString()); output.Append("TerrainDetail3: "); - output.AppendLine(Client.Network.CurrentSim.TerrainDetail3.ToStringHyphenated()); + output.AppendLine(Client.Network.CurrentSim.TerrainDetail3.ToString()); output.Append("Water Height: "); output.AppendLine(Client.Network.CurrentSim.WaterHeight.ToString()); diff --git a/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs b/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs index 2332aae7..63832484 100644 --- a/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs @@ -54,7 +54,7 @@ namespace libsecondlife.TestClient InstantMessageDialog.MessageFromAgent, InstantMessageOnline.Online, Client.Self.SimPosition, Client.Network.CurrentSim.ID, new byte[0]); - return String.Format("Master set to {0} ({1})", masterName, Client.MasterKey.ToStringHyphenated()); + return String.Format("Master set to {0} ({1})", masterName, Client.MasterKey.ToString()); } private void KeyResolvHandler(LLUUID queryid, List matches) diff --git a/libsecondlife/examples/TestClient/Commands/System/SetMasterKeyCommand.cs b/libsecondlife/examples/TestClient/Commands/System/SetMasterKeyCommand.cs index 574f7b98..117b9dd9 100644 --- a/libsecondlife/examples/TestClient/Commands/System/SetMasterKeyCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/System/SetMasterKeyCommand.cs @@ -40,7 +40,7 @@ namespace libsecondlife.TestClient } } - return "Master set to " + Client.MasterKey.ToStringHyphenated(); + return "Master set to " + Client.MasterKey.ToString(); } } } diff --git a/libsecondlife/examples/TestClient/Commands/System/ShowEffectsCommand.cs b/libsecondlife/examples/TestClient/Commands/System/ShowEffectsCommand.cs index 43740800..45de7581 100644 --- a/libsecondlife/examples/TestClient/Commands/System/ShowEffectsCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/System/ShowEffectsCommand.cs @@ -49,8 +49,8 @@ namespace libsecondlife.TestClient if (ShowEffects) Console.WriteLine( "ViewerEffect [PointAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}", - sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, pointType, duration, - id.ToStringHyphenated()); + sourceID.ToString(), targetID.ToString(), targetPos, pointType, duration, + id.ToString()); } private void Avatars_OnLookAt(LLUUID sourceID, LLUUID targetID, LLVector3d targetPos, @@ -59,8 +59,8 @@ namespace libsecondlife.TestClient if (ShowEffects) Console.WriteLine( "ViewerEffect [LookAt]: SourceID: {0} TargetID: {1} TargetPos: {2} Type: {3} Duration: {4} ID: {5}", - sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, lookType, duration, - id.ToStringHyphenated()); + sourceID.ToString(), targetID.ToString(), targetPos, lookType, duration, + id.ToString()); } private void Avatars_OnEffect(EffectType type, LLUUID sourceID, LLUUID targetID, @@ -69,8 +69,8 @@ namespace libsecondlife.TestClient if (ShowEffects) Console.WriteLine( "ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}", - type, sourceID.ToStringHyphenated(), targetID.ToStringHyphenated(), targetPos, duration, - id.ToStringHyphenated()); + type, sourceID.ToString(), targetID.ToString(), targetPos, duration, + id.ToString()); } } } diff --git a/libsecondlife/examples/TestClient/Commands/WhoCommand.cs b/libsecondlife/examples/TestClient/Commands/WhoCommand.cs index e19507f5..7ba4a013 100644 --- a/libsecondlife/examples/TestClient/Commands/WhoCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/WhoCommand.cs @@ -28,7 +28,7 @@ namespace libsecondlife.TestClient result.AppendLine(); result.AppendFormat("{0} (Group: {1}, Location: {2}/{3}, UUID: {4})", av.Name, av.GroupName, (av.CurrentSim != null ? av.CurrentSim.Name : String.Empty), - av.Position, av.ID.ToStringHyphenated()); + av.Position, av.ID.ToString()); } ); } diff --git a/libsecondlife/examples/groupmanager/frmGroupInfo.cs b/libsecondlife/examples/groupmanager/frmGroupInfo.cs index 2fe1ec83..93477068 100644 --- a/libsecondlife/examples/groupmanager/frmGroupInfo.cs +++ b/libsecondlife/examples/groupmanager/frmGroupInfo.cs @@ -253,7 +253,7 @@ namespace groupmanager { foreach (KeyValuePair kvp in Titles) { - Console.Write("Title: " + kvp.Value.Title + " = " + kvp.Key.ToStringHyphenated()); + Console.Write("Title: " + kvp.Value.Title + " = " + kvp.Key.ToString()); if (kvp.Value.Selected) Console.WriteLine(" (Selected)"); else diff --git a/libsecondlife/examples/groupmanager/frmGroupManager.cs b/libsecondlife/examples/groupmanager/frmGroupManager.cs index df28879b..fad71b1e 100644 --- a/libsecondlife/examples/groupmanager/frmGroupManager.cs +++ b/libsecondlife/examples/groupmanager/frmGroupManager.cs @@ -57,7 +57,7 @@ namespace groupmanager foreach (Group group in Groups.Values) { - Console.WriteLine(String.Format("Adding group {0} ({1})", group.Name, group.ID.ToStringHyphenated())); + Console.WriteLine(String.Format("Adding group {0} ({1})", group.Name, group.ID.ToString())); lstGroups.Items.Add(group); } } diff --git a/libsecondlife/libsecondlife.Tests/TypeTests.cs b/libsecondlife/libsecondlife.Tests/TypeTests.cs index 7b0fa22f..aa78e916 100644 --- a/libsecondlife/libsecondlife.Tests/TypeTests.cs +++ b/libsecondlife/libsecondlife.Tests/TypeTests.cs @@ -41,8 +41,8 @@ namespace libsecondlife.Tests string one = a.ToString(); string two = b.ToString(); Assert.IsTrue(a == b); - one = a.ToStringHyphenated(); - two = b.ToStringHyphenated(); + one = a.ToString(); + two = b.ToString(); Assert.IsTrue(a == b); Assert.IsTrue(a == zeroonetwo);