diff options
author | Justin Clarke Casey | 2008-01-16 18:35:34 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-16 18:35:34 +0000 |
commit | 57519b6dba97d7e7a2de71af9d58c93b4750bde8 (patch) | |
tree | 9597647ee1e70e50215b90bb116fede1ca7f8e27 /OpenSim/Framework | |
parent | First part of changing prim's permission flags to use the correct enum (libsl... (diff) | |
download | opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.zip opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.gz opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.bz2 opensim-SC_OLD-57519b6dba97d7e7a2de71af9d58c93b4750bde8.tar.xz |
* Store task inventory when an object is taken into agent inventory
* This means that you can take an object from a region and rez it somewhere else, with its inventory intact.
* As for earlier, at this stage only scripts can be placed in inventory
* This isn't an efficient implementation, a better one will probably need to come along soonish
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | 97 | ||||
-rw-r--r-- | OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | 84 | ||||
-rw-r--r-- | OpenSim/Framework/TaskInventoryItem.cs | 115 |
3 files changed, 193 insertions, 103 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 26985b3..183a2f9 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs | |||
@@ -163,6 +163,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
163 | 163 | ||
164 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 164 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
165 | { | 165 | { |
166 | MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); | ||
167 | |||
166 | DataTable prims = m_primTable; | 168 | DataTable prims = m_primTable; |
167 | DataTable shapes = m_shapeTable; | 169 | DataTable shapes = m_shapeTable; |
168 | DataTable items = m_itemsTable; | 170 | DataTable items = m_itemsTable; |
@@ -187,9 +189,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
187 | String sql = String.Format("primID = '{0}'", uuid); | 189 | String sql = String.Format("primID = '{0}'", uuid); |
188 | DataRow[] itemRows = items.Select(sql); | 190 | DataRow[] itemRows = items.Select(sql); |
189 | 191 | ||
190 | foreach (DataRow itemsRow in itemRows) | 192 | foreach (DataRow itemRow in itemRows) |
191 | { | 193 | { |
192 | shapeRow.Delete(); | 194 | itemRow.Delete(); |
193 | } | 195 | } |
194 | } | 196 | } |
195 | 197 | ||
@@ -307,7 +309,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
307 | TaskInventoryItem item = buildItem(row); | 309 | TaskInventoryItem item = buildItem(row); |
308 | inventory.Add(item); | 310 | inventory.Add(item); |
309 | 311 | ||
310 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); | 312 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID); |
311 | } | 313 | } |
312 | 314 | ||
313 | prim.AddInventoryItems(inventory); | 315 | prim.AddInventoryItems(inventory); |
@@ -316,7 +318,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
316 | // every item). This data should really be stored in the prim table itself. | 318 | // every item). This data should really be stored in the prim table itself. |
317 | if (dbItemRows.Length > 0) | 319 | if (dbItemRows.Length > 0) |
318 | { | 320 | { |
319 | prim.FolderID = inventory[0].parent_id; | 321 | prim.FolderID = inventory[0].ParentID; |
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
@@ -853,27 +855,27 @@ namespace OpenSim.Framework.Data.MySQL | |||
853 | { | 855 | { |
854 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 856 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
855 | 857 | ||
856 | taskItem.item_id = new LLUUID((String)row["itemID"]); | 858 | taskItem.ItemID = new LLUUID((String)row["itemID"]); |
857 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); | 859 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); |
858 | taskItem.asset_id = new LLUUID((String)row["assetID"]); | 860 | taskItem.AssetID = new LLUUID((String)row["assetID"]); |
859 | taskItem.parent_id = new LLUUID((String)row["parentFolderID"]); | 861 | taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); |
860 | 862 | ||
861 | taskItem.inv_type = Convert.ToInt32(row["invType"]); | 863 | taskItem.InvType = Convert.ToInt32(row["invType"]); |
862 | taskItem.type = Convert.ToInt32(row["assetType"]); | 864 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
863 | 865 | ||
864 | taskItem.name = (String)row["name"]; | 866 | taskItem.Name = (String)row["name"]; |
865 | taskItem.desc = (String)row["description"]; | 867 | taskItem.Description = (String)row["description"]; |
866 | taskItem.creation_date = Convert.ToUInt32(row["creationDate"]); | 868 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
867 | taskItem.creator_id = new LLUUID((String)row["creatorID"]); | 869 | taskItem.CreatorID = new LLUUID((String)row["creatorID"]); |
868 | taskItem.owner_id = new LLUUID((String)row["ownerID"]); | 870 | taskItem.OwnerID = new LLUUID((String)row["ownerID"]); |
869 | taskItem.last_owner_id = new LLUUID((String)row["lastOwnerID"]); | 871 | taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); |
870 | taskItem.group_id = new LLUUID((String)row["groupID"]); | 872 | taskItem.GroupID = new LLUUID((String)row["groupID"]); |
871 | 873 | ||
872 | taskItem.next_owner_mask = Convert.ToUInt32(row["nextPermissions"]); | 874 | taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); |
873 | taskItem.owner_mask = Convert.ToUInt32(row["currentPermissions"]); | 875 | taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); |
874 | taskItem.base_mask = Convert.ToUInt32(row["basePermissions"]); | 876 | taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); |
875 | taskItem.everyone_mask = Convert.ToUInt32(row["everyonePermissions"]); | 877 | taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); |
876 | taskItem.group_mask = Convert.ToUInt32(row["groupPermissions"]); | 878 | taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); |
877 | 879 | ||
878 | return taskItem; | 880 | return taskItem; |
879 | } | 881 | } |
@@ -1023,26 +1025,26 @@ namespace OpenSim.Framework.Data.MySQL | |||
1023 | 1025 | ||
1024 | private void fillItemRow(DataRow row, TaskInventoryItem taskItem) | 1026 | private void fillItemRow(DataRow row, TaskInventoryItem taskItem) |
1025 | { | 1027 | { |
1026 | row["itemID"] = taskItem.item_id; | 1028 | row["itemID"] = taskItem.ItemID; |
1027 | row["primID"] = taskItem.ParentPartID; | 1029 | row["primID"] = taskItem.ParentPartID; |
1028 | row["assetID"] = taskItem.asset_id; | 1030 | row["assetID"] = taskItem.AssetID; |
1029 | row["parentFolderID"] = taskItem.parent_id; | 1031 | row["parentFolderID"] = taskItem.ParentID; |
1030 | 1032 | ||
1031 | row["invType"] = taskItem.inv_type; | 1033 | row["invType"] = taskItem.InvType; |
1032 | row["assetType"] = taskItem.type; | 1034 | row["assetType"] = taskItem.Type; |
1033 | 1035 | ||
1034 | row["name"] = taskItem.name; | 1036 | row["name"] = taskItem.Name; |
1035 | row["description"] = taskItem.desc; | 1037 | row["description"] = taskItem.Description; |
1036 | row["creationDate"] = taskItem.creation_date; | 1038 | row["creationDate"] = taskItem.CreationDate; |
1037 | row["creatorID"] = taskItem.creator_id; | 1039 | row["creatorID"] = taskItem.CreatorID; |
1038 | row["ownerID"] = taskItem.owner_id; | 1040 | row["ownerID"] = taskItem.OwnerID; |
1039 | row["lastOwnerID"] = taskItem.last_owner_id; | 1041 | row["lastOwnerID"] = taskItem.LastOwnerID; |
1040 | row["groupID"] = taskItem.group_id; | 1042 | row["groupID"] = taskItem.GroupID; |
1041 | row["nextPermissions"] = taskItem.next_owner_mask; | 1043 | row["nextPermissions"] = taskItem.NextOwnerMask; |
1042 | row["currentPermissions"] = taskItem.owner_mask; | 1044 | row["currentPermissions"] = taskItem.OwnerMask; |
1043 | row["basePermissions"] = taskItem.base_mask; | 1045 | row["basePermissions"] = taskItem.BaseMask; |
1044 | row["everyonePermissions"] = taskItem.everyone_mask; | 1046 | row["everyonePermissions"] = taskItem.EveryoneMask; |
1045 | row["groupPermissions"] = taskItem.group_mask; | 1047 | row["groupPermissions"] = taskItem.GroupMask; |
1046 | } | 1048 | } |
1047 | 1049 | ||
1048 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) | 1050 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) |
@@ -1216,11 +1218,15 @@ namespace OpenSim.Framework.Data.MySQL | |||
1216 | 1218 | ||
1217 | // Build structures for manipulation purposes | 1219 | // Build structures for manipulation purposes |
1218 | IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>(); | 1220 | IDictionary<String, DataRow> dbItemsToRemove = new Dictionary<String, DataRow>(); |
1219 | ICollection<TaskInventoryItem> itemsToAdd | 1221 | ICollection<TaskInventoryItem> itemsToAdd = new List<TaskInventoryItem>(); |
1220 | = new List<TaskInventoryItem>(); | ||
1221 | 1222 | ||
1222 | foreach (DataRow row in dbItemRows) | 1223 | foreach (DataRow row in dbItemRows) |
1223 | { | 1224 | { |
1225 | MainLog.Instance.Verbose( | ||
1226 | "DATASTORE", | ||
1227 | "Found item {0}, {1} in prim id {2}", | ||
1228 | row["name"], row["itemID"], primID); | ||
1229 | |||
1224 | dbItemsToRemove.Add((String)row["itemID"], row); | 1230 | dbItemsToRemove.Add((String)row["itemID"], row); |
1225 | } | 1231 | } |
1226 | 1232 | ||
@@ -1232,6 +1238,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
1232 | 1238 | ||
1233 | if (dbItemsToRemove.ContainsKey(rawItemId)) | 1239 | if (dbItemsToRemove.ContainsKey(rawItemId)) |
1234 | { | 1240 | { |
1241 | MainLog.Instance.Verbose( | ||
1242 | "DATASTORE", | ||
1243 | "Discarding item {0}, {1} from remove candidates for prim id {2}", | ||
1244 | items[itemId].Name, rawItemId, primID); | ||
1245 | |||
1235 | dbItemsToRemove.Remove(rawItemId); | 1246 | dbItemsToRemove.Remove(rawItemId); |
1236 | } | 1247 | } |
1237 | else | 1248 | else |
@@ -1256,8 +1267,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
1256 | { | 1267 | { |
1257 | MainLog.Instance.Verbose( | 1268 | MainLog.Instance.Verbose( |
1258 | "DATASTORE", | 1269 | "DATASTORE", |
1259 | "Adding item {0}, {1} to prim ID {1}", | 1270 | "Adding item {0}, {1} to prim ID {2}", |
1260 | newItem.name, newItem.item_id, newItem.ParentPartID); | 1271 | newItem.Name, newItem.ItemID, newItem.ParentPartID); |
1261 | 1272 | ||
1262 | DataRow newItemRow = dbItems.NewRow(); | 1273 | DataRow newItemRow = dbItems.NewRow(); |
1263 | fillItemRow(newItemRow, newItem); | 1274 | fillItemRow(newItemRow, newItem); |
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 1fd5c47..94c05e1 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs | |||
@@ -205,6 +205,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
205 | 205 | ||
206 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) | 206 | public void RemoveObject(LLUUID obj, LLUUID regionUUID) |
207 | { | 207 | { |
208 | MainLog.Instance.Verbose("DATASTORE", "Removing obj: {0} from region: {1}", obj.UUID, regionUUID); | ||
209 | |||
208 | DataTable prims = ds.Tables["prims"]; | 210 | DataTable prims = ds.Tables["prims"]; |
209 | DataTable shapes = ds.Tables["primshapes"]; | 211 | DataTable shapes = ds.Tables["primshapes"]; |
210 | DataTable items = ds.Tables["primitems"]; | 212 | DataTable items = ds.Tables["primitems"]; |
@@ -229,9 +231,9 @@ namespace OpenSim.Framework.Data.SQLite | |||
229 | String sql = String.Format("primID = '{0}'", uuid); | 231 | String sql = String.Format("primID = '{0}'", uuid); |
230 | DataRow[] itemRows = items.Select(sql); | 232 | DataRow[] itemRows = items.Select(sql); |
231 | 233 | ||
232 | foreach (DataRow itemsRow in itemRows) | 234 | foreach (DataRow itemRow in itemRows) |
233 | { | 235 | { |
234 | itemsRow.Delete(); | 236 | itemRow.Delete(); |
235 | } | 237 | } |
236 | } | 238 | } |
237 | 239 | ||
@@ -351,7 +353,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
351 | TaskInventoryItem item = buildItem(row); | 353 | TaskInventoryItem item = buildItem(row); |
352 | inventory.Add(item); | 354 | inventory.Add(item); |
353 | 355 | ||
354 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.name, item.item_id); | 356 | MainLog.Instance.Verbose("DATASTORE", "Restored item {0}, {1}", item.Name, item.ItemID); |
355 | } | 357 | } |
356 | 358 | ||
357 | prim.AddInventoryItems(inventory); | 359 | prim.AddInventoryItems(inventory); |
@@ -360,7 +362,7 @@ namespace OpenSim.Framework.Data.SQLite | |||
360 | // every item). This data should really be stored in the prim table itself. | 362 | // every item). This data should really be stored in the prim table itself. |
361 | if (dbItemRows.Length > 0) | 363 | if (dbItemRows.Length > 0) |
362 | { | 364 | { |
363 | prim.FolderID = inventory[0].parent_id; | 365 | prim.FolderID = inventory[0].ParentID; |
364 | } | 366 | } |
365 | } | 367 | } |
366 | 368 | ||
@@ -889,27 +891,27 @@ namespace OpenSim.Framework.Data.SQLite | |||
889 | { | 891 | { |
890 | TaskInventoryItem taskItem = new TaskInventoryItem(); | 892 | TaskInventoryItem taskItem = new TaskInventoryItem(); |
891 | 893 | ||
892 | taskItem.item_id = new LLUUID((String)row["itemID"]); | 894 | taskItem.ItemID = new LLUUID((String)row["itemID"]); |
893 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); | 895 | taskItem.ParentPartID = new LLUUID((String)row["primID"]); |
894 | taskItem.asset_id = new LLUUID((String)row["assetID"]); | 896 | taskItem.AssetID = new LLUUID((String)row["assetID"]); |
895 | taskItem.parent_id = new LLUUID((String)row["parentFolderID"]); | 897 | taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); |
896 | 898 | ||
897 | taskItem.inv_type = Convert.ToInt32(row["invType"]); | 899 | taskItem.InvType = Convert.ToInt32(row["invType"]); |
898 | taskItem.type = Convert.ToInt32(row["assetType"]); | 900 | taskItem.Type = Convert.ToInt32(row["assetType"]); |
899 | 901 | ||
900 | taskItem.name = (String)row["name"]; | 902 | taskItem.Name = (String)row["name"]; |
901 | taskItem.desc = (String)row["description"]; | 903 | taskItem.Description = (String)row["description"]; |
902 | taskItem.creation_date = Convert.ToUInt32(row["creationDate"]); | 904 | taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); |
903 | taskItem.creator_id = new LLUUID((String)row["creatorID"]); | 905 | taskItem.CreatorID = new LLUUID((String)row["creatorID"]); |
904 | taskItem.owner_id = new LLUUID((String)row["ownerID"]); | 906 | taskItem.OwnerID = new LLUUID((String)row["ownerID"]); |
905 | taskItem.last_owner_id = new LLUUID((String)row["lastOwnerID"]); | 907 | taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); |
906 | taskItem.group_id = new LLUUID((String)row["groupID"]); | 908 | taskItem.GroupID = new LLUUID((String)row["groupID"]); |
907 | 909 | ||
908 | taskItem.next_owner_mask = Convert.ToUInt32(row["nextPermissions"]); | 910 | taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); |
909 | taskItem.owner_mask = Convert.ToUInt32(row["currentPermissions"]); | 911 | taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); |
910 | taskItem.base_mask = Convert.ToUInt32(row["basePermissions"]); | 912 | taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); |
911 | taskItem.everyone_mask = Convert.ToUInt32(row["everyonePermissions"]); | 913 | taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); |
912 | taskItem.group_mask = Convert.ToUInt32(row["groupPermissions"]); | 914 | taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); |
913 | 915 | ||
914 | return taskItem; | 916 | return taskItem; |
915 | } | 917 | } |
@@ -1059,26 +1061,26 @@ namespace OpenSim.Framework.Data.SQLite | |||
1059 | 1061 | ||
1060 | private void fillItemRow(DataRow row, TaskInventoryItem taskItem) | 1062 | private void fillItemRow(DataRow row, TaskInventoryItem taskItem) |
1061 | { | 1063 | { |
1062 | row["itemID"] = taskItem.item_id; | 1064 | row["itemID"] = taskItem.ItemID; |
1063 | row["primID"] = taskItem.ParentPartID; | 1065 | row["primID"] = taskItem.ParentPartID; |
1064 | row["assetID"] = taskItem.asset_id; | 1066 | row["assetID"] = taskItem.AssetID; |
1065 | row["parentFolderID"] = taskItem.parent_id; | 1067 | row["parentFolderID"] = taskItem.ParentID; |
1066 | 1068 | ||
1067 | row["invType"] = taskItem.inv_type; | 1069 | row["invType"] = taskItem.InvType; |
1068 | row["assetType"] = taskItem.type; | 1070 | row["assetType"] = taskItem.Type; |
1069 | 1071 | ||
1070 | row["name"] = taskItem.name; | 1072 | row["name"] = taskItem.Name; |
1071 | row["description"] = taskItem.desc; | 1073 | row["description"] = taskItem.Description; |
1072 | row["creationDate"] = taskItem.creation_date; | 1074 | row["creationDate"] = taskItem.CreationDate; |
1073 | row["creatorID"] = taskItem.creator_id; | 1075 | row["creatorID"] = taskItem.CreatorID; |
1074 | row["ownerID"] = taskItem.owner_id; | 1076 | row["ownerID"] = taskItem.OwnerID; |
1075 | row["lastOwnerID"] = taskItem.last_owner_id; | 1077 | row["lastOwnerID"] = taskItem.LastOwnerID; |
1076 | row["groupID"] = taskItem.group_id; | 1078 | row["groupID"] = taskItem.GroupID; |
1077 | row["nextPermissions"] = taskItem.next_owner_mask; | 1079 | row["nextPermissions"] = taskItem.NextOwnerMask; |
1078 | row["currentPermissions"] = taskItem.owner_mask; | 1080 | row["currentPermissions"] = taskItem.OwnerMask; |
1079 | row["basePermissions"] = taskItem.base_mask; | 1081 | row["basePermissions"] = taskItem.BaseMask; |
1080 | row["everyonePermissions"] = taskItem.everyone_mask; | 1082 | row["everyonePermissions"] = taskItem.EveryoneMask; |
1081 | row["groupPermissions"] = taskItem.group_mask; | 1083 | row["groupPermissions"] = taskItem.GroupMask; |
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) | 1086 | private void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) |
@@ -1311,8 +1313,8 @@ namespace OpenSim.Framework.Data.SQLite | |||
1311 | { | 1313 | { |
1312 | MainLog.Instance.Verbose( | 1314 | MainLog.Instance.Verbose( |
1313 | "DATASTORE", | 1315 | "DATASTORE", |
1314 | "Adding item {0}, {1} to prim ID {1}", | 1316 | "Adding item {0}, {1} to prim ID {2}", |
1315 | newItem.name, newItem.item_id, newItem.ParentPartID); | 1317 | newItem.Name, newItem.ItemID, newItem.ParentPartID); |
1316 | 1318 | ||
1317 | DataRow newItemRow = dbItems.NewRow(); | 1319 | DataRow newItemRow = dbItems.NewRow(); |
1318 | fillItemRow(newItemRow, newItem); | 1320 | fillItemRow(newItemRow, newItem); |
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 107993b..6e163a9 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -26,11 +26,78 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections.Generic; | ||
30 | using System.Xml; | ||
31 | using System.Xml.Schema; | ||
32 | using System.Xml.Serialization; | ||
33 | |||
29 | using libsecondlife; | 34 | using libsecondlife; |
30 | using System; | 35 | using System; |
31 | 36 | ||
32 | namespace OpenSim.Framework | 37 | namespace OpenSim.Framework |
33 | { | 38 | { |
39 | public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>, IXmlSerializable | ||
40 | { | ||
41 | private static XmlSerializer tiiSerializer = new XmlSerializer(typeof(TaskInventoryItem)); | ||
42 | |||
43 | // The alternative of simply serializing the list doesn't appear to work on mono, since | ||
44 | // we get a | ||
45 | // | ||
46 | // System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0 | ||
47 | // Parameter name: length | ||
48 | // at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381 | ||
49 | // at System.Xml.Serialization.TypeTranslator.GetTypeData (System.Type runtimeType, System.String xmlDataType) [0x001f6] in /build/buildd/mono-1.2.4/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs:217 | ||
50 | // ... | ||
51 | // private static XmlSerializer tiiSerializer | ||
52 | // = new XmlSerializer(typeof(Dictionary<LLUUID, TaskInventoryItem>.ValueCollection)); | ||
53 | |||
54 | // see IXmlSerializable | ||
55 | public XmlSchema GetSchema() | ||
56 | { | ||
57 | return null; | ||
58 | } | ||
59 | |||
60 | // see IXmlSerializable | ||
61 | public void ReadXml(XmlReader reader) | ||
62 | { | ||
63 | reader.Read(); | ||
64 | while (tiiSerializer.CanDeserialize(reader)) | ||
65 | { | ||
66 | TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader); | ||
67 | Add(item.ItemID, item); | ||
68 | } | ||
69 | |||
70 | // reader.Read(); | ||
71 | // while (reader.Name.Equals("TaskInventoryItem")) | ||
72 | // { | ||
73 | // TaskInventoryItem item = (TaskInventoryItem)tiiSerializer.Deserialize(reader); | ||
74 | // Add(item.ItemID, item); | ||
75 | // } | ||
76 | |||
77 | // ICollection<TaskInventoryItem> items | ||
78 | // = (ICollection<TaskInventoryItem>)tiiSerializer.Deserialize(reader); | ||
79 | // | ||
80 | // foreach (TaskInventoryItem item in items) | ||
81 | // { | ||
82 | // Add(item.ItemID, item); | ||
83 | // } | ||
84 | } | ||
85 | |||
86 | // see IXmlSerializable | ||
87 | public void WriteXml(XmlWriter writer) | ||
88 | { | ||
89 | foreach (TaskInventoryItem item in Values) | ||
90 | { | ||
91 | tiiSerializer.Serialize(writer, item); | ||
92 | } | ||
93 | |||
94 | //tiiSerializer.Serialize(writer, Values); | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Represents an item in a task inventory | ||
100 | /// </summary> | ||
34 | public class TaskInventoryItem | 101 | public class TaskInventoryItem |
35 | { | 102 | { |
36 | /// <summary> | 103 | /// <summary> |
@@ -75,27 +142,37 @@ namespace OpenSim.Framework | |||
75 | "lsltext", | 142 | "lsltext", |
76 | String.Empty | 143 | String.Empty |
77 | }; | 144 | }; |
145 | |||
146 | /// <summary> | ||
147 | /// Reset the LLUUIDs for this item. | ||
148 | /// </summary> | ||
149 | /// <param name="partID">The new part ID to which this item belongs</param> | ||
150 | public void ResetIDs(LLUUID partID) | ||
151 | { | ||
152 | ItemID = LLUUID.Random(); | ||
153 | ParentPartID = partID; | ||
154 | } | ||
78 | 155 | ||
79 | public LLUUID item_id = LLUUID.Zero; | 156 | public LLUUID ItemID = LLUUID.Zero; |
80 | public LLUUID parent_id = LLUUID.Zero; //parent folder id | 157 | public LLUUID ParentID = LLUUID.Zero; //parent folder id |
81 | 158 | ||
82 | public uint base_mask = FULL_MASK_PERMISSIONS_GENERAL; | 159 | public uint BaseMask = FULL_MASK_PERMISSIONS_GENERAL; |
83 | public uint owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | 160 | public uint OwnerMask = FULL_MASK_PERMISSIONS_GENERAL; |
84 | public uint group_mask = FULL_MASK_PERMISSIONS_GENERAL; | 161 | public uint GroupMask = FULL_MASK_PERMISSIONS_GENERAL; |
85 | public uint everyone_mask = FULL_MASK_PERMISSIONS_GENERAL; | 162 | public uint EveryoneMask = FULL_MASK_PERMISSIONS_GENERAL; |
86 | public uint next_owner_mask = FULL_MASK_PERMISSIONS_GENERAL; | 163 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL; |
87 | public LLUUID creator_id = LLUUID.Zero; | 164 | public LLUUID CreatorID = LLUUID.Zero; |
88 | public LLUUID owner_id = LLUUID.Zero; | 165 | public LLUUID OwnerID = LLUUID.Zero; |
89 | public LLUUID last_owner_id = LLUUID.Zero; | 166 | public LLUUID LastOwnerID = LLUUID.Zero; |
90 | public LLUUID group_id = LLUUID.Zero; | 167 | public LLUUID GroupID = LLUUID.Zero; |
91 | 168 | ||
92 | public LLUUID asset_id = LLUUID.Zero; | 169 | public LLUUID AssetID = LLUUID.Zero; |
93 | public int type = 0; | 170 | public int Type = 0; |
94 | public int inv_type = 0; | 171 | public int InvType = 0; |
95 | public uint flags = 0; | 172 | public uint Flags = 0; |
96 | public string name = String.Empty; | 173 | public string Name = String.Empty; |
97 | public string desc = String.Empty; | 174 | public string Description = String.Empty; |
98 | public uint creation_date = 0; | 175 | public uint CreationDate = 0; |
99 | 176 | ||
100 | public LLUUID ParentPartID = LLUUID.Zero; | 177 | public LLUUID ParentPartID = LLUUID.Zero; |
101 | } | 178 | } |