Allow terrain heightmaps to be loaded directly from URIs via the remote admin plugin

See http://opensimulator.org/mantis/view.php?id=4418
Thanks StrawberryFride
See
This commit is contained in:
Justin Clark-Casey (justincc)
2009-12-04 18:26:58 +00:00
parent 07786786fc
commit c0f3a4c833
4 changed files with 53 additions and 4 deletions

View File

@@ -315,8 +315,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
if (null == terrainModule) throw new Exception("terrain module not available");
terrainModule.LoadFromFile(file);
if (Uri.IsWellFormedUriString(file, UriKind.Absolute))
{
m_log.Info("[RADMIN]: Terrain path is URL");
Uri result;
if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result))
{
// the url is valid
string fileType = file.Substring(file.LastIndexOf('/') + 1);
terrainModule.LoadFromStream(fileType, result);
}
}
else
{
terrainModule.LoadFromFile(file);
}
responseData["success"] = false;
response.Value = responseData;