diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/LoadImageURLModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs index 8b8b386..9d10fc3 100644 --- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | |||
@@ -1,18 +1,16 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Net; | ||
5 | using System.IO; | ||
6 | using System.Drawing; | 2 | using System.Drawing; |
3 | using System.IO; | ||
4 | using System.Net; | ||
7 | using libsecondlife; | 5 | using libsecondlife; |
6 | using Nini.Config; | ||
8 | using OpenJPEGNet; | 7 | using OpenJPEGNet; |
9 | using OpenSim.Region.Environment.Scenes; | ||
10 | using OpenSim.Region.Environment.Interfaces; | 8 | using OpenSim.Region.Environment.Interfaces; |
11 | using Nini.Config; | 9 | using OpenSim.Region.Environment.Scenes; |
12 | 10 | ||
13 | namespace OpenSim.Region.Environment.Modules | 11 | namespace OpenSim.Region.Environment.Modules |
14 | { | 12 | { |
15 | public class LoadImageURLModule : IRegionModule , IDynamicTextureRender | 13 | public class LoadImageURLModule : IRegionModule, IDynamicTextureRender |
16 | { | 14 | { |
17 | private string m_name = "LoadImageURL"; | 15 | private string m_name = "LoadImageURL"; |
18 | private IDynamicTextureManager m_textureManager; | 16 | private IDynamicTextureManager m_textureManager; |
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules | |||
85 | private void MakeHttpRequest(string url, LLUUID requestID) | 83 | private void MakeHttpRequest(string url, LLUUID requestID) |
86 | { | 84 | { |
87 | WebRequest request = HttpWebRequest.Create(url); | 85 | WebRequest request = HttpWebRequest.Create(url); |
88 | RequestState state = new RequestState((HttpWebRequest)request, requestID); | 86 | RequestState state = new RequestState((HttpWebRequest) request, requestID); |
89 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); | 87 | IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); |
90 | 88 | ||
91 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); | 89 | TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); |
92 | state.TimeOfRequest = (int)t.TotalSeconds; | 90 | state.TimeOfRequest = (int) t.TotalSeconds; |
93 | } | 91 | } |
94 | 92 | ||
95 | private void HttpRequestReturn(IAsyncResult result) | 93 | private void HttpRequestReturn(IAsyncResult result) |
96 | { | 94 | { |
97 | RequestState state = (RequestState)result.AsyncState; | 95 | RequestState state = (RequestState) result.AsyncState; |
98 | WebRequest request = (WebRequest)state.Request; | 96 | WebRequest request = (WebRequest) state.Request; |
99 | HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); | 97 | HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result); |
100 | if (response.StatusCode == HttpStatusCode.OK) | 98 | if (response.StatusCode == HttpStatusCode.OK) |
101 | { | 99 | { |
102 | Bitmap image = new Bitmap(response.GetResponseStream()); | 100 | Bitmap image = new Bitmap(response.GetResponseStream()); |
103 | Bitmap resize = new Bitmap(image, new Size(512, 512)); | 101 | Bitmap resize = new Bitmap(image, new Size(512, 512)); |
104 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); | 102 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); |
105 | 103 | ||
106 | m_textureManager.ReturnData(state.RequestID, imageJ2000); | 104 | m_textureManager.ReturnData(state.RequestID, imageJ2000); |
107 | } | 105 | } |
108 | } | 106 | } |
109 | 107 | ||
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules | |||
119 | RequestID = requestID; | 117 | RequestID = requestID; |
120 | } | 118 | } |
121 | } | 119 | } |
122 | |||
123 | } | 120 | } |
124 | } | 121 | } \ No newline at end of file |