* 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.0.6.1-post-fixes
parent
28caaf850c
commit
d145700115
|
@ -340,6 +340,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
|
public delegate void EstateChangeInfo(IClientAPI client, UUID invoice, UUID senderID, UInt32 param1, UInt32 param2);
|
||||||
|
|
||||||
|
public delegate void RequestTerrain(IClientAPI remoteClient, string clientFileName);
|
||||||
|
|
||||||
public delegate void BakeTerrain(IClientAPI remoteClient);
|
public delegate void BakeTerrain(IClientAPI remoteClient);
|
||||||
|
|
||||||
public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot);
|
public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot);
|
||||||
|
@ -651,6 +653,8 @@ namespace OpenSim.Framework
|
||||||
event ObjectBuy OnObjectBuy;
|
event ObjectBuy OnObjectBuy;
|
||||||
event BuyObjectInventory OnBuyObjectInventory;
|
event BuyObjectInventory OnBuyObjectInventory;
|
||||||
|
|
||||||
|
event RequestTerrain OnRequestTerrain;
|
||||||
|
|
||||||
event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
event ObjectIncludeInSearch OnObjectIncludeInSearch;
|
||||||
|
|
||||||
event UUIDNameRequest OnTeleportHomeRequest;
|
event UUIDNameRequest OnTeleportHomeRequest;
|
||||||
|
@ -906,6 +910,8 @@ namespace OpenSim.Framework
|
||||||
void SendConfirmXfer(ulong xferID, uint PacketID);
|
void SendConfirmXfer(ulong xferID, uint PacketID);
|
||||||
void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName);
|
void SendXferRequest(ulong XferID, short AssetType, UUID vFileID, byte FilePath, byte[] FileName);
|
||||||
|
|
||||||
|
void SendInitiateDownload(string simFileName, string clientFileName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send the first part of a texture. For sufficiently small textures, this may be the only packet.
|
/// Send the first part of a texture. For sufficiently small textures, this may be the only packet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -205,6 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
private ParcelAbandonRequest handlerParcelAbandonRequest;
|
private ParcelAbandonRequest handlerParcelAbandonRequest;
|
||||||
private ParcelGodForceOwner handlerParcelGodForceOwner;
|
private ParcelGodForceOwner handlerParcelGodForceOwner;
|
||||||
private ParcelReclaim handlerParcelReclaim;
|
private ParcelReclaim handlerParcelReclaim;
|
||||||
|
private RequestTerrain handlerRequestTerrain;
|
||||||
private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest;
|
private ParcelReturnObjectsRequest handlerParcelReturnObjectsRequest;
|
||||||
private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest;
|
private RegionInfoRequest handlerRegionInfoRequest; //OnRegionInfoRequest;
|
||||||
private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest;
|
private EstateCovenantRequest handlerEstateCovenantRequest; //OnEstateCovenantRequest;
|
||||||
|
@ -895,6 +896,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public event XferReceive OnXferReceive;
|
public event XferReceive OnXferReceive;
|
||||||
public event RequestXfer OnRequestXfer;
|
public event RequestXfer OnRequestXfer;
|
||||||
public event ConfirmXfer OnConfirmXfer;
|
public event ConfirmXfer OnConfirmXfer;
|
||||||
|
public event RequestTerrain OnRequestTerrain;
|
||||||
public event RezScript OnRezScript;
|
public event RezScript OnRezScript;
|
||||||
public event UpdateTaskInventory OnUpdateTaskInventory;
|
public event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
public event MoveTaskInventory OnMoveTaskItem;
|
public event MoveTaskInventory OnMoveTaskItem;
|
||||||
|
@ -2527,7 +2529,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
newPack.Header.Zerocoded = true;
|
newPack.Header.Zerocoded = true;
|
||||||
OutPacket(newPack, ThrottleOutPacketType.Asset);
|
OutPacket(newPack, ThrottleOutPacketType.Asset);
|
||||||
}
|
}
|
||||||
|
public void SendInitiateDownload(string simFileName, string clientFileName)
|
||||||
|
{
|
||||||
|
InitiateDownloadPacket newPack = new InitiateDownloadPacket();
|
||||||
|
newPack.AgentData.AgentID = AgentId;
|
||||||
|
newPack.FileData.SimFilename = Utils.StringToBytes(simFileName);
|
||||||
|
newPack.FileData.ViewerFilename = Utils.StringToBytes(clientFileName);
|
||||||
|
OutPacket(newPack, ThrottleOutPacketType.Asset);
|
||||||
|
}
|
||||||
public void SendImageFirstPart(
|
public void SendImageFirstPart(
|
||||||
ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
||||||
{
|
{
|
||||||
|
@ -5974,12 +5983,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
break;
|
break;
|
||||||
case "terrain":
|
case "terrain":
|
||||||
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
|
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(AgentId, false))
|
||||||
|
{
|
||||||
|
if (messagePacket.ParamList.Length > 0)
|
||||||
|
{
|
||||||
|
if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "bake")
|
||||||
{
|
{
|
||||||
handlerBakeTerrain = OnBakeTerrain;
|
handlerBakeTerrain = OnBakeTerrain;
|
||||||
if (handlerBakeTerrain != null)
|
if (handlerBakeTerrain != null)
|
||||||
{
|
{
|
||||||
handlerBakeTerrain(this);
|
handlerBakeTerrain(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (Utils.BytesToString(messagePacket.ParamList[0].Parameter) == "download filename")
|
||||||
|
{
|
||||||
|
if (messagePacket.ParamList.Length > 1)
|
||||||
|
{
|
||||||
|
handlerRequestTerrain = OnRequestTerrain;
|
||||||
|
if (handlerRequestTerrain != null)
|
||||||
|
{
|
||||||
|
handlerRequestTerrain(this, Utils.BytesToString(messagePacket.ParamList[1].Parameter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.Xfer
|
||||||
/// <param name="fileName"></param>
|
/// <param name="fileName"></param>
|
||||||
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
public void RequestXfer(IClientAPI remoteClient, ulong xferID, string fileName)
|
||||||
{
|
{
|
||||||
|
|
||||||
lock (NewFiles)
|
lock (NewFiles)
|
||||||
{
|
{
|
||||||
if (NewFiles.ContainsKey(fileName))
|
if (NewFiles.ContainsKey(fileName))
|
||||||
|
|
|
@ -421,6 +421,31 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleTerrainRequest(IClientAPI remote_client, string clientFileName)
|
||||||
|
{
|
||||||
|
// Save terrain here
|
||||||
|
OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule terr = m_scene.RequestModuleInterface<OpenSim.Region.Environment.Modules.World.Terrain.ITerrainModule>();
|
||||||
|
|
||||||
|
if (terr != null)
|
||||||
|
{
|
||||||
|
m_log.Warn("[CLIENT]: Got Request to Send Terrain in region " + m_scene.RegionInfo.RegionName);
|
||||||
|
if (System.IO.File.Exists(Util.dataDir() + "/terrain.raw"))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(Util.dataDir() + "/terrain.raw");
|
||||||
|
}
|
||||||
|
terr.SaveToFile(Util.dataDir() + "/terrain.raw");
|
||||||
|
|
||||||
|
System.IO.FileStream input = new System.IO.FileStream(Util.dataDir() + "/terrain.raw", System.IO.FileMode.Open);
|
||||||
|
byte[] bdata = new byte[input.Length];
|
||||||
|
input.Read(bdata, 0, (int)input.Length);
|
||||||
|
remote_client.SendAlertMessage("Terrain file written, starting download...");
|
||||||
|
m_scene.XferManager.AddNewFile("terrain.raw", bdata);
|
||||||
|
// Tell client about it
|
||||||
|
m_log.Warn("[CLIENT]: Sending Terrain to " + remote_client.Name);
|
||||||
|
remote_client.SendInitiateDownload("terrain.raw", clientFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleRegionInfoRequest(IClientAPI remote_client)
|
private void HandleRegionInfoRequest(IClientAPI remote_client)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -767,6 +792,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
||||||
client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
|
client.OnEstateDebugRegionRequest += handleEstateDebugRegionRequest;
|
||||||
client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
|
client.OnEstateTeleportOneUserHomeRequest += handleEstateTeleportOneUserHomeRequest;
|
||||||
client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest;
|
client.OnEstateTeleportAllUsersHomeRequest += handleEstateTeleportAllUsersHomeRequest;
|
||||||
|
client.OnRequestTerrain += handleTerrainRequest;
|
||||||
|
|
||||||
client.OnRegionInfoRequest += HandleRegionInfoRequest;
|
client.OnRegionInfoRequest += HandleRegionInfoRequest;
|
||||||
client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
|
client.OnEstateCovenantRequest += HandleEstateCovenantRequest;
|
||||||
|
|
|
@ -268,7 +268,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
|
||||||
public event ObjectDeselect OnObjectDeselect;
|
public event ObjectDeselect OnObjectDeselect;
|
||||||
public event RegionInfoRequest OnRegionInfoRequest;
|
public event RegionInfoRequest OnRegionInfoRequest;
|
||||||
public event EstateCovenantRequest OnEstateCovenantRequest;
|
public event EstateCovenantRequest OnEstateCovenantRequest;
|
||||||
|
public event RequestTerrain OnRequestTerrain;
|
||||||
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
|
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
|
||||||
|
|
||||||
public event FriendActionDelegate OnApproveFriendRequest;
|
public event FriendActionDelegate OnApproveFriendRequest;
|
||||||
|
@ -698,6 +698,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendInitiateDownload(string simFileName, string clientFileName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
public event CopyInventoryItem OnCopyInventoryItem;
|
public event CopyInventoryItem OnCopyInventoryItem;
|
||||||
public event MoveInventoryItem OnMoveInventoryItem;
|
public event MoveInventoryItem OnMoveInventoryItem;
|
||||||
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
public event UDPAssetUploadRequest OnAssetUploadRequest;
|
||||||
|
public event RequestTerrain OnRequestTerrain;
|
||||||
public event XferReceive OnXferReceive;
|
public event XferReceive OnXferReceive;
|
||||||
public event RequestXfer OnRequestXfer;
|
public event RequestXfer OnRequestXfer;
|
||||||
public event ConfirmXfer OnConfirmXfer;
|
public event ConfirmXfer OnConfirmXfer;
|
||||||
|
@ -615,6 +616,10 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendInitiateDownload(string simFileName, string clientFileName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
public void SendImageFirstPart(ushort numParts, UUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue