aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorJeff Ames2008-06-04 09:59:27 +0000
committerJeff Ames2008-06-04 09:59:27 +0000
commit4ec4e16c809cf86a63b736d2b7b6ad7291595a5f (patch)
treecfa896ef9057228171e2ee39c4807060101ba90b /OpenSim/Region/Environment/Modules
parent* If a ThreadAbortException reaches AuthUser() then let it pass through unmol... (diff)
downloadopensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.zip
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.gz
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.bz2
opensim-SC_OLD-4ec4e16c809cf86a63b736d2b7b6ad7291595a5f.tar.xz
Formatting cleanup, minor refactoring, svn properties.
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs38
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs48
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs20
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs68
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs18
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs16
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs18
8 files changed, 115 insertions, 115 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
index 7ee7eda..16fd753 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
@@ -644,7 +644,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
644 } 644 }
645 catch (IOException) 645 catch (IOException)
646 { 646 {
647 if (m_enabled) 647 if (m_enabled)
648 { 648 {
649 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)"); 649 m_log.Error("[IRC]: ListenerRun IOException. Disconnected from IRC server ??? (ListenerRun)");
650 Reconnect(); 650 Reconnect();
@@ -848,7 +848,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
848 848
849 public void Close() 849 public void Close()
850 { 850 {
851 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing", 851 m_writer.WriteLine(String.Format("QUIT :{0} to {1} wormhole to {2} closing",
852 m_nick, m_channel, m_server)); 852 m_nick, m_channel, m_server));
853 m_writer.Flush(); 853 m_writer.Flush();
854 854
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
index 36184d2..b22ca79 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
50 #region IRegionModule Members 50 #region IRegionModule Members
51 51
52 private bool gridmode = false; 52 private bool gridmode = false;
53 53
54 54
55 public void Initialise(Scene scene, IConfigSource config) 55 public void Initialise(Scene scene, IConfigSource config)
56 { 56 {
@@ -183,13 +183,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
183 } 183 }
184 } 184 }
185 185
186 186
187 } 187 }
188 188
189 // Trusty OSG1 called method. This method also gets called from the FriendsModule 189 // Trusty OSG1 called method. This method also gets called from the FriendsModule
190 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend. 190 // Turns out the sim has to send an instant message to the user to get it to show an accepted friend.
191 /// <summary> 191 /// <summary>
192 /// 192 ///
193 /// </summary> 193 /// </summary>
194 /// <param name="msg"></param> 194 /// <param name="msg"></param>
195 private void OnGridInstantMessage(GridInstantMessage msg) 195 private void OnGridInstantMessage(GridInstantMessage msg)
@@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
207 /// Process a XMLRPC Grid Instant Message 207 /// Process a XMLRPC Grid Instant Message
208 /// </summary> 208 /// </summary>
209 /// <param name="request">XMLRPC parameters from_agent_id from_agent_session to_agent_id im_session_id timestamp 209 /// <param name="request">XMLRPC parameters from_agent_id from_agent_session to_agent_id im_session_id timestamp
210 /// from_agent_name message dialog from_group offline parent_estate_id position_x position_y position_z region_id 210 /// from_agent_name message dialog from_group offline parent_estate_id position_x position_y position_z region_id
211 /// binary_bucket region_handle</param> 211 /// binary_bucket region_handle</param>
212 /// <returns>Nothing much</returns> 212 /// <returns>Nothing much</returns>
213 protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request) 213 protected virtual XmlRpcResponse processXMLRPCGridInstantMessage(XmlRpcRequest request)
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
221 uint timestamp = 0; 221 uint timestamp = 0;
222 string fromAgentName = ""; 222 string fromAgentName = "";
223 string message = ""; 223 string message = "";
224 byte dialog = (byte)0; 224 byte dialog = (byte)0;
225 bool fromGroup = false; 225 bool fromGroup = false;
226 byte offline = (byte)0; 226 byte offline = (byte)0;
227 uint ParentEstateID=0; 227 uint ParentEstateID=0;
@@ -237,14 +237,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
237 237
238 Hashtable requestData = (Hashtable)request.Params[0]; 238 Hashtable requestData = (Hashtable)request.Params[0];
239 // Check if it's got all the data 239 // Check if it's got all the data
240 if (requestData.ContainsKey("from_agent_id") && requestData.ContainsKey("from_agent_session") 240 if (requestData.ContainsKey("from_agent_id") && requestData.ContainsKey("from_agent_session")
241 && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id") 241 && requestData.ContainsKey("to_agent_id") && requestData.ContainsKey("im_session_id")
242 && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name") 242 && requestData.ContainsKey("timestamp") && requestData.ContainsKey("from_agent_name")
243 && requestData.ContainsKey("message") && requestData.ContainsKey("dialog") 243 && requestData.ContainsKey("message") && requestData.ContainsKey("dialog")
244 && requestData.ContainsKey("from_group") 244 && requestData.ContainsKey("from_group")
245 && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id") 245 && requestData.ContainsKey("offline") && requestData.ContainsKey("parent_estate_id")
246 && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y") 246 && requestData.ContainsKey("position_x") && requestData.ContainsKey("position_y")
247 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") 247 && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id")
248 && requestData.ContainsKey("binary_bucket") && requestData.ContainsKey("region_handle")) 248 && requestData.ContainsKey("binary_bucket") && requestData.ContainsKey("region_handle"))
249 { 249 {
250 // Do the easy way of validating the UUIDs 250 // Do the easy way of validating the UUIDs
@@ -276,7 +276,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
276 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them. 276 // Bytes don't transfer well over XMLRPC, so, we Base64 Encode them.
277 byte[] dialogdata = Convert.FromBase64String((string)requestData["dialog"]); 277 byte[] dialogdata = Convert.FromBase64String((string)requestData["dialog"]);
278 dialog = dialogdata[0]; 278 dialog = dialogdata[0];
279 279
280 if ((string)requestData["from_group"] == "TRUE") 280 if ((string)requestData["from_group"] == "TRUE")
281 fromGroup = true; 281 fromGroup = true;
282 282
@@ -365,7 +365,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
365 gim.Position = new sLLVector3(Position); 365 gim.Position = new sLLVector3(Position);
366 gim.binaryBucket = binaryBucket; 366 gim.binaryBucket = binaryBucket;
367 367
368 368
369 // Trigger the Instant message in the scene. 369 // Trigger the Instant message in the scene.
370 foreach (Scene scene in m_scenes) 370 foreach (Scene scene in m_scenes)
371 { 371 {
@@ -381,7 +381,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
381 } 381 }
382 } 382 }
383 //OnGridInstantMessage(gim); 383 //OnGridInstantMessage(gim);
384 384
385 } 385 }
386 386
387 //Send response back to region calling if it was successful 387 //Send response back to region calling if it was successful
@@ -482,7 +482,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
482 else 482 else
483 { 483 {
484 lookupAgent = true; 484 lookupAgent = true;
485 485
486 486
487 } 487 }
488 } 488 }
@@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
564 else 564 else
565 { 565 {
566 // try again, but lookup user this time. 566 // try again, but lookup user this time.
567 // Warning, this must call the Async version 567 // Warning, this must call the Async version
568 // of this method or we'll be making thousands of threads 568 // of this method or we'll be making thousands of threads
569 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync 569 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
570 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC 570 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
@@ -686,7 +686,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
686 686
687 if (msg.fromGroup) 687 if (msg.fromGroup)
688 gim["from_group"] = "TRUE"; 688 gim["from_group"] = "TRUE";
689 else 689 else
690 gim["from_group"] = "FALSE"; 690 gim["from_group"] = "FALSE";
691 byte[] offlinedata = new byte[1]; offlinedata[0] = msg.offline; 691 byte[] offlinedata = new byte[1]; offlinedata[0] = msg.offline;
692 gim["offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None); 692 gim["offline"] = Convert.ToBase64String(offlinedata, Base64FormattingOptions.None);
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 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
index 1cc8877..6c341c6 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
@@ -80,16 +80,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
80 { 80 {
81 // XXX: Not a great way to iterate through face textures, but there's no 81 // XXX: Not a great way to iterate through face textures, but there's no
82 // other way to tell how many faces there actually are 82 // other way to tell how many faces there actually are
83 //int i = 0; 83 //int i = 0;
84 foreach (LLObject.TextureEntryFace texture in part.Shape.Textures.FaceTextures) 84 foreach (LLObject.TextureEntryFace texture in part.Shape.Textures.FaceTextures)
85 { 85 {
86 if (texture != null) 86 if (texture != null)
87 { 87 {
88 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++); 88 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
89 textureUuids[texture.TextureID] = 1; 89 textureUuids[texture.TextureID] = 1;
90 } 90 }
91 } 91 }
92 92
93 foreach (TaskInventoryItem tit in part.TaskInventory.Values) 93 foreach (TaskInventoryItem tit in part.TaskInventory.Values)
94 { 94 {
95 if (tit.Type == (int)InventoryType.Texture) 95 if (tit.Type == (int)InventoryType.Texture)
@@ -123,7 +123,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
123 TarArchiveWriter archive = new TarArchiveWriter(); 123 TarArchiveWriter archive = new TarArchiveWriter();
124 124
125 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities); 125 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities);
126 126
127 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar 127 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar
128 //archive.AddDir("assets"); 128 //archive.AddDir("assets");
129 129
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
132 if (assets[uuid] != null) 132 if (assets[uuid] != null)
133 { 133 {
134 archive.AddFile( 134 archive.AddFile(
135 ArchiveConstants.TEXTURES_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION, 135 ArchiveConstants.TEXTURES_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION,
136 assets[uuid].Data); 136 assets[uuid].Data);
137 } 137 }
138 else 138 else
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
142 } 142 }
143 143
144 archive.WriteTar(m_savePath); 144 archive.WriteTar(m_savePath);
145 145
146 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); 146 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath);
147 } 147 }
148 148
@@ -232,11 +232,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
232 newThread.Start(); 232 newThread.Start();
233 } 233 }
234 } 234 }
235 235
236 /// <summary> 236 /// <summary>
237 /// Perform the callback on the original requester of the assets 237 /// Perform the callback on the original requester of the assets
238 /// </summary> 238 /// </summary>
239 protected void PerformAssetsRequestCallback() 239 protected void PerformAssetsRequestCallback()
240 { 240 {
241 m_assetsRequestCallback(m_assets); 241 m_assetsRequestCallback(m_assets);
242 } 242 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
index b199d5f..463e172 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveReader.cs
@@ -39,24 +39,24 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
39 public class TarArchiveReader 39 public class TarArchiveReader
40 { 40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 42
43 protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 43 protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
44 44
45 /// <summary> 45 /// <summary>
46 /// Binary reader for the underlying stream 46 /// Binary reader for the underlying stream
47 /// </summary> 47 /// </summary>
48 protected BinaryReader m_br; 48 protected BinaryReader m_br;
49 49
50 /// <summary> 50 /// <summary>
51 /// Used to trim off null chars 51 /// Used to trim off null chars
52 /// </summary> 52 /// </summary>
53 protected char[] m_nullCharArray = new char[] { '\0' }; 53 protected char[] m_nullCharArray = new char[] { '\0' };
54 54
55 public TarArchiveReader(string archivePath) 55 public TarArchiveReader(string archivePath)
56 { 56 {
57 m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open)); 57 m_br = new BinaryReader(new FileStream(archivePath, FileMode.Open));
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// Are we at the end of the archive? 61 /// Are we at the end of the archive?
62 /// </summary> 62 /// </summary>
@@ -64,13 +64,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
64 public bool AtEof() 64 public bool AtEof()
65 { 65 {
66 // If we've reached the end of the archive we'll be in null block territory, which means 66 // If we've reached the end of the archive we'll be in null block territory, which means
67 // the next byte will be 0 67 // the next byte will be 0
68 if (m_br.PeekChar() == 0) 68 if (m_br.PeekChar() == 0)
69 return true; 69 return true;
70 70
71 return false; 71 return false;
72 } 72 }
73 73
74 /// <summary> 74 /// <summary>
75 /// Read the next entry in the tar file. 75 /// Read the next entry in the tar file.
76 /// </summary> 76 /// </summary>
@@ -79,27 +79,27 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
79 public byte[] ReadEntry(out string filePath) 79 public byte[] ReadEntry(out string filePath)
80 { 80 {
81 filePath = String.Empty; 81 filePath = String.Empty;
82 82
83 if (AtEof()) 83 if (AtEof())
84 return null; 84 return null;
85 85
86 TarHeader header = ReadHeader(); 86 TarHeader header = ReadHeader();
87 87
88 filePath = header.FilePath; 88 filePath = header.FilePath;
89 byte[] data = m_br.ReadBytes(header.FileSize); 89 byte[] data = m_br.ReadBytes(header.FileSize);
90 90
91 m_log.DebugFormat("[TAR ARCHIVE READER]: filePath {0}, fileSize {1}", filePath, header.FileSize); 91 m_log.DebugFormat("[TAR ARCHIVE READER]: filePath {0}, fileSize {1}", filePath, header.FileSize);
92 92
93 // Read the rest of the empty padding in the 512 byte block 93 // Read the rest of the empty padding in the 512 byte block
94 if (header.FileSize % 512 != 0) 94 if (header.FileSize % 512 != 0)
95 { 95 {
96 int paddingLeft = 512 - (header.FileSize % 512); 96 int paddingLeft = 512 - (header.FileSize % 512);
97 97
98 m_log.DebugFormat("[TAR ARCHIVE READER]: Reading {0} padding bytes", paddingLeft); 98 m_log.DebugFormat("[TAR ARCHIVE READER]: Reading {0} padding bytes", paddingLeft);
99 99
100 m_br.ReadBytes(paddingLeft); 100 m_br.ReadBytes(paddingLeft);
101 } 101 }
102 102
103 return data; 103 return data;
104 } 104 }
105 105
@@ -109,44 +109,44 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
109 /// </summary> 109 /// </summary>
110 /// <returns>A tar header struct.</returns> 110 /// <returns>A tar header struct.</returns>
111 protected TarHeader ReadHeader() 111 protected TarHeader ReadHeader()
112 { 112 {
113 TarHeader tarHeader = new TarHeader(); 113 TarHeader tarHeader = new TarHeader();
114 114
115 byte[] header = m_br.ReadBytes(512); 115 byte[] header = m_br.ReadBytes(512);
116 116
117 tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100); 117 tarHeader.FilePath = m_asciiEncoding.GetString(header, 0, 100);
118 tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray); 118 tarHeader.FilePath = tarHeader.FilePath.Trim(m_nullCharArray);
119 tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11); 119 tarHeader.FileSize = ConvertOctalBytesToDecimal(header, 124, 11);
120 120
121 return tarHeader; 121 return tarHeader;
122 } 122 }
123 123
124 public void Close() 124 public void Close()
125 { 125 {
126 m_br.Close(); 126 m_br.Close();
127 } 127 }
128 128
129 /// <summary> 129 /// <summary>
130 /// Convert octal bytes to a decimal representation 130 /// Convert octal bytes to a decimal representation
131 /// </summary> 131 /// </summary>
132 /// <param name="bytes"></param> 132 /// <param name="bytes"></param>
133 /// <returns></returns> 133 /// <returns></returns>
134 public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count) 134 public static int ConvertOctalBytesToDecimal(byte[] bytes, int startIndex, int count)
135 { 135 {
136 string oString = m_asciiEncoding.GetString(bytes, startIndex, count); 136 string oString = m_asciiEncoding.GetString(bytes, startIndex, count);
137 137
138 int d = 0; 138 int d = 0;
139 139
140 foreach (char c in oString) 140 foreach (char c in oString)
141 { 141 {
142 d <<= 3; 142 d <<= 3;
143 d |= c - '0'; 143 d |= c - '0';
144 } 144 }
145 145
146 return d; 146 return d;
147 } 147 }
148 } 148 }
149 149
150 public struct TarHeader 150 public struct TarHeader
151 { 151 {
152 public string FilePath; 152 public string FilePath;
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
index b7ed9f9..e0d2add 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
@@ -34,30 +34,30 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
34{ 34{
35 public interface IRegionSerialiser 35 public interface IRegionSerialiser
36 { 36 {
37 List<string> SerialiseRegion(Scene scene, string saveDir); 37 List<string> SerialiseRegion(Scene scene, string saveDir);
38 38
39 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset); 39 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset);
40 40
41 void SavePrimsToXml(Scene scene, string fileName); 41 void SavePrimsToXml(Scene scene, string fileName);
42 42
43 /// <summary> 43 /// <summary>
44 /// Load prims from the xml2 format 44 /// Load prims from the xml2 format
45 /// </summary> 45 /// </summary>
46 /// <param name="scene"></param> 46 /// <param name="scene"></param>
47 /// <param name="fileName"></param> 47 /// <param name="fileName"></param>
48 void LoadPrimsFromXml2(Scene scene, string fileName); 48 void LoadPrimsFromXml2(Scene scene, string fileName);
49 49
50 /// <summary> 50 /// <summary>
51 /// Load prims from the xml2 format 51 /// Load prims from the xml2 format
52 /// </summary> 52 /// </summary>
53 /// <param name="scene"></param> 53 /// <param name="scene"></param>
54 /// <param name="reader"></param> 54 /// <param name="reader"></param>
55 void LoadPrimsFromXml2(Scene scene, TextReader reader); 55 void LoadPrimsFromXml2(Scene scene, TextReader reader);
56 56
57 void SavePrimsToXml2(Scene scene, string fileName); 57 void SavePrimsToXml2(Scene scene, string fileName);
58 58
59 void LoadGroupFromXml2String(Scene scene, string xmlString); 59 void LoadGroupFromXml2String(Scene scene, string xmlString);
60 60
61 string SavePrimGroupToXML2String(SceneObjectGroup grp); 61 string SavePrimGroupToXML2String(SceneObjectGroup grp);
62 } 62 }
63} 63}
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index 2ac0754..5ec8026 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -56,14 +56,14 @@ namespace OpenSim.Region.Environment.Scenes
56 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 56 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
57 { 57 {
58 SceneObjectGroup obj = new SceneObjectGroup(scene, scene.RegionInfo.RegionHandle, aPrimNode.OuterXml); 58 SceneObjectGroup obj = new SceneObjectGroup(scene, scene.RegionInfo.RegionHandle, aPrimNode.OuterXml);
59 59
60 if (newIDS) 60 if (newIDS)
61 { 61 {
62 obj.ResetIDs(); 62 obj.ResetIDs();
63 } 63 }
64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes 64 //if we want this to be a import method then we need new uuids for the object to avoid any clashes
65 //obj.RegenerateFullIDs(); 65 //obj.RegenerateFullIDs();
66 66
67 scene.AddSceneObject(obj); 67 scene.AddSceneObject(obj);
68 68
69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 69 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
@@ -156,7 +156,7 @@ namespace OpenSim.Region.Environment.Scenes
156 { 156 {
157 LoadPrimsFromXml2(scene, new XmlTextReader(fileName)); 157 LoadPrimsFromXml2(scene, new XmlTextReader(fileName));
158 } 158 }
159 159
160 /// <summary> 160 /// <summary>
161 /// Load prims from the xml2 format 161 /// Load prims from the xml2 format
162 /// </summary> 162 /// </summary>
@@ -173,24 +173,24 @@ namespace OpenSim.Region.Environment.Scenes
173 /// <param name="scene"></param> 173 /// <param name="scene"></param>
174 /// <param name="reader"></param> 174 /// <param name="reader"></param>
175 protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader) 175 protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader)
176 { 176 {
177 XmlDocument doc = new XmlDocument(); 177 XmlDocument doc = new XmlDocument();
178 reader.WhitespaceHandling = WhitespaceHandling.None; 178 reader.WhitespaceHandling = WhitespaceHandling.None;
179 doc.Load(reader); 179 doc.Load(reader);
180 reader.Close(); 180 reader.Close();
181 XmlNode rootNode = doc.FirstChild; 181 XmlNode rootNode = doc.FirstChild;
182 182
183 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 183 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
184 { 184 {
185 CreatePrimFromXml(scene, aPrimNode.OuterXml); 185 CreatePrimFromXml(scene, aPrimNode.OuterXml);
186 } 186 }
187 } 187 }
188 188
189 public static void CreatePrimFromXml(Scene scene, string xmlData) 189 public static void CreatePrimFromXml(Scene scene, string xmlData)
190 { 190 {
191 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 191 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
192 LLVector3 receivedVelocity = obj.RootPart.Velocity; 192 LLVector3 receivedVelocity = obj.RootPart.Velocity;
193 //System.Console.WriteLine(obj.RootPart.Velocity.ToString()); 193 //System.Console.WriteLine(obj.RootPart.Velocity.ToString());
194 scene.AddSceneObjectFromStorage(obj); 194 scene.AddSceneObjectFromStorage(obj);
195 195
196 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 196 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index b181fe8..c7c8e39 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -86,42 +86,42 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
86 #endregion 86 #endregion
87 87
88 #region IRegionSerialiser Members 88 #region IRegionSerialiser Members
89 89
90 public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset) 90 public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset)
91 { 91 {
92 SceneXmlLoader.LoadPrimsFromXml(scene, fileName, newIDS, loadOffset); 92 SceneXmlLoader.LoadPrimsFromXml(scene, fileName, newIDS, loadOffset);
93 } 93 }
94 94
95 public void SavePrimsToXml(Scene scene, string fileName) 95 public void SavePrimsToXml(Scene scene, string fileName)
96 { 96 {
97 SceneXmlLoader.SavePrimsToXml(scene, fileName); 97 SceneXmlLoader.SavePrimsToXml(scene, fileName);
98 } 98 }
99 99
100 public void LoadPrimsFromXml2(Scene scene, string fileName) 100 public void LoadPrimsFromXml2(Scene scene, string fileName)
101 { 101 {
102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName); 102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName);
103 } 103 }
104 104
105 public void LoadPrimsFromXml2(Scene scene, TextReader reader) 105 public void LoadPrimsFromXml2(Scene scene, TextReader reader)
106 { 106 {
107 SceneXmlLoader.LoadPrimsFromXml2(scene, reader); 107 SceneXmlLoader.LoadPrimsFromXml2(scene, reader);
108 } 108 }
109 109
110 public void SavePrimsToXml2(Scene scene, string fileName) 110 public void SavePrimsToXml2(Scene scene, string fileName)
111 { 111 {
112 SceneXmlLoader.SavePrimsToXml2(scene, fileName); 112 SceneXmlLoader.SavePrimsToXml2(scene, fileName);
113 } 113 }
114 114
115 public void LoadGroupFromXml2String(Scene scene, string xmlString) 115 public void LoadGroupFromXml2String(Scene scene, string xmlString)
116 { 116 {
117 SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString); 117 SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString);
118 } 118 }
119 119
120 public string SavePrimGroupToXML2String(SceneObjectGroup grp) 120 public string SavePrimGroupToXML2String(SceneObjectGroup grp)
121 { 121 {
122 return SceneXmlLoader.SavePrimGroupToXML2String(grp); 122 return SceneXmlLoader.SavePrimGroupToXML2String(grp);
123 } 123 }
124 124
125 public List<string> SerialiseRegion(Scene scene, string saveDir) 125 public List<string> SerialiseRegion(Scene scene, string saveDir)
126 { 126 {
127 List<string> results = new List<string>(); 127 List<string> results = new List<string>();