mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
fix merge
This commit is contained in:
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
|
||||
private CapsHandlers m_capsHandlers;
|
||||
|
||||
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
||||
private Dictionary<string, PollServiceEventArgs> m_pollServiceHandlers
|
||||
= new Dictionary<string, PollServiceEventArgs>();
|
||||
|
||||
private Dictionary<string, string> m_externalCapsHandlers = new Dictionary<string, string>();
|
||||
@@ -160,7 +160,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
public void RegisterPollHandler(string capName, PollServiceEventArgs pollServiceHandler)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
|
||||
// "[CAPS]: Registering handler with name {0}, url {1} for {2}",
|
||||
// capName, pollServiceHandler.Url, m_agentID, m_regionName);
|
||||
|
||||
m_pollServiceHandlers.Add(capName, pollServiceHandler);
|
||||
@@ -170,7 +170,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
// uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||
// string protocol = "http";
|
||||
// string hostName = m_httpListenerHostName;
|
||||
//
|
||||
//
|
||||
// if (MainServer.Instance.UseSSL)
|
||||
// {
|
||||
// hostName = MainServer.Instance.SSLCommonName;
|
||||
@@ -238,7 +238,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
string hostName = m_httpListenerHostName;
|
||||
uint port = (MainServer.Instance == null) ? 0 : MainServer.Instance.Port;
|
||||
string protocol = "http";
|
||||
|
||||
|
||||
if (MainServer.Instance.UseSSL)
|
||||
{
|
||||
hostName = MainServer.Instance.SSLCommonName;
|
||||
|
||||
@@ -112,9 +112,9 @@ namespace OpenSim.Framework.Capabilities
|
||||
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[idx].Path);
|
||||
m_capsHandlers.Remove(idx);
|
||||
}
|
||||
|
||||
|
||||
if (null == value) return;
|
||||
|
||||
|
||||
m_capsHandlers[idx] = value;
|
||||
m_httpListener.AddStreamHandler(value);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
Hashtable caps = new Hashtable();
|
||||
string protocol = "http://";
|
||||
|
||||
|
||||
if (m_useSSL)
|
||||
protocol = "https://";
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
int page_size = (string.IsNullOrEmpty(psize) ? 500 : Int32.Parse(psize));
|
||||
int page_number = (string.IsNullOrEmpty(pnumber) ? 1 : Int32.Parse(pnumber));
|
||||
|
||||
|
||||
// Full content request
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
//httpResponse.ContentLength = ??;
|
||||
|
||||
@@ -44,7 +44,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class FetchInvDescHandler
|
||||
public class FetchInvDescHandler
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -54,13 +54,13 @@ namespace OpenSim.Capabilities.Handlers
|
||||
private IScene m_Scene;
|
||||
// private object m_fetchLock = new Object();
|
||||
|
||||
public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
|
||||
public FetchInvDescHandler(IInventoryService invService, ILibraryService libService, IScene s)
|
||||
{
|
||||
m_InventoryService = invService;
|
||||
m_LibraryService = libService;
|
||||
m_Scene = s;
|
||||
}
|
||||
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
//m_log.DebugFormat("[XXX]: FetchInventoryDescendentsRequest in {0}, {1}", (m_Scene == null) ? "none" : m_Scene.Name, request);
|
||||
@@ -72,14 +72,14 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// correctly mark it as a uuid
|
||||
//
|
||||
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
|
||||
|
||||
|
||||
// another hack <integer>1</integer> results in a
|
||||
// System.ArgumentException: Object type System.Int32 cannot
|
||||
// be converted to target type: System.Boolean
|
||||
//
|
||||
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
|
||||
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
|
||||
|
||||
|
||||
Hashtable hash = new Hashtable();
|
||||
try
|
||||
{
|
||||
@@ -90,9 +90,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||
m_log.ErrorFormat("[WEB FETCH INV DESC HANDLER]: Fetch error: {0}{1}" + e.Message, e.StackTrace);
|
||||
m_log.Error("Request: " + request);
|
||||
}
|
||||
|
||||
|
||||
ArrayList foldersrequested = (ArrayList)hash["folders"];
|
||||
|
||||
|
||||
StringBuilder tmpresponse = new StringBuilder(1024);
|
||||
StringBuilder tmpbadfolders = new StringBuilder(1024);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
|
||||
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
|
||||
items = new InventoryItemBase[itemsRequested.Count];
|
||||
items = new InventoryItemBase[itemsRequested.Count];
|
||||
foreach (UUID id in itemIDs)
|
||||
items[i++] = m_inventoryService.GetItem(m_agentID, id);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||
string request = "<llsd><map><key>items</key><array><map><key>item_id</key><uuid>";
|
||||
request += "10000000-0000-0000-0000-000000000001"; // Notecard 1
|
||||
request += "</uuid></map></array></map></llsd>";
|
||||
|
||||
|
||||
string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
|
||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||
string request = "<llsd><map><key>folders</key><array><map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>";
|
||||
request += m_rootFolderID;
|
||||
request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map></array></map></llsd>";
|
||||
|
||||
|
||||
string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp);
|
||||
|
||||
Assert.That(llsdresponse != null, Is.True, "Incorrect null response");
|
||||
@@ -203,7 +203,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests
|
||||
|
||||
// Make sure that the note card link is included
|
||||
Assert.That(llsdresponse.Contains("Link to notecard"), Is.True, "Link to notecard is missing");
|
||||
|
||||
|
||||
//Make sure the notecard item itself is included
|
||||
Assert.That(llsdresponse.Contains("Test Notecard 2"), Is.True, "Notecard 2 item (the source) is missing");
|
||||
|
||||
|
||||
@@ -87,12 +87,12 @@ namespace OpenSim.Capabilities.Handlers
|
||||
OSDMap osdname = new OSDMap();
|
||||
if(parts[0] == "Unknown")
|
||||
{
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1));
|
||||
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
|
||||
osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8));
|
||||
osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1));
|
||||
}
|
||||
osdname["display_name"] = OSD.FromString(kvp.Value);
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
if (m_UserManagement == null)
|
||||
throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
|
||||
|
||||
|
||||
server.AddStreamHandler(
|
||||
new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
private IAssetService m_assetService;
|
||||
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
|
||||
public GetTextureHandler(IAssetService assService)
|
||||
{
|
||||
m_assetService = assService;
|
||||
@@ -83,7 +83,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
|
||||
|
||||
|
||||
string[] formats;
|
||||
if (!string.IsNullOrEmpty(format))
|
||||
{
|
||||
@@ -129,7 +129,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="httpRequest"></param>
|
||||
/// <param name="httpResponse"></param>
|
||||
@@ -190,7 +190,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
//response = new Hashtable();
|
||||
|
||||
|
||||
|
||||
//WriteTextureData(request,response,null,format);
|
||||
// not found
|
||||
//m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||
@@ -287,7 +287,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
response["content_type"] = texture.Metadata.ContentType;
|
||||
else
|
||||
response["content_type"] = "image/" + format;
|
||||
|
||||
|
||||
response["bin_response_data"] = texture.Data;
|
||||
response["int_bytes"] = texture.Data.Length;
|
||||
|
||||
@@ -400,7 +400,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
|
||||
if (image != null)
|
||||
image.Dispose();
|
||||
|
||||
|
||||
if(managedImage != null)
|
||||
managedImage.Clear();
|
||||
if (imgstream != null)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
@@ -44,7 +44,7 @@ using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
|
||||
namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class GetTextureRobustHandler : BaseStreamHandler
|
||||
@@ -52,9 +52,9 @@ namespace OpenSim.Capabilities.Handlers
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private IAssetService m_assetService;
|
||||
|
||||
|
||||
public const string DefaultFormat = "x-j2c";
|
||||
|
||||
|
||||
// TODO: Change this to a config option
|
||||
private string m_RedirectURL = null;
|
||||
|
||||
@@ -66,28 +66,28 @@ namespace OpenSim.Capabilities.Handlers
|
||||
if (m_RedirectURL != null && !m_RedirectURL.EndsWith("/"))
|
||||
m_RedirectURL += "/";
|
||||
}
|
||||
|
||||
|
||||
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// Try to parse the texture ID from the request URL
|
||||
NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query);
|
||||
string textureStr = query.GetOne("texture_id");
|
||||
string format = query.GetOne("format");
|
||||
|
||||
|
||||
//m_log.DebugFormat("[GETTEXTURE]: called {0}", textureStr);
|
||||
|
||||
|
||||
if (m_assetService == null)
|
||||
{
|
||||
m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
UUID textureID;
|
||||
if (!String.IsNullOrEmpty(textureStr) && UUID.TryParse(textureStr, out textureID))
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: Received request for texture id {0}", textureID);
|
||||
|
||||
|
||||
string[] formats;
|
||||
if (!string.IsNullOrEmpty(format))
|
||||
{
|
||||
@@ -98,10 +98,10 @@ namespace OpenSim.Capabilities.Handlers
|
||||
formats = WebUtil.GetPreferredImageTypes(httpRequest.Headers.Get("Accept"));
|
||||
if (formats.Length == 0)
|
||||
formats = new string[1] { DefaultFormat }; // default
|
||||
|
||||
|
||||
}
|
||||
// OK, we have an array with preferred formats, possibly with only one entry
|
||||
|
||||
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
foreach (string f in formats)
|
||||
{
|
||||
@@ -113,14 +113,14 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
m_log.Warn("[GETTEXTURE]: Failed to parse a texture_id from GetTexture request: " + httpRequest.Url);
|
||||
}
|
||||
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}",
|
||||
// textureID, httpResponse.StatusCode, httpResponse.ContentLength);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -133,16 +133,16 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: {0} with requested format {1}", textureID, format);
|
||||
AssetBase texture;
|
||||
|
||||
|
||||
string fullID = textureID.ToString();
|
||||
if (format != DefaultFormat)
|
||||
fullID = fullID + "-" + format;
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(m_RedirectURL))
|
||||
{
|
||||
// Only try to fetch locally cached textures. Misses are redirected
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
@@ -166,14 +166,14 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
// try the cache
|
||||
texture = m_assetService.GetCached(fullID);
|
||||
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
// m_log.DebugFormat("[GETTEXTURE]: texture was not in the cache");
|
||||
|
||||
|
||||
// Fetch locally or remotely. Misses return a 404
|
||||
texture = m_assetService.Get(textureID.ToString());
|
||||
|
||||
|
||||
if (texture != null)
|
||||
{
|
||||
if (texture.Type != (sbyte)AssetType.Texture)
|
||||
@@ -192,7 +192,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
newTexture.Data = ConvertTextureData(texture, format);
|
||||
if (newTexture.Data.Length == 0)
|
||||
return false; // !!! Caller try another codec, please!
|
||||
|
||||
|
||||
newTexture.Flags = AssetFlags.Collectable;
|
||||
newTexture.Temporary = true;
|
||||
newTexture.Local = true;
|
||||
@@ -209,17 +209,17 @@ namespace OpenSim.Capabilities.Handlers
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// not found
|
||||
// m_log.Warn("[GETTEXTURE]: Texture " + textureID + " not found");
|
||||
httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void WriteTextureData(IOSHttpRequest request, IOSHttpResponse response, AssetBase texture, string format)
|
||||
{
|
||||
string range = request.Headers.GetOne("Range");
|
||||
|
||||
|
||||
if (!String.IsNullOrEmpty(range)) // JP2's only
|
||||
{
|
||||
// Range request
|
||||
@@ -233,7 +233,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// m_log.DebugFormat(
|
||||
// "[GETTEXTURE]: Client requested range for texture {0} starting at {1} but texture has end of {2}",
|
||||
// texture.ID, start, texture.Data.Length);
|
||||
|
||||
|
||||
// Stricly speaking, as per http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, we should be sending back
|
||||
// Requested Range Not Satisfiable (416) here. However, it appears that at least recent implementations
|
||||
// of the Linden Lab viewer (3.2.1 and 3.3.4 and probably earlier), a viewer that has previously
|
||||
@@ -244,7 +244,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// level 2. If this estimate is greater than the total texture size, returning a RequestedRangeNotSatisfiable
|
||||
// here will cause the viewer to treat the texture as bad and never display the full resolution
|
||||
// However, if we return PartialContent (or OK) instead, the viewer will display that resolution.
|
||||
|
||||
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
|
||||
// response.AddHeader("Content-Range", String.Format("bytes */{0}", texture.Data.Length));
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
@@ -257,13 +257,13 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// the rest of the entity.
|
||||
if (end == -1)
|
||||
end = int.MaxValue;
|
||||
|
||||
|
||||
end = Utils.Clamp(end, 0, texture.Data.Length - 1);
|
||||
start = Utils.Clamp(start, 0, end);
|
||||
int len = end - start + 1;
|
||||
|
||||
|
||||
// m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
|
||||
|
||||
|
||||
// Always return PartialContent, even if the range covered the entire data length
|
||||
// We were accidentally sending back 404 before in this situation
|
||||
// https://issues.apache.org/bugzilla/show_bug.cgi?id=51878 supports sending 206 even if the
|
||||
@@ -275,11 +275,11 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// response.StatusCode = (int)System.Net.HttpStatusCode.OK;
|
||||
// else
|
||||
response.StatusCode = (int)System.Net.HttpStatusCode.PartialContent;
|
||||
|
||||
|
||||
response.ContentLength = len;
|
||||
response.ContentType = texture.Metadata.ContentType;
|
||||
response.AddHeader("Content-Range", String.Format("bytes {0}-{1}/{2}", start, end, texture.Data.Length));
|
||||
|
||||
|
||||
response.Body.Write(texture.Data, start, len);
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
response.ContentType = "image/" + format;
|
||||
response.Body.Write(texture.Data, 0, texture.Data.Length);
|
||||
}
|
||||
|
||||
|
||||
// if (response.StatusCode < 200 || response.StatusCode > 299)
|
||||
// m_log.WarnFormat(
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
@@ -310,7 +310,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// "[GETTEXTURE]: For texture {0} requested range {1} responded {2} with content length {3} (actual {4})",
|
||||
// texture.FullID, range, response.StatusCode, response.ContentLength, texture.Data.Length);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parse a range header.
|
||||
/// </summary>
|
||||
@@ -327,18 +327,18 @@ namespace OpenSim.Capabilities.Handlers
|
||||
private bool TryParseRange(string header, out int start, out int end)
|
||||
{
|
||||
start = end = 0;
|
||||
|
||||
|
||||
if (header.StartsWith("bytes="))
|
||||
{
|
||||
string[] rangeValues = header.Substring(6).Split('-');
|
||||
|
||||
|
||||
if (rangeValues.Length == 2)
|
||||
{
|
||||
if (!Int32.TryParse(rangeValues[0], out start))
|
||||
return false;
|
||||
|
||||
|
||||
string rawEnd = rangeValues[1];
|
||||
|
||||
|
||||
if (rawEnd == "")
|
||||
{
|
||||
end = -1;
|
||||
@@ -350,27 +350,27 @@ namespace OpenSim.Capabilities.Handlers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
start = end = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private byte[] ConvertTextureData(AssetBase texture, string format)
|
||||
{
|
||||
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
|
||||
byte[] data = new byte[0];
|
||||
|
||||
|
||||
MemoryStream imgstream = new MemoryStream();
|
||||
Bitmap mTexture = null;
|
||||
ManagedImage managedImage = null;
|
||||
Image image = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
|
||||
|
||||
|
||||
imgstream = new MemoryStream();
|
||||
|
||||
|
||||
// Decode image to System.Drawing.Image
|
||||
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
|
||||
{
|
||||
@@ -380,7 +380,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
using(EncoderParameters myEncoderParameters = new EncoderParameters())
|
||||
{
|
||||
myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,95L);
|
||||
|
||||
|
||||
// Save bitmap to stream
|
||||
ImageCodecInfo codec = GetEncoderInfo("image/" + format);
|
||||
if (codec != null)
|
||||
@@ -404,10 +404,10 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// If we encountered an exception, one or more of these will be null
|
||||
if (mTexture != null)
|
||||
mTexture.Dispose();
|
||||
|
||||
|
||||
if (image != null)
|
||||
image.Dispose();
|
||||
|
||||
|
||||
if(managedImage != null)
|
||||
managedImage.Clear();
|
||||
|
||||
@@ -417,10 +417,10 @@ namespace OpenSim.Capabilities.Handlers
|
||||
imgstream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
// From msdn
|
||||
private static ImageCodecInfo GetEncoderInfo(String mimeType)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Capabilities.Handlers")]
|
||||
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
public class UploadBakedTextureHandler
|
||||
{
|
||||
|
||||
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private Caps m_HostCapsObj;
|
||||
@@ -81,7 +81,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
{
|
||||
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
|
||||
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
|
||||
|
||||
|
||||
BakedTextureUploader uploader =
|
||||
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
|
||||
uploader.OnUpLoad += BakedTextureUploaded;
|
||||
@@ -127,7 +127,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
asset.Temporary = true;
|
||||
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
||||
m_assetService.Store(asset);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handle raw uploaded baked texture data.
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
public string state;
|
||||
public int upload_price;
|
||||
public string rsvp;
|
||||
|
||||
|
||||
public LLSDNewFileAngentInventoryVariablePriceReplyResponse()
|
||||
{
|
||||
state = "confirm_upload";
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
public string username;
|
||||
public string display_name;
|
||||
//'display_name_next_update':d"1970-01-01T00:00:00Z"
|
||||
//'display_name_next_update':d"1970-01-01T00:00:00Z"
|
||||
public string legacy_first_name;
|
||||
public string legacy_last_name;
|
||||
public UUID id;
|
||||
|
||||
@@ -87,12 +87,12 @@ namespace OpenSim.Framework.Capabilities
|
||||
[OSDMap]
|
||||
public class LLSDInventoryFolderContents
|
||||
{
|
||||
public UUID agent_id;
|
||||
public UUID agent_id;
|
||||
public int descendents;
|
||||
public UUID folder_id;
|
||||
public UUID folder_id;
|
||||
public OSDArray categories = new OSDArray();
|
||||
public OSDArray items = new OSDArray();
|
||||
public UUID owner_id;
|
||||
public UUID owner_id;
|
||||
public int version;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenSim.Capabilities")]
|
||||
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
@@ -25,7 +25,7 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user