From c0f3a4c8332f235e998714214011c5412bdcacf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Dec 2009 18:26:58 +0000 Subject: 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 --- .../RemoteController/RemoteAdminPlugin.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3149eaa..adf7967 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -315,8 +315,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController ITerrainModule terrainModule = region.RequestModuleInterface(); 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; -- cgit v1.1