Fix creating inventory items and folders.

The order of deserialization needed to be changed. Also corrected a bug
that caused no inventory items to be returned on login.
0.6.4-rc1
Mike Mazur 2009-03-05 08:30:15 +00:00
parent 56158443b3
commit 6994d9239d
2 changed files with 9 additions and 6 deletions

View File

@ -553,12 +553,12 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
folder.Name = String.Empty; folder.Name = String.Empty;
UUID dummyUUID; UUID dummyUUID;
ReadUUID(reader, "ID", out dummyUUID);
folder.ID = dummyUUID;
ReadUUID(reader, "Owner", out dummyUUID); ReadUUID(reader, "Owner", out dummyUUID);
folder.Owner = dummyUUID; folder.Owner = dummyUUID;
ReadUUID(reader, "ParentID", out dummyUUID); ReadUUID(reader, "ParentID", out dummyUUID);
folder.ParentID = dummyUUID; folder.ParentID = dummyUUID;
ReadUUID(reader, "ID", out dummyUUID);
folder.ID = dummyUUID;
short dummyType; short dummyType;
Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out dummyType); Int16.TryParse(reader.ReadElementContentAsString("Type", String.Empty), out dummyType);
@ -587,6 +587,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
try try
{ {
using (XmlReader reader = XmlReader.Create(stream)) using (XmlReader reader = XmlReader.Create(stream))
@ -597,22 +598,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID); UUID.TryParse(reader.ReadElementContentAsString("AvatarID", String.Empty), out agentID);
reader.ReadStartElement("Body"); reader.ReadStartElement("Body");
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
UUID dummyUUID; UUID dummyUUID;
ReadUUID(reader, "ID", out dummyUUID); ReadUUID(reader, "ID", out dummyUUID);
item.ID = dummyUUID; item.ID = dummyUUID;
ReadUUID(reader, "Owner", out dummyUUID);
item.Owner = dummyUUID;
int dummyInt; int dummyInt;
Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out dummyInt); Int32.TryParse(reader.ReadElementContentAsString("InvType", String.Empty), out dummyInt);
item.InvType = dummyInt; item.InvType = dummyInt;
ReadUUID(reader, "Folder", out dummyUUID); ReadUUID(reader, "Folder", out dummyUUID);
item.Folder = dummyUUID; item.Folder = dummyUUID;
ReadUUID(reader, "Owner", out dummyUUID);
item.Owner = dummyUUID;
ReadUUID(reader, "Creator", out dummyUUID); ReadUUID(reader, "Creator", out dummyUUID);
item.Creator = dummyUUID; item.Creator = dummyUUID;
item.Name = reader.ReadElementContentAsString("Name", String.Empty);
item.Description = reader.ReadElementContentAsString("Description", String.Empty); item.Description = reader.ReadElementContentAsString("Description", String.Empty);
uint dummyUInt; uint dummyUInt;

View File

@ -276,7 +276,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
if (Utils.TryGetOpenSimUUID(owner, out ownerID)) if (Utils.TryGetOpenSimUUID(owner, out ownerID))
{ {
inventory.UserID = ownerID; inventory.UserID = ownerID;
inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>(); inventory.Items = new Dictionary<UUID, InventoryItemBase>();
foreach (InventoryFolderWithChildren folder in folders) foreach (InventoryFolderWithChildren folder in folders)
{ {