diff options
author | Jeff Ames | 2008-06-04 09:59:27 +0000 |
---|---|---|
committer | Jeff Ames | 2008-06-04 09:59:27 +0000 |
commit | 4ec4e16c809cf86a63b736d2b7b6ad7291595a5f (patch) | |
tree | cfa896ef9057228171e2ee39c4807060101ba90b /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |
parent | * If a ThreadAbortException reaches AuthUser() then let it pass through unmol... (diff) | |
download | opensim-SC-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.zip opensim-SC-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.gz opensim-SC-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.bz2 opensim-SC-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.xz |
Formatting cleanup, minor refactoring, svn properties.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index 0c5edaa..6a3b519 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -41,10 +41,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
41 | /// </summary> | 41 | /// </summary> |
42 | public class ArchiveReadRequest | 42 | public class ArchiveReadRequest |
43 | { | 43 | { |
44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
45 | 45 | ||
46 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 46 | protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); |
47 | 47 | ||
48 | private Scene m_scene; | 48 | private Scene m_scene; |
49 | private string m_loadPath; | 49 | private string m_loadPath; |
50 | 50 | ||
@@ -55,22 +55,22 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
55 | 55 | ||
56 | DearchiveRegion(); | 56 | DearchiveRegion(); |
57 | } | 57 | } |
58 | 58 | ||
59 | protected void DearchiveRegion() | 59 | protected void DearchiveRegion() |
60 | { | 60 | { |
61 | TarArchiveReader archive = new TarArchiveReader(m_loadPath); | 61 | TarArchiveReader archive = new TarArchiveReader(m_loadPath); |
62 | 62 | ||
63 | string serializedPrims = string.Empty; | 63 | string serializedPrims = string.Empty; |
64 | 64 | ||
65 | // Just test for now by reading first file | 65 | // Just test for now by reading first file |
66 | string filePath = "ERROR"; | 66 | string filePath = "ERROR"; |
67 | 67 | ||
68 | byte[] data; | 68 | byte[] data; |
69 | while ((data = archive.ReadEntry(out filePath)) != null) | 69 | while ((data = archive.ReadEntry(out filePath)) != null) |
70 | { | 70 | { |
71 | m_log.DebugFormat( | 71 | m_log.DebugFormat( |
72 | "[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath); | 72 | "[ARCHIVER]: Successfully read {0} ({1} bytes) from archive {2}", filePath, data.Length, m_loadPath); |
73 | 73 | ||
74 | if (filePath.Equals(ArchiveConstants.PRIMS_PATH)) | 74 | if (filePath.Equals(ArchiveConstants.PRIMS_PATH)) |
75 | { | 75 | { |
76 | serializedPrims = m_asciiEncoding.GetString(data); | 76 | serializedPrims = m_asciiEncoding.GetString(data); |
@@ -78,37 +78,37 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
78 | else if (filePath.StartsWith(ArchiveConstants.TEXTURES_PATH)) | 78 | else if (filePath.StartsWith(ArchiveConstants.TEXTURES_PATH)) |
79 | { | 79 | { |
80 | // Right now we're nastily obtaining the lluuid from the filename | 80 | // Right now we're nastily obtaining the lluuid from the filename |
81 | string rawId = filePath.Remove(0, ArchiveConstants.TEXTURES_PATH.Length); | 81 | string rawId = filePath.Remove(0, ArchiveConstants.TEXTURES_PATH.Length); |
82 | rawId = rawId.Remove(rawId.Length - ArchiveConstants.TEXTURE_EXTENSION.Length); | 82 | rawId = rawId.Remove(rawId.Length - ArchiveConstants.TEXTURE_EXTENSION.Length); |
83 | 83 | ||
84 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId); | 84 | m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId); |
85 | 85 | ||
86 | // Not preserving asset name or description as of yet | 86 | // Not preserving asset name or description as of yet |
87 | AssetBase asset = new AssetBase(new LLUUID(rawId), "imported name"); | 87 | AssetBase asset = new AssetBase(new LLUUID(rawId), "imported name"); |
88 | asset.Description = "imported description"; | 88 | asset.Description = "imported description"; |
89 | 89 | ||
90 | asset.Type = (sbyte)AssetType.Texture; | 90 | asset.Type = (sbyte)AssetType.Texture; |
91 | asset.InvType = (sbyte)InventoryType.Texture; | 91 | asset.InvType = (sbyte)InventoryType.Texture; |
92 | 92 | ||
93 | asset.Data = data; | 93 | asset.Data = data; |
94 | 94 | ||
95 | m_scene.AssetCache.AddAsset(asset); | 95 | m_scene.AssetCache.AddAsset(asset); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | m_log.DebugFormat("[ARCHIVER]: Reached end of archive"); | 99 | m_log.DebugFormat("[ARCHIVER]: Reached end of archive"); |
100 | 100 | ||
101 | archive.Close(); | 101 | archive.Close(); |
102 | 102 | ||
103 | if (serializedPrims.Equals(string.Empty)) | 103 | if (serializedPrims.Equals(string.Empty)) |
104 | { | 104 | { |
105 | m_log.ErrorFormat("[ARCHIVER]: Archive did not contain a {0} file", ArchiveConstants.PRIMS_PATH); | 105 | m_log.ErrorFormat("[ARCHIVER]: Archive did not contain a {0} file", ArchiveConstants.PRIMS_PATH); |
106 | return; | 106 | return; |
107 | } | 107 | } |
108 | 108 | ||
109 | // Reload serialized prims | 109 | // Reload serialized prims |
110 | m_log.InfoFormat("[ARCHIVER]: Loading prim data"); | 110 | m_log.InfoFormat("[ARCHIVER]: Loading prim data"); |
111 | 111 | ||
112 | IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); | 112 | IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>(); |
113 | serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); | 113 | serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); |
114 | } | 114 | } |