diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs index 284a39e..17abb24 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/AssetsDearchiver.cs | |||
@@ -43,9 +43,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
43 | public class AssetsDearchiver | 43 | public class AssetsDearchiver |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 47 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Store for asset data we received before we get the metadata | 50 | /// Store for asset data we received before we get the metadata |
51 | /// </summary> | 51 | /// </summary> |
@@ -55,17 +55,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
55 | /// Asset metadata. Is null if asset metadata isn't yet available. | 55 | /// Asset metadata. Is null if asset metadata isn't yet available. |
56 | /// </summary> | 56 | /// </summary> |
57 | protected Dictionary<string, AssetMetadata> m_metadata; | 57 | protected Dictionary<string, AssetMetadata> m_metadata; |
58 | 58 | ||
59 | /// <summary> | 59 | /// <summary> |
60 | /// Cache to which dearchived assets will be added | 60 | /// Cache to which dearchived assets will be added |
61 | /// </summary> | 61 | /// </summary> |
62 | protected AssetCache m_cache; | 62 | protected AssetCache m_cache; |
63 | 63 | ||
64 | public AssetsDearchiver(AssetCache cache) | 64 | public AssetsDearchiver(AssetCache cache) |
65 | { | 65 | { |
66 | m_cache = cache; | 66 | m_cache = cache; |
67 | } | 67 | } |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Add asset data to the dearchiver | 70 | /// Add asset data to the dearchiver |
71 | /// </summary> | 71 | /// </summary> |
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
82 | ResolveAssetData(assetFilename, data); | 82 | ResolveAssetData(assetFilename, data); |
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | /// <summary> | 86 | /// <summary> |
87 | /// Add asset metadata xml | 87 | /// Add asset metadata xml |
88 | /// </summary> | 88 | /// </summary> |
@@ -90,39 +90,39 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
90 | public void AddAssetMetadata(string xml) | 90 | public void AddAssetMetadata(string xml) |
91 | { | 91 | { |
92 | m_metadata = new Dictionary<string, AssetMetadata>(); | 92 | m_metadata = new Dictionary<string, AssetMetadata>(); |
93 | 93 | ||
94 | StringReader sr = new StringReader(xml); | 94 | StringReader sr = new StringReader(xml); |
95 | XmlTextReader reader = new XmlTextReader(sr); | 95 | XmlTextReader reader = new XmlTextReader(sr); |
96 | 96 | ||
97 | reader.ReadStartElement("assets"); | 97 | reader.ReadStartElement("assets"); |
98 | reader.Read(); | 98 | reader.Read(); |
99 | 99 | ||
100 | while (reader.Name.Equals("asset")) | 100 | while (reader.Name.Equals("asset")) |
101 | { | 101 | { |
102 | reader.Read(); | 102 | reader.Read(); |
103 | 103 | ||
104 | AssetMetadata metadata = new AssetMetadata(); | 104 | AssetMetadata metadata = new AssetMetadata(); |
105 | 105 | ||
106 | string filename = reader.ReadElementString("filename"); | 106 | string filename = reader.ReadElementString("filename"); |
107 | m_log.DebugFormat("[DEARCHIVER]: Reading node {0}", filename); | 107 | m_log.DebugFormat("[DEARCHIVER]: Reading node {0}", filename); |
108 | 108 | ||
109 | metadata.Name = reader.ReadElementString("name"); | 109 | metadata.Name = reader.ReadElementString("name"); |
110 | metadata.Description = reader.ReadElementString("description"); | 110 | metadata.Description = reader.ReadElementString("description"); |
111 | metadata.AssetType = Convert.ToSByte(reader.ReadElementString("asset-type")); | 111 | metadata.AssetType = Convert.ToSByte(reader.ReadElementString("asset-type")); |
112 | 112 | ||
113 | m_metadata[filename] = metadata; | 113 | m_metadata[filename] = metadata; |
114 | 114 | ||
115 | // Read asset end tag | 115 | // Read asset end tag |
116 | reader.ReadEndElement(); | 116 | reader.ReadEndElement(); |
117 | 117 | ||
118 | reader.Read(); | 118 | reader.Read(); |
119 | } | 119 | } |
120 | 120 | ||
121 | m_log.DebugFormat("[DEARCHIVER]: Resolved {0} items of asset metadata", m_metadata.Count); | 121 | m_log.DebugFormat("[DEARCHIVER]: Resolved {0} items of asset metadata", m_metadata.Count); |
122 | 122 | ||
123 | ResolvePendingAssetData(); | 123 | ResolvePendingAssetData(); |
124 | } | 124 | } |
125 | 125 | ||
126 | /// <summary> | 126 | /// <summary> |
127 | /// Resolve asset data that we collected before receiving the metadata | 127 | /// Resolve asset data that we collected before receiving the metadata |
128 | /// </summary> | 128 | /// </summary> |
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
133 | ResolveAssetData(filename, m_assetDataAwaitingMetadata[filename]); | 133 | ResolveAssetData(filename, m_assetDataAwaitingMetadata[filename]); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | /// <summary> | 137 | /// <summary> |
138 | /// Resolve a new piece of asset data against stored metadata | 138 | /// Resolve a new piece of asset data against stored metadata |
139 | /// </summary> | 139 | /// </summary> |
@@ -143,11 +143,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
143 | { | 143 | { |
144 | // Right now we're nastily obtaining the lluuid from the filename | 144 | // Right now we're nastily obtaining the lluuid from the filename |
145 | string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); | 145 | string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); |
146 | 146 | ||
147 | if (m_metadata.ContainsKey(filename)) | 147 | if (m_metadata.ContainsKey(filename)) |
148 | { | 148 | { |
149 | AssetMetadata metadata = m_metadata[filename]; | 149 | AssetMetadata metadata = m_metadata[filename]; |
150 | 150 | ||
151 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType)) | 151 | if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(metadata.AssetType)) |
152 | { | 152 | { |
153 | string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType]; | 153 | string extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[metadata.AssetType]; |
@@ -166,11 +166,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
166 | else | 166 | else |
167 | { | 167 | { |
168 | m_log.ErrorFormat( | 168 | m_log.ErrorFormat( |
169 | "[DEARCHIVER]: Tried to dearchive data with filename {0} without any corresponding metadata", | 169 | "[DEARCHIVER]: Tried to dearchive data with filename {0} without any corresponding metadata", |
170 | assetPath); | 170 | assetPath); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | /// <summary> | 174 | /// <summary> |
175 | /// Metadata for an asset | 175 | /// Metadata for an asset |
176 | /// </summary> | 176 | /// </summary> |