- Timestamp:
- Jan 19, 2019, 6:12:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/Handlers/ItemIconHandler.cs
r326 r351 18 18 } 19 19 20 public ItemIconHandler (string staticPart, bool logMissingFiles, string moduleName = null) : base (moduleName) {21 this.staticPart =staticPart;22 this.logMissingFiles =logMissingFiles;20 public ItemIconHandler (string _staticPart, bool _logMissingFiles, string _moduleName = null) : base (_moduleName) { 21 staticPart = _staticPart; 22 logMissingFiles = _logMissingFiles; 23 23 Instance = this; 24 24 } … … 26 26 public static ItemIconHandler Instance { get; private set; } 27 27 28 public override void HandleRequest (HttpListenerRequest req, HttpListenerResponse resp, WebConnectionuser,29 int permissionLevel) {28 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 29 int _permissionLevel) { 30 30 if (!loaded) { 31 resp.StatusCode = (int) HttpStatusCode.InternalServerError;31 _resp.StatusCode = (int) HttpStatusCode.InternalServerError; 32 32 Log.Out ("Web:IconHandler: Icons not loaded"); 33 33 return; 34 34 } 35 35 36 string requestFileName = req.Url.AbsolutePath.Remove (0, staticPart.Length);36 string requestFileName = _req.Url.AbsolutePath.Remove (0, staticPart.Length); 37 37 requestFileName = requestFileName.Remove (requestFileName.LastIndexOf ('.')); 38 38 39 if (icons.ContainsKey (requestFileName) && req.Url.AbsolutePath.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) {40 resp.ContentType = MimeType.GetMimeType (".png");39 if (icons.ContainsKey (requestFileName) && _req.Url.AbsolutePath.EndsWith (".png", StringComparison.OrdinalIgnoreCase)) { 40 _resp.ContentType = MimeType.GetMimeType (".png"); 41 41 42 42 byte[] itemIconData = icons [requestFileName]; 43 43 44 resp.ContentLength64 = itemIconData.Length;45 resp.OutputStream.Write (itemIconData, 0, itemIconData.Length);44 _resp.ContentLength64 = itemIconData.Length; 45 _resp.OutputStream.Write (itemIconData, 0, itemIconData.Length); 46 46 } else { 47 resp.StatusCode = (int) HttpStatusCode.NotFound;47 _resp.StatusCode = (int) HttpStatusCode.NotFound; 48 48 if (logMissingFiles) { 49 Log.Out ("Web:IconHandler:FileNotFound: \"" + req.Url.AbsolutePath + "\" ");49 Log.Out ("Web:IconHandler:FileNotFound: \"" + _req.Url.AbsolutePath + "\" "); 50 50 } 51 51 }
Note:
See TracChangeset
for help on using the changeset viewer.