* Changed most of the Console.WriteLine() calls to SecondLife.Log() or .DebugLog()

* Updated the TextureEntry creation to properly display jackets (shoes may still be missing, not sure)

git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@746 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2006-12-20 23:50:35 +00:00
parent 3c76af707d
commit 090eb2c066
7 changed files with 83 additions and 52 deletions

View File

@@ -84,7 +84,7 @@ namespace libsecondlife.AssetSystem
AManager.GetInventoryAsset(wearableAsset);
if (wearableAsset.AssetData.Length == 0)
{
Console.WriteLine("Retrieval failed");
Client.Log("Retrieval failed", Helpers.LogLevel.Warning);
}
try
@@ -101,13 +101,11 @@ namespace libsecondlife.AssetSystem
}
catch (Exception e)
{
Console.WriteLine("ItemID: " + wdb.ItemID);
Console.WriteLine("WearableType : " + wdb.WearableType);
Console.WriteLine("Retrieving as type: " + wearableAsset.Type);
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
Console.WriteLine(wearableAsset.AssetDataToString());
Client.Log("ItemID: " + wdb.ItemID + Environment.NewLine +
"WearableType: " + wdb.WearableType + Environment.NewLine +
"Retrieving as type: " + asset.Type + Environment.NewLine +
e.ToString() + Environment.NewLine +
asset.AssetDataToString(), Helpers.LogLevel.Error);
}
}
@@ -134,8 +132,10 @@ namespace libsecondlife.AssetSystem
case 18:
break;
default:
Console.WriteLine("Unknown order for FaceID: " + faceid);
Console.WriteLine("Your wearables define a face that we don't know the order of. Please capture a AgentSetAppearance packet for your current outfit and submit to static.sprocket@gmail.com, thanks!");
Client.Log("Unknown order for FaceID: " + faceid + Environment.NewLine +
"Your wearables define a face that we don't know the order of. Please " +
"capture a AgentSetAppearance packet for your current outfit and submit to " +
"static.sprocket@gmail.com, thanks!", Helpers.LogLevel.Info);
break;
}
}
@@ -149,6 +149,7 @@ namespace libsecondlife.AssetSystem
te2.CreateFace(14).TextureID = AgentTextureEntry.GetFace(14).TextureID;
te2.CreateFace(13).TextureID = AgentTextureEntry.GetFace(13).TextureID;
te2.CreateFace(12).TextureID = AgentTextureEntry.GetFace(12).TextureID;
// I wonder if shoes are somewhere in here?
te2.CreateFace(7).TextureID = AgentTextureEntry.GetFace(7).TextureID;
te2.CreateFace(6).TextureID = AgentTextureEntry.GetFace(6).TextureID;
te2.CreateFace(5).TextureID = AgentTextureEntry.GetFace(5).TextureID;

View File

@@ -164,8 +164,9 @@ namespace libsecondlife.AssetSystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
request.Completed.WaitOne();
item.SetAssetData(request.AssetData);
@@ -190,7 +191,7 @@ namespace libsecondlife.AssetSystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
request.Completed.WaitOne();
@@ -203,7 +204,7 @@ namespace libsecondlife.AssetSystem
private void AssetUploadCompleteCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
Packets.AssetUploadCompletePacket reply = (AssetUploadCompletePacket)packet;
@@ -214,7 +215,7 @@ namespace libsecondlife.AssetSystem
private void RequestXferCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
RequestXferPacket reply = (RequestXferPacket)packet;
@@ -228,7 +229,7 @@ namespace libsecondlife.AssetSystem
private void ConfirmXferPacketCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
ConfirmXferPacketPacket reply = (ConfirmXferPacketPacket)packet;
@@ -240,7 +241,7 @@ namespace libsecondlife.AssetSystem
private void TransferInfoCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
TransferInfoPacket reply = (TransferInfoPacket)packet;
@@ -276,7 +277,7 @@ namespace libsecondlife.AssetSystem
private void TransferPacketCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
TransferPacketPacket reply = (TransferPacketPacket)packet;

View File

@@ -91,10 +91,9 @@ namespace libsecondlife.AssetSystem
while (this.Completed.WaitOne(1000, true) == false && this.resendCount < 20) // only resend 20 times
{
//Console.WriteLine("WaitOne() timeout while uploading");
if (this.SecondsSinceLastPacket > 2)
{
Console.WriteLine("Resending Packet (more than 2 seconds since last confirm)");
slClient.Log("Resending Packet (more than 2 seconds since last confirm)", Helpers.LogLevel.Info);
this.SendCurrentPacket();
resendCount++;
}
@@ -131,13 +130,13 @@ namespace libsecondlife.AssetSystem
}
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
#endif
#if DEBUG_HEADERS
Console.WriteLine(packet.Header);
#endif
#if DEBUG_PACKETS
slClient.DebugLog(packet);
#endif
#if DEBUG_HEADERS
slClient.DebugLog(packet.Header.ToString());
#endif
}
internal void RequestXfer(ulong XferID)
@@ -167,7 +166,6 @@ namespace libsecondlife.AssetSystem
private void SendCurrentPacket()
{
// Console.WriteLine("Sending " + tr.CurrentPacket + " / " + tr.NumPackets);
Packet uploadPacket;
// technically we don't need this lock, because no state is updated here!
@@ -211,12 +209,12 @@ namespace libsecondlife.AssetSystem
slClient.Network.SendPacket(uploadPacket);
#if DEBUG_PACKETS
Console.WriteLine(uploadPacket);
#endif
#if DEBUG_HEADERS
Console.WriteLine(uploadPacket.Header);
#endif
#if DEBUG_PACKETS
slClient.DebugLog(uploadPacket);
#endif
#if DEBUG_HEADERS
slClient.DebugLog(uploadPacket.Header.ToString());
#endif
}
internal void UploadComplete(LLUUID assetID, bool success)
@@ -230,7 +228,7 @@ namespace libsecondlife.AssetSystem
else
StatusMsg = "Server returned failed";
Console.WriteLine("Upload Complete");
slClient.Log("Upload complete", Helpers.LogLevel.Info);
Completed.Set();
}
}

