diff options
author | Mike Mazur | 2009-02-04 00:01:36 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-04 00:01:36 +0000 |
commit | 0c03a48fb2060eda4d288e2d2ca4e650ce000b4b (patch) | |
tree | a90465075960c92367b0a5e62db3121e4e3a139d /OpenSim/Region/Environment/Modules/Avatar/Inventory | |
parent | * Add another object to the existing save oar test (diff) | |
download | opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.zip opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.gz opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.bz2 opensim-SC-0c03a48fb2060eda4d288e2d2ca4e650ce000b4b.tar.xz |
- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it
- trim trailing whitespace
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Inventory')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 862caa9..dcfcba3 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
46 | public class InventoryArchiveReadRequest | 46 | public class InventoryArchiveReadRequest |
47 | { | 47 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | protected Scene scene; | 50 | protected Scene scene; |
51 | protected TarArchiveReader archive; | 51 | protected TarArchiveReader archive; |
52 | private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 52 | private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); |
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
65 | InventoryItemBase item = new InventoryItemBase(); | 65 | InventoryItemBase item = new InventoryItemBase(); |
66 | StringReader sr = new StringReader(contents); | 66 | StringReader sr = new StringReader(contents); |
67 | XmlTextReader reader = new XmlTextReader(sr); | 67 | XmlTextReader reader = new XmlTextReader(sr); |
68 | 68 | ||
69 | if (contents.Equals("")) return null; | 69 | if (contents.Equals("")) return null; |
70 | 70 | ||
71 | reader.ReadStartElement("InventoryObject"); | 71 | reader.ReadStartElement("InventoryObject"); |
@@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
79 | item.InvType = System.Convert.ToInt32(reader.ReadString()); | 79 | item.InvType = System.Convert.ToInt32(reader.ReadString()); |
80 | reader.ReadEndElement(); | 80 | reader.ReadEndElement(); |
81 | reader.ReadStartElement("CreatorUUID"); | 81 | reader.ReadStartElement("CreatorUUID"); |
82 | item.Creator = UUID.Parse(reader.ReadString()); | 82 | item.Creator = UUID.Parse(reader.ReadString()); |
83 | reader.ReadEndElement(); | 83 | reader.ReadEndElement(); |
84 | reader.ReadStartElement("CreationDate"); | 84 | reader.ReadStartElement("CreationDate"); |
85 | item.CreationDate = System.Convert.ToInt32(reader.ReadString()); | 85 | item.CreationDate = System.Convert.ToInt32(reader.ReadString()); |
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | reader.ReadStartElement("Description"); | 97 | reader.ReadStartElement("Description"); |
98 | item.Description = reader.ReadString(); | 98 | item.Description = reader.ReadString(); |
99 | reader.ReadEndElement(); | 99 | reader.ReadEndElement(); |
100 | } | 100 | } |
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
145 | int successfulAssetRestores = 0; | 145 | int successfulAssetRestores = 0; |
146 | int failedAssetRestores = 0; | 146 | int failedAssetRestores = 0; |
147 | int successfulItemRestores = 0; | 147 | int successfulItemRestores = 0; |
148 | 148 | ||
149 | UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); | 149 | UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); |
150 | if (null == userProfile) | 150 | if (null == userProfile) |
151 | { | 151 | { |
@@ -157,28 +157,28 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
157 | if (null == userInfo) | 157 | if (null == userInfo) |
158 | { | 158 | { |
159 | m_log.ErrorFormat( | 159 | m_log.ErrorFormat( |
160 | "[CONSOLE]: Failed to find user info for {0} {1} {2}", | 160 | "[CONSOLE]: Failed to find user info for {0} {1} {2}", |
161 | firstName, lastName, userProfile.ID); | 161 | firstName, lastName, userProfile.ID); |
162 | 162 | ||
163 | return; | 163 | return; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (!userInfo.HasReceivedInventory) | 166 | if (!userInfo.HasReceivedInventory) |
167 | { | 167 | { |
168 | m_log.ErrorFormat( | 168 | m_log.ErrorFormat( |
169 | "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", | 169 | "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", |
170 | firstName, lastName, userProfile.ID); | 170 | firstName, lastName, userProfile.ID); |
171 | 171 | ||
172 | return; | 172 | return; |
173 | } | 173 | } |
174 | 174 | ||
175 | InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); | 175 | InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); |
176 | 176 | ||
177 | if (null == inventoryFolder) | 177 | if (null == inventoryFolder) |
178 | { | 178 | { |
179 | // TODO: Later on, automatically create this folder if it does not exist | 179 | // TODO: Later on, automatically create this folder if it does not exist |
180 | m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); | 180 | m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); |
181 | 181 | ||
182 | return; | 182 | return; |
183 | } | 183 | } |
184 | 184 | ||
@@ -202,17 +202,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
202 | else | 202 | else |
203 | { | 203 | { |
204 | InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); | 204 | InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); |
205 | 205 | ||
206 | if (item != null) | 206 | if (item != null) |
207 | { | 207 | { |
208 | item.Creator = userProfile.ID; | 208 | item.Creator = userProfile.ID; |
209 | item.Owner = userProfile.ID; | 209 | item.Owner = userProfile.ID; |
210 | 210 | ||
211 | // Reset folder ID to the one in which we want to load it | 211 | // Reset folder ID to the one in which we want to load it |
212 | // TODO: Properly restore entire folder structure. At the moment all items are dumped in this | 212 | // TODO: Properly restore entire folder structure. At the moment all items are dumped in this |
213 | // single folder no matter where in the saved folder structure they are. | 213 | // single folder no matter where in the saved folder structure they are. |
214 | item.Folder = inventoryFolder.ID; | 214 | item.Folder = inventoryFolder.ID; |
215 | 215 | ||
216 | userInfo.AddItem(item); | 216 | userInfo.AddItem(item); |
217 | successfulItemRestores++; | 217 | successfulItemRestores++; |
218 | } | 218 | } |
@@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
258 | 258 | ||
259 | AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); | 259 | AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); |
260 | 260 | ||
261 | asset.Type = assetType; | 261 | asset.Metadata.Type = assetType; |
262 | asset.Data = data; | 262 | asset.Data = data; |
263 | 263 | ||
264 | scene.AssetCache.AddAsset(asset); | 264 | scene.AssetCache.AddAsset(asset); |