aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs26
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs24
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs68
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs82
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs2
7 files changed, 106 insertions, 106 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
index 89437c5..5414322 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
@@ -122,24 +122,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
122 122
123 IClientAPI client = presence.ControllingClient; 123 IClientAPI client = presence.ControllingClient;
124 124
125 if ((c.Type == ChatTypeEnum.Owner) && 125 if ((c.Type == ChatTypeEnum.Owner) &&
126 (null != c.SenderObject) && 126 (null != c.SenderObject) &&
127 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) 127 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
128 return; 128 return;
129 129
130 if (null == c.SenderObject) 130 if (null == c.SenderObject)
131 client.SendChatMessage(c.Message, (byte)c.Type, 131 client.SendChatMessage(c.Message, (byte)c.Type,
132 pos, c.From, LLUUID.Zero, 132 pos, c.From, LLUUID.Zero,
133 (byte)ChatSourceType.Agent, 133 (byte)ChatSourceType.Agent,
134 (byte)ChatAudibleLevel.Fully); 134 (byte)ChatAudibleLevel.Fully);
135 else 135 else
136 client.SendChatMessage(c.Message, (byte)c.Type, 136 client.SendChatMessage(c.Message, (byte)c.Type,
137 pos, c.From, LLUUID.Zero, 137 pos, c.From, LLUUID.Zero,
138 (byte)ChatSourceType.Object, 138 (byte)ChatSourceType.Object,
139 (byte)ChatAudibleLevel.Fully); 139 (byte)ChatAudibleLevel.Fully);
140 }); 140 });
141 } 141 }
142 142
143 public void SimChat(Object sender, ChatFromViewerArgs e) 143 public void SimChat(Object sender, ChatFromViewerArgs e)
144 { 144 {
145 // early return if not on public or debug channel 145 // early return if not on public or debug channel
@@ -187,13 +187,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
187 if (e.Channel == DEBUG_CHANNEL) 187 if (e.Channel == DEBUG_CHANNEL)
188 { 188 {
189 TrySendChatMessage(presence, fromPos, regionPos, 189 TrySendChatMessage(presence, fromPos, regionPos,
190 fromID, fromName, e.Type, 190 fromID, fromName, e.Type,
191 message, ChatSourceType.Object); 191 message, ChatSourceType.Object);
192 } 192 }
193 else 193 else
194 { 194 {
195 TrySendChatMessage(presence, fromPos, regionPos, 195 TrySendChatMessage(presence, fromPos, regionPos,
196 fromID, fromName, e.Type, 196 fromID, fromName, e.Type,
197 message, ChatSourceType.Agent); 197 message, ChatSourceType.Agent);
198 } 198 }
199 }); 199 });
@@ -224,16 +224,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
224 LLVector3 fromRegionPos = fromPos + regionPos; 224 LLVector3 fromRegionPos = fromPos + regionPos;
225 LLVector3 toRegionPos = presence.AbsolutePosition + regionPos; 225 LLVector3 toRegionPos = presence.AbsolutePosition + regionPos;
226 int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos)); 226 int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos));
227 227
228 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || 228 if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
229 type == ChatTypeEnum.Say && dis > m_saydistance || 229 type == ChatTypeEnum.Say && dis > m_saydistance ||
230 type == ChatTypeEnum.Shout && dis > m_shoutdistance) 230 type == ChatTypeEnum.Shout && dis > m_shoutdistance)
231 { 231 {
232 return; 232 return;
233 } 233 }
234 234
235 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView 235 // TODO: should change so the message is sent through the avatar rather than direct to the ClientView
236 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, 236 presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
237 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully); 237 fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
238 } 238 }
239 } 239 }
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
index c8d5f80..85262f5 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
43{ 43{
44 public class IRCBridgeModule : IRegionModule 44 public class IRCBridgeModule : IRegionModule
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private const int DEBUG_CHANNEL = 2147483647; 49 private const int DEBUG_CHANNEL = 2147483647;
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
68 { 68 {
69 try 69 try
70 { 70 {
71 if ((m_config = config.Configs["IRC"]) == null) 71 if ((m_config = config.Configs["IRC"]) == null)
72 { 72 {
73 m_log.InfoFormat("[IRC] module not configured"); 73 m_log.InfoFormat("[IRC] module not configured");
74 return; 74 return;
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
85 m_log.Info("[IRC] module not configured"); 85 m_log.Info("[IRC] module not configured");
86 return; 86 return;
87 } 87 }
88 88
89 lock (m_syncInit) 89 lock (m_syncInit)
90 { 90 {
91 91
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
118 m_irc_connector.Name = "IRCConnectorThread"; 118 m_irc_connector.Name = "IRCConnectorThread";
119 m_irc_connector.IsBackground = true; 119 m_irc_connector.IsBackground = true;
120 } 120 }
121 m_log.InfoFormat("[IRC] initialized for {0}, nick: {1} ", scene.RegionInfo.RegionName, 121 m_log.InfoFormat("[IRC] initialized for {0}, nick: {1} ", scene.RegionInfo.RegionName,
122 m_defaultzone); 122 m_defaultzone);
123 } 123 }
124 } 124 }
@@ -221,9 +221,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
221 221
222 if (e.Message.StartsWith("/me ") && (null != avatar)) 222 if (e.Message.StartsWith("/me ") && (null != avatar))
223 e.Message = String.Format("{0} {1}", fromName, e.Message.Substring(4)); 223 e.Message = String.Format("{0} {1}", fromName, e.Message.Substring(4));
224 224
225 // this is to keep objects from talking to IRC 225 // this is to keep objects from talking to IRC
226 if (m_irc.Connected && (avatar != null)) 226 if (m_irc.Connected && (avatar != null))
227 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); 227 m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
228 } 228 }
229 229
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
244 if ((m_irc.Enabled) && (m_irc.Connected)) 244 if ((m_irc.Enabled) && (m_irc.Connected))
245 { 245 {
246 m_log.DebugFormat("[IRC] {0} logging on", clientName); 246 m_log.DebugFormat("[IRC] {0} logging on", clientName);
247 m_irc.PrivMsg(m_irc.Nick, "Sim", 247 m_irc.PrivMsg(m_irc.Nick, "Sim",
248 String.Format("notices {0} logging on", clientName)); 248 String.Format("notices {0} logging on", clientName));
249 } 249 }
250 m_last_new_user = clientName; 250 m_last_new_user = clientName;
@@ -310,7 +310,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
310 m_log.InfoFormat("[IRC]: {0} logging out", clientName); 310 m_log.InfoFormat("[IRC]: {0} logging out", clientName);
311 } 311 }
312 312
313 if (m_last_new_user == clientName) 313 if (m_last_new_user == clientName)
314 m_last_new_user = null; 314 m_last_new_user = null;
315 } 315 }
316 } 316 }
@@ -489,7 +489,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
489 } 489 }
490 catch (Exception e) 490 catch (Exception e)
491 { 491 {
492 m_log.ErrorFormat("[IRC] cannot connect to {0}:{1}: {2}", 492 m_log.ErrorFormat("[IRC] cannot connect to {0}:{1}: {2}",
493 m_server, m_port, e.Message); 493 m_server, m_port, e.Message);
494 } 494 }
495 return m_connected; 495 return m_connected;
@@ -617,16 +617,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
617 617
618 // is message "\001ACTION foo 618 // is message "\001ACTION foo
619 // bar\001"? -> "/me foo bar" 619 // bar\001"? -> "/me foo bar"
620 if ((1 == c.Message[0]) && c.Message.Substring(1).StartsWith("ACTION")) 620 if ((1 == c.Message[0]) && c.Message.Substring(1).StartsWith("ACTION"))
621 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9)); 621 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9));
622 622
623 foreach (Scene scene in m_scenes) 623 foreach (Scene scene in m_scenes)
624 { 624 {
625 c.Scene = scene; 625 c.Scene = scene;
626 scene.EventManager.TriggerOnChatBroadcast(this, c); 626 scene.EventManager.TriggerOnChatBroadcast(this, c);
627 } 627 }
628 } 628 }
629 629
630 Thread.Sleep(150); 630 Thread.Sleep(150);
631 continue; 631 continue;
632 } 632 }
diff --git a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
index 3294049..4afbdc4 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/WorldComm/WorldCommModule.cs
@@ -569,7 +569,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
569 { 569 {
570 foreach (ListenerInfo l in list) 570 foreach (ListenerInfo l in list)
571 { 571 {
572 if(l.GetItemID() == itemID) 572 if (l.GetItemID() == itemID)
573 data.AddRange(l.GetSerializationData()); 573 data.AddRange(l.GetSerializationData());
574 } 574 }
575 } 575 }
@@ -582,14 +582,14 @@ namespace OpenSim.Region.Environment.Modules.Scripting.WorldComm
582 int idx = 0; 582 int idx = 0;
583 Object[] item = new Object[6]; 583 Object[] item = new Object[6];
584 584
585 while(idx < data.Length) 585 while (idx < data.Length)
586 { 586 {
587 Array.Copy(data, idx, item, 0, 6); 587 Array.Copy(data, idx, item, 0, 6);
588 588
589 ListenerInfo info = 589 ListenerInfo info =
590 ListenerInfo.FromData(localID, itemID, hostID, item); 590 ListenerInfo.FromData(localID, itemID, hostID, item);
591 591
592 if(!m_listeners.ContainsKey((int)item[2])) 592 if (!m_listeners.ContainsKey((int)item[2]))
593 m_listeners.Add((int)item[2], new List<ListenerInfo>()); 593 m_listeners.Add((int)item[2], new List<ListenerInfo>());
594 m_listeners[(int)item[2]].Add(info); 594 m_listeners[(int)item[2]].Add(info);
595 595
diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
index aa7a20f..79cd151 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -160,9 +160,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
160 * 160 *
161 * Generate a LLUUID channel key and add it and 161 * Generate a LLUUID channel key and add it and
162 * the prim id to dictionary <channelUUID, primUUID> 162 * the prim id to dictionary <channelUUID, primUUID>
163 * 163 *
164 * A custom channel key can be proposed. 164 * A custom channel key can be proposed.
165 * Otherwise, passing LLUUID.Zero will generate 165 * Otherwise, passing LLUUID.Zero will generate
166 * and return a random channel 166 * and return a random channel
167 * 167 *
168 * First check if there is a channel assigned for 168 * First check if there is a channel assigned for
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
index 1579485..ea74941 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
@@ -37,37 +37,37 @@ using log4net;
37using Nini.Config; 37using Nini.Config;
38 38
39namespace OpenSim.Region.Environment 39namespace OpenSim.Region.Environment
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// Method called when all the necessary assets for an archive request have been received. 42 /// Method called when all the necessary assets for an archive request have been received.
43 /// </summary> 43 /// </summary>
44 public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets); 44 public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets);
45 45
46 /// <summary> 46 /// <summary>
47 /// Handles an individual archive request 47 /// Handles an individual archive request
48 /// </summary> 48 /// </summary>
49 public class ArchiveRequest 49 public class ArchiveRequest
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private Scene m_scene; 53 private Scene m_scene;
54 private string m_savePath; 54 private string m_savePath;
55 55
56 private string m_serializedEntities; 56 private string m_serializedEntities;
57 57
58 public ArchiveRequest(Scene scene, string savePath) 58 public ArchiveRequest(Scene scene, string savePath)
59 { 59 {
60 m_scene = scene; 60 m_scene = scene;
61 m_savePath = savePath; 61 m_savePath = savePath;
62 62
63 ArchiveRegion(); 63 ArchiveRegion();
64 } 64 }
65 65
66 protected void ArchiveRegion() 66 protected void ArchiveRegion()
67 { 67 {
68 m_log.Warn("[ARCHIVER]: Archive region not yet implemented"); 68 m_log.Warn("[ARCHIVER]: Archive region not yet implemented");
69 69
70 Dictionary<LLUUID, int> textureUuids = new Dictionary<LLUUID, int>(); 70 Dictionary<LLUUID, int> textureUuids = new Dictionary<LLUUID, int>();
71 71
72 List<EntityBase> entities = m_scene.GetEntities(); 72 List<EntityBase> entities = m_scene.GetEntities();
73 73
@@ -76,14 +76,14 @@ namespace OpenSim.Region.Environment
76 if (entity is SceneObjectGroup) 76 if (entity is SceneObjectGroup)
77 { 77 {
78 SceneObjectGroup sceneObject = (SceneObjectGroup)entity; 78 SceneObjectGroup sceneObject = (SceneObjectGroup)entity;
79 79
80 foreach (SceneObjectPart part in sceneObject.GetParts()) 80 foreach (SceneObjectPart part in sceneObject.GetParts())
81 { 81 {
82 LLUUID texture = new LLUUID(part.Shape.TextureEntry, 0); 82 LLUUID texture = new LLUUID(part.Shape.TextureEntry, 0);
83 textureUuids[texture] = 1; 83 textureUuids[texture] = 1;
84 } 84 }
85 } 85 }
86 } 86 }
87 87
88 m_serializedEntities = SerializeObjects(entities); 88 m_serializedEntities = SerializeObjects(entities);
89 89
@@ -91,30 +91,30 @@ namespace OpenSim.Region.Environment
91 { 91 {
92 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count); 92 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count);
93 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", textureUuids.Count); 93 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", textureUuids.Count);
94 94
95 // Asynchronously request all the assets required to perform this archive operation 95 // Asynchronously request all the assets required to perform this archive operation
96 new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, textureUuids.Keys); 96 new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, textureUuids.Keys);
97 } 97 }
98 } 98 }
99 99
100 protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets) 100 protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets)
101 { 101 {
102 m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count); 102 m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count);
103 103
104 // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary 104 // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary
105 105
106 TarArchive archive = new TarArchive(); 106 TarArchive archive = new TarArchive();
107 107
108 archive.AddFile("prims.xml", m_serializedEntities); 108 archive.AddFile("prims.xml", m_serializedEntities);
109 109
110 foreach (LLUUID uuid in assets.Keys) 110 foreach (LLUUID uuid in assets.Keys)
111 { 111 {
112 archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data); 112 archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data);
113 } 113 }
114 114
115 archive.WriteTar(m_savePath); 115 archive.WriteTar(m_savePath);
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// Get an xml representation of the given scene objects. 119 /// Get an xml representation of the given scene objects.
120 /// </summary> 120 /// </summary>
@@ -152,38 +152,38 @@ namespace OpenSim.Region.Environment
152 /// Callback used when all the assets requested have been received. 152 /// Callback used when all the assets requested have been received.
153 /// </summary> 153 /// </summary>
154 protected AssetsRequestCallback m_assetsRequestCallback; 154 protected AssetsRequestCallback m_assetsRequestCallback;
155 155
156 /// <summary> 156 /// <summary>
157 /// Assets retrieved in this request 157 /// Assets retrieved in this request
158 /// </summary> 158 /// </summary>
159 protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>(); 159 protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>();
160 160
161 /// <summary> 161 /// <summary>
162 /// Record the number of asset replies required so we know when we've finished 162 /// Record the number of asset replies required so we know when we've finished
163 /// </summary> 163 /// </summary>
164 private int m_repliesRequired; 164 private int m_repliesRequired;
165 165
166 /// <summary> 166 /// <summary>
167 /// Asset cache used to request the assets 167 /// Asset cache used to request the assets
168 /// </summary> 168 /// </summary>
169 protected AssetCache m_assetCache; 169 protected AssetCache m_assetCache;
170 170
171 protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection<LLUUID> uuids) 171 protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection<LLUUID> uuids)
172 { 172 {
173 m_assetsRequestCallback = assetsRequestCallback; 173 m_assetsRequestCallback = assetsRequestCallback;
174 m_assetCache = assetCache; 174 m_assetCache = assetCache;
175 m_repliesRequired = uuids.Count; 175 m_repliesRequired = uuids.Count;
176 176
177 // We can stop here if there are no assets to fetch 177 // We can stop here if there are no assets to fetch
178 if (m_repliesRequired == 0) 178 if (m_repliesRequired == 0)
179 m_assetsRequestCallback(m_assets); 179 m_assetsRequestCallback(m_assets);
180 180
181 foreach (LLUUID uuid in uuids) 181 foreach (LLUUID uuid in uuids)
182 { 182 {
183 m_assetCache.GetAsset(uuid, AssetRequestCallback, true); 183 m_assetCache.GetAsset(uuid, AssetRequestCallback, true);
184 } 184 }
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// Called back by the asset cache when it has the asset 188 /// Called back by the asset cache when it has the asset
189 /// </summary> 189 /// </summary>
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment
192 public void AssetRequestCallback(LLUUID assetID, AssetBase asset) 192 public void AssetRequestCallback(LLUUID assetID, AssetBase asset)
193 { 193 {
194 m_assets[assetID] = asset; 194 m_assets[assetID] = asset;
195 195
196 if (m_assets.Count == m_repliesRequired) 196 if (m_assets.Count == m_repliesRequired)
197 { 197 {
198 m_assetsRequestCallback(m_assets); 198 m_assetsRequestCallback(m_assets);
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs
index 5e5be34..3a7518c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchive.cs
@@ -34,16 +34,16 @@ using System.Reflection;
34using log4net; 34using log4net;
35 35
36namespace OpenSim.Region.Environment 36namespace OpenSim.Region.Environment
37{ 37{
38 /// <summary> 38 /// <summary>
39 /// Temporary code to produce a tar archive in tar v7 format 39 /// Temporary code to produce a tar archive in tar v7 format
40 /// </summary> 40 /// </summary>
41 public class TarArchive 41 public class TarArchive
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 protected Dictionary<string, byte[]> m_files = new Dictionary<string, byte[]>(); 45 protected Dictionary<string, byte[]> m_files = new Dictionary<string, byte[]>();
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>
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment
55 { 55 {
56 AddFile(filePath, m_asciiEncoding.GetBytes(data)); 56 AddFile(filePath, m_asciiEncoding.GetBytes(data));
57 } 57 }
58 58
59 /// <summary> 59 /// <summary>
60 /// Add a file to the tar archive 60 /// Add a file to the tar archive
61 /// </summary> 61 /// </summary>
@@ -65,117 +65,117 @@ namespace OpenSim.Region.Environment
65 { 65 {
66 m_files[filePath] = data; 66 m_files[filePath] = data;
67 } 67 }
68 68
69 /// <summary> 69 /// <summary>
70 /// Write the raw tar archive data to a file 70 /// Write the raw tar archive data to a file
71 /// </summary> 71 /// </summary>
72 /// <returns></returns> 72 /// <returns></returns>
73 public void WriteTar(string archivePath) 73 public void WriteTar(string archivePath)
74 { 74 {
75 BinaryWriter bw = new BinaryWriter(new FileStream(archivePath, FileMode.Create)); 75 BinaryWriter bw = new BinaryWriter(new FileStream(archivePath, FileMode.Create));
76 76
77 foreach (string filePath in m_files.Keys) 77 foreach (string filePath in m_files.Keys)
78 { 78 {
79 byte[] header = new byte[512]; 79 byte[] header = new byte[512];
80 byte[] data = m_files[filePath]; 80 byte[] data = m_files[filePath];
81 81
82 //string filePath = "test.txt"; 82 //string filePath = "test.txt";
83 //byte[] data = m_asciiEncoding.GetBytes("hello\n"); 83 //byte[] data = m_asciiEncoding.GetBytes("hello\n");
84 84
85 // file path field (100) 85 // file path field (100)
86 byte[] nameBytes = m_asciiEncoding.GetBytes(filePath); 86 byte[] nameBytes = m_asciiEncoding.GetBytes(filePath);
87 int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length; 87 int nameSize = (nameBytes.Length >= 100) ? 100 : nameBytes.Length;
88 Array.Copy(nameBytes, header, nameSize); 88 Array.Copy(nameBytes, header, nameSize);
89 89
90 // file mode (8) 90 // file mode (8)
91 byte[] modeBytes = m_asciiEncoding.GetBytes("0000644"); 91 byte[] modeBytes = m_asciiEncoding.GetBytes("0000644");
92 Array.Copy(modeBytes, 0, header, 100, 7); 92 Array.Copy(modeBytes, 0, header, 100, 7);
93 93
94 // owner user id (8) 94 // owner user id (8)
95 byte[] ownerIdBytes = m_asciiEncoding.GetBytes("0000764"); 95 byte[] ownerIdBytes = m_asciiEncoding.GetBytes("0000764");
96 Array.Copy(ownerIdBytes, 0, header, 108, 7); 96 Array.Copy(ownerIdBytes, 0, header, 108, 7);
97 97
98 // group user id (8) 98 // group user id (8)
99 byte[] groupIdBytes = m_asciiEncoding.GetBytes("0000764"); 99 byte[] groupIdBytes = m_asciiEncoding.GetBytes("0000764");
100 Array.Copy(groupIdBytes, 0, header, 116, 7); 100 Array.Copy(groupIdBytes, 0, header, 116, 7);
101 101
102 // file size in bytes (12) 102 // file size in bytes (12)
103 int fileSize = data.Length; 103 int fileSize = data.Length;
104 m_log.DebugFormat("[TAR ARCHIVE]: File size of {0} is {1}", filePath, fileSize); 104 m_log.DebugFormat("[TAR ARCHIVE]: File size of {0} is {1}", filePath, fileSize);
105 105
106 byte[] fileSizeBytes = ConvertDecimalToPaddedOctalBytes(fileSize, 11); 106 byte[] fileSizeBytes = ConvertDecimalToPaddedOctalBytes(fileSize, 11);
107 107
108 Array.Copy(fileSizeBytes, 0, header, 124, 11); 108 Array.Copy(fileSizeBytes, 0, header, 124, 11);
109 109
110 // last modification time (12) 110 // last modification time (12)
111 byte[] lastModTimeBytes = m_asciiEncoding.GetBytes("11017037332"); 111 byte[] lastModTimeBytes = m_asciiEncoding.GetBytes("11017037332");
112 Array.Copy(lastModTimeBytes, 0, header, 136, 11); 112 Array.Copy(lastModTimeBytes, 0, header, 136, 11);
113 113
114 // link indicator (1) 114 // link indicator (1)
115 //header[156] = m_asciiEncoding.GetBytes("0")[0]; 115 //header[156] = m_asciiEncoding.GetBytes("0")[0];
116 header[156] = 0; 116 header[156] = 0;
117 117
118 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7); 118 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 329, 7);
119 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7); 119 Array.Copy(m_asciiEncoding.GetBytes("0000000"), 0, header, 337, 7);
120 120
121 // check sum for header block (8) [calculated last] 121 // check sum for header block (8) [calculated last]
122 Array.Copy(m_asciiEncoding.GetBytes(" "), 0, header, 148, 8); 122 Array.Copy(m_asciiEncoding.GetBytes(" "), 0, header, 148, 8);
123 123
124 int checksum = 0; 124 int checksum = 0;
125 foreach (byte b in header) 125 foreach (byte b in header)
126 { 126 {
127 checksum += b; 127 checksum += b;
128 } 128 }
129 129
130 m_log.DebugFormat("[TAR ARCHIVE]: Decimal header checksum is {0}", checksum); 130 m_log.DebugFormat("[TAR ARCHIVE]: Decimal header checksum is {0}", checksum);
131 131
132 byte[] checkSumBytes = ConvertDecimalToPaddedOctalBytes(checksum, 6); 132 byte[] checkSumBytes = ConvertDecimalToPaddedOctalBytes(checksum, 6);
133 //byte[] checkSumBytes = m_asciiEncoding.GetBytes("007520"); 133 //byte[] checkSumBytes = m_asciiEncoding.GetBytes("007520");
134 134
135 Array.Copy(checkSumBytes, 0, header, 148, 6); 135 Array.Copy(checkSumBytes, 0, header, 148, 6);
136 136
137 header[154] = 0; 137 header[154] = 0;
138 138
139 // Write out header 139 // Write out header
140 bw.Write(header); 140 bw.Write(header);
141 141
142 // Write out data 142 // Write out data
143 bw.Write(data); 143 bw.Write(data);
144 144
145 int paddingRequired = 512 - (data.Length % 512); 145 int paddingRequired = 512 - (data.Length % 512);
146 if (paddingRequired > 0) 146 if (paddingRequired > 0)
147 { 147 {
148 m_log.DebugFormat("Padding data with {0} bytes", paddingRequired); 148 m_log.DebugFormat("Padding data with {0} bytes", paddingRequired);
149 149
150 byte[] padding = new byte[paddingRequired]; 150 byte[] padding = new byte[paddingRequired];
151 bw.Write(padding); 151 bw.Write(padding);
152 } 152 }
153 } 153 }
154 154
155 // Write two consecutive 0 blocks to end the archive 155 // Write two consecutive 0 blocks to end the archive
156 byte[] finalZeroPadding = new byte[1024]; 156 byte[] finalZeroPadding = new byte[1024];
157 bw.Write(finalZeroPadding); 157 bw.Write(finalZeroPadding);
158 158
159 bw.Close(); 159 bw.Close();
160 } 160 }
161 161
162 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding) 162 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding)
163 { 163 {
164 string oString = ""; 164 string oString = "";
165 165
166 while (d > 0) 166 while (d > 0)
167 { 167 {
168 oString = Convert.ToString((byte)'0' + d & 7) + oString; 168 oString = Convert.ToString((byte)'0' + d & 7) + oString;
169 d >>= 3; 169 d >>= 3;
170 } 170 }
171 171
172 while (oString.Length < padding) 172 while (oString.Length < padding)
173 { 173 {
174 oString = "0" + oString; 174 oString = "0" + oString;
175 } 175 }
176 176
177 byte[] oBytes = m_asciiEncoding.GetBytes(oString); 177 byte[] oBytes = m_asciiEncoding.GetBytes(oString);
178 178
179 return oBytes; 179 return oBytes;
180 } 180 }
181 } 181 }
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
index 505fae3..2e8fa9e 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/FileLoaders/LLRAW.cs
@@ -112,7 +112,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain.FileLoaders
112 double t = map[x, y]; 112 double t = map[x, y];
113 int index = 0; 113 int index = 0;
114 114
115 // The lookup table is pre-sorted, so we either find an exact match or 115 // The lookup table is pre-sorted, so we either find an exact match or
116 // the next closest (smaller) match with a binary search 116 // the next closest (smaller) match with a binary search
117 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, t)); 117 index = Array.BinarySearch<HeightmapLookupValue>(LookupHeightTable, new HeightmapLookupValue(0, t));
118 if (index < 0) 118 if (index < 0)