View File

@@ -140,12 +140,11 @@ namespace libsecondlife.AssetSystem
}
catch (Exception e)
{
Console.WriteLine("ERROR: Disk Cache directory could not be established, defaulting to Memory Cache.");
Console.WriteLine(e.Message);
slClient.Log("Disk Cache directory could not be established, defaulting to Memory Cache: " + Environment.NewLine +
e.ToString(), Helpers.LogLevel.Warning);
CacheType = CacheTypes.Memory;
}
}
// Image Packet Helpers
@@ -338,7 +337,7 @@ namespace libsecondlife.AssetSystem
public void ImageDataCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
ImageDataPacket reply = (ImageDataPacket)packet;
@@ -395,7 +394,7 @@ namespace libsecondlife.AssetSystem
public void ImagePacketCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
ImagePacketPacket reply = (ImagePacketPacket)packet;
@@ -447,7 +446,7 @@ namespace libsecondlife.AssetSystem
public void ImageNotInDatabaseCallbackHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
ImageNotInDatabasePacket reply = (ImageNotInDatabasePacket)packet;

View File

@@ -223,6 +223,38 @@ namespace libsecondlife
return System.Text.UTF8Encoding.UTF8.GetBytes(str);
}
//public static byte[] HexStringToBytes(string hexString)
//{
// string newString = "";
// char c;
// // remove all none A-F, 0-9, characters
// for (int i = 0; i < hexString.Length; i++)
// {
// c = hexString[i];
// if (IsHexDigit(c))
// newString += c;
// }
// // if odd number of characters, discard last character
// if (newString.Length % 2 != 0)
// {
// newString = newString.Substring(0, newString.Length - 1);
// }
// int byteLength = newString.Length / 2;
// byte[] bytes = new byte[byteLength];
// string hex;
// int j = 0;
// for (int i = 0; i < bytes.Length; i++)
// {
// hex = new String(new Char[] { newString[j], newString[j + 1] });
// bytes[i] = HexToByte(hex);
// j = j + 2;
// }
// return bytes;
//}
public static uint GetUnixTime()
{
return (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;

View File

@@ -275,7 +275,7 @@ namespace libsecondlife.InventorySystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
} while (!ItemCreationCompleted.WaitOne(5000, false));
}
@@ -291,7 +291,7 @@ namespace libsecondlife.InventorySystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
}
@@ -301,7 +301,7 @@ namespace libsecondlife.InventorySystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
}
@@ -320,7 +320,7 @@ namespace libsecondlife.InventorySystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
}
@@ -333,7 +333,7 @@ namespace libsecondlife.InventorySystem
slClient.Network.SendPacket(packet);
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
}
@@ -408,8 +408,10 @@ namespace libsecondlife.InventorySystem
int curTick = Environment.TickCount;
if ((curTick - LastPacketRecievedAtTick) > 10000)
{
Console.WriteLine("Time-out while waiting for packets (" + ((curTick - LastPacketRecievedAtTick) / 1000) + " seconds since last packet)");
Console.WriteLine("Current Status:");
slClient.Log("Time-out while waiting for packets (" +
((curTick - LastPacketRecievedAtTick) / 1000) + " seconds since last packet)",
Helpers.LogLevel.Warning);
//Console.WriteLine("Current Status:");
// have to make a seperate list otherwise we run into modifying the original array
// while still enumerating it.
@@ -422,7 +424,7 @@ namespace libsecondlife.InventorySystem
foreach (DownloadRequest_Folder dr in FolderDownloadStatus.Values)
{
Console.WriteLine(dr.FolderID + " " + dr.Expected + " / " + dr.Received + " / " + dr.LastReceivedAtTick);
//Console.WriteLine(dr.FolderID + " " + dr.Expected + " / " + dr.Received + " / " + dr.LastReceivedAtTick);
alRestartList.Add(dr);
}
@@ -432,10 +434,9 @@ namespace libsecondlife.InventorySystem
{
RequestFolder(dr);
}
}
slClient.Tick();
slClient.Tick();
}
}
@@ -444,7 +445,7 @@ namespace libsecondlife.InventorySystem
public void UpdateCreateInventoryItemHandler(Packet packet, Simulator simulator)
{
#if DEBUG_PACKETS
Console.WriteLine(packet);
slClient.DebugLog(packet);
#endif
if (iiCreationInProgress != null)
@@ -482,7 +483,7 @@ namespace libsecondlife.InventorySystem
}
else
{
Console.WriteLine(packet);
slClient.DebugLog(packet.ToString());
throw new Exception("Received a packet for item creation, but no such response was expected. This is probably a bad thing...");
}
}

View File

@@ -172,7 +172,6 @@ namespace libsecondlife
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Client.Log(e.ToString(), Helpers.LogLevel.Error);
}
}