diff options
author | Teravus Ovares | 2008-11-10 23:56:58 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-11-10 23:56:58 +0000 |
commit | d1457001150d7af6faf2a11e59b895320c6e3e9b (patch) | |
tree | e330afa46bdbafb24ec7bd8893a9c582c6718f68 /OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |
parent | fix README.txt to be 0.6 (diff) | |
download | opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.zip opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.gz opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.bz2 opensim-SC_OLD-d1457001150d7af6faf2a11e59b895320c6e3e9b.tar.xz |
* Commit allows downloading of the .raw terrain from the estate tools.
* Implements the SendInitiateDownload method in IClientAPI
* Uses the ITerrainModule Interface to write a terrain file to disk then uses a FileStream to read the binary file from the disk and put it in a byte array. and save to the xFer list.
* It then tells the client to download the file and the client initiates an Xfer request.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 041bba5..c38d502 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs | |||
@@ -421,6 +421,31 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | private void handleTerrainRequest(IClientAPI remote_client, string clientFileName) | ||
425 | { | ||
426 | // Save terrain here | ||
427 | OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule terr = m_scene.RequestModuleInterface<OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule>(); | ||
428 | |||
429 | if (terr != null) | ||
430 | { | ||
431 | m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName); | ||
432 | if (System.IO.File.Exists(Util.dataDir() + "/terrain.raw")) | ||
433 | { | ||
434 | System.IO.File.Delete(Util.dataDir() + "/terrain.raw"); | ||
435 | } | ||
436 | terr.SaveToFile(Util.dataDir() + "/terrain.raw"); | ||
437 | |||
438 | System.IO.FileStream input = new System.IO.FileStream(Util.dataDir() + "/terrain.raw", System.IO.FileMode.Open); | ||
439 | byte[] bdata = new byte[input.Length]; | ||
440 | input.Read(bdata, 0, (int)input.Length); | ||
441 | remote_client.SendAlertMessage("Terrain file written, starting download..."); | ||
442 | m_scene.XferManager.AddNewFile("terrain.raw", bdata); | ||
443 | // Tell client about it | ||
444 | m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name); | ||
445 | remote_client.SendInitiateDownload("terrain.raw", clientFileName); | ||
446 | } | ||
447 | } | ||
448 | |||
424 | private void HandleRegionInfoRequest(IClientAPI remote_client) | 449 | private void HandleRegionInfoRequest(IClientAPI remote_client) |
425 | { | 450 | { |
426 | 451 | ||
@@ -767,6 +792,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate | |||
767 | client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; | 792 | client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest; |
768 | client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; | 793 | client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest; |
769 | client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest; | 794 | client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest; |
795 | client.OnRequestTerrain += handleTerrainRequest; | ||
770 | 796 | ||
771 | client.OnRegionInfoRequest += HandleRegionInfoRequest; | 797 | client.OnRegionInfoRequest += HandleRegionInfoRequest; |
772 | client.OnEstateCovenantRequest += HandleEstateCovenantRequest; | 798 | client.OnEstateCovenantRequest += HandleEstateCovenantRequest; |