public void Request(IServiceRequestContext context) { if (context == null || context.ServiceRequest == null) { return; } if (_mapServer == null) { context.ServiceRequest.Response = "<FATALERROR>MapServer Object is not available!</FATALERROR>"; return; } switch (context.ServiceRequest.Request) { case "options": StringBuilder sb = new StringBuilder(); sb.Append("<MapServer><Options>"); sb.Append("<OutputPath>" + _mapServer.OutputPath + "</OutputPath>"); sb.Append("<OutputUrl>" + _mapServer.OutputUrl + "</OutputUrl>"); sb.Append("<TileCachePath>" + _mapServer.TileCachePath + "</TileCachePath>"); sb.Append("</Options></MapServer>"); context.ServiceRequest.Response = sb.ToString(); break; } }
public IServiceMap this[IServiceRequestContext context] { get { try { if (context == null || context.ServiceRequest == null) { return(null); } IServiceMap map = this.Map(context.ServiceRequest.Service, context); if (map is ServiceMap) { ((ServiceMap)map).SetRequestContext(context); } return(map); } catch (Exception ex) { Log("MapServer.Map", loggingMethod.error, ex.Message + "\n" + ex.StackTrace); return(null); } } }
async public Task CheckAccess(IServiceRequestContext context) { if (context == null) { throw new ArgumentNullException("context"); } await ReloadServiceSettings(); if (!_settings.IsRunningOrIdle()) { throw new Exception("Service not running: " + this.Fullname); } if (_folderSettings != null) { CheckAccess(context, _folderSettings); if (context.ServiceRequest != null) { if (!String.IsNullOrEmpty(_folderSettings.OnlineResource)) { context.ServiceRequest.OnlineResource = _folderSettings.OnlineResource; } if (!String.IsNullOrEmpty(_folderSettings.OutputUrl)) { context.ServiceRequest.OutputUrl = _folderSettings.OutputUrl; } } } CheckAccess(context, _settings); }
public static void ErrorLog(IServiceRequestContext context, string header, string server, string service, Exception ex) { if (context == null || context.MapServer == null || context.MapServer.LoggingEnabled(loggingMethod.error) == false) { return; } StringBuilder msg = new StringBuilder(); if (ex != null) { msg.Append(ex.Message + "\n"); Exception inner = ex; while ((inner = inner.InnerException) != null) { msg.Append(inner.Message + "\n"); } } context.MapServer.Log(server + "-" + service + ": " + header, loggingMethod.error, msg.ToString() + ex.Source + "\n" + ex.StackTrace + "\n"); }
async public Task <IServiceMap> GetServiceMapAsync(IServiceRequestContext context) { try { if (context == null || context.ServiceRequest == null) { return(null); } IServiceMap map = await this.Map(context.ServiceRequest.Service, context.ServiceRequest.Folder, context); if (map is ServiceMap) { ((ServiceMap)map).SetRequestContext(context); } return(map); } catch (MapServerException mse) { throw mse; } catch (Exception ex) { await LogAsync(ToMapName(context?.ServiceRequest?.Service, context?.ServiceRequest?.Folder), "MapServer.Map", loggingMethod.error, ex.Message + "\n" + ex.StackTrace); throw new MapServerException("unknown error"); } }
private void DeleteFeatures(IServiceRequestContext context) { try { var editRequest = JsonConvert.DeserializeObject <JsonFeatureServerEditRequest>(context.ServiceRequest.Request); using (var serviceMap = context.CreateServiceMapInstance()) { var featureClass = GetFeatureClass(serviceMap, editRequest); var dataset = featureClass.Dataset; var database = dataset?.Database as IFeatureUpdater; if (database == null) { throw new Exception("Featureclass is not editable"); } foreach (int objectId in editRequest.ObjectIds.Split(',').Select(s => int.Parse(s))) { if (!database.Delete(featureClass, objectId)) { throw new Exception(database.lastErrorMsg); } } context.ServiceRequest.Succeeded = true; context.ServiceRequest.Response = JsonConvert.SerializeObject( new JsonFeatureServerResponse() { DeleteResults = new JsonFeatureServerResponse.JsonResponse[] { new JsonFeatureServerResponse.JsonResponse() { Success = true } } }); } } catch (Exception ex) { context.ServiceRequest.Succeeded = false; context.ServiceRequest.Response = JsonConvert.SerializeObject(new JsonFeatureServerResponse() { DeleteResults = new JsonFeatureServerResponse.JsonResponse[] { new JsonFeatureServerResponse.JsonResponse() { Success = false, Error = new JsonFeatureServerResponse.JsonError() { Code = 999, Description = ex.Message.Split('\n')[0] } } } }); } }
public void SetRequestContext(IServiceRequestContext context) { if (context != null) { _mapServer = context.MapServer; _interpreter = context.ServiceRequestInterpreter; _request = context.ServiceRequest; } }
public static void Log(IServiceRequestContext context, string header, string server, string service, StringBuilder axl) { if (context == null || context.MapServer == null || context.MapServer.LoggingEnabled(loggingMethod.request_detail_pro) == false) { return; } }
async public Task LogAsync(IServiceRequestContext context, string header, loggingMethod method, string msg) { if (!LoggingEnabled(method)) { return; } await LogAsync(ToMapName(context?.ServiceRequest?.Service, context?.ServiceRequest?.Folder), header, method, msg); }
private void WmtsMetadata100(IServiceRequestContext context, TileServiceMetadata metadata) { XmlStream stream = new XmlStream("WmtsMetadata"); stream.Save("TileServiceMetadata", metadata); context.ServiceRequest.Response = stream.ToString(); context.ServiceRequest.ResponseContentType = "text/xml"; }
async private Task <byte[]> GetTile(IServiceRequestContext context, TileServiceMetadata metadata, int epsg, double scale, int row, int col, string format, GridOrientation orientation) { if (!metadata.EPSGCodes.Contains(epsg)) { throw new ArgumentException("Wrong epsg argument"); } //if (!metadata.Scales.Contains(scale)) // throw new ArgumentException("Wrong scale argument"); scale = metadata.Scales.GetScale(scale); if (scale <= 0.0) { throw new ArgumentException("Wrong scale argument"); } //IEnvelope bounds = metadata.GetEPSGEnvelope(epsg); //if (bounds == null || bounds.Width == 0.0 || bounds.Height == 0.0) // throw new Exception("No bounds defined for EPSG:" + epsg); format = format.ToLower(); if (format != ".png" && format != ".jpg") { throw new Exception("Unsupported image format"); } if (format == ".png" && metadata.FormatPng == false) { throw new Exception("Format image/png not supported"); } if (format == ".jpg" && metadata.FormatJpg == false) { throw new Exception("Format image/jpeg no supported"); } string path = _mapServer.TileCachePath + @"/" + MapName(context) + @"/_alllayers/" + TileServiceMetadata.TilePath(orientation, epsg, scale, row, col) + format; if ((orientation == GridOrientation.UpperLeft && metadata.UpperLeftCacheTiles) || (orientation == GridOrientation.LowerLeft && metadata.LowerLeftCacheTiles)) { FileInfo fi = new FileInfo(path); if (fi.Exists) { //context.ServiceRequest.Response = fi.FullName; using (FileStream fs = File.Open(fi.FullName, FileMode.Open, FileAccess.Read, FileShare.Read)) //new FileStream(bundleFilename, FileMode.Open, FileAccess.Read)) { byte[] data = new byte[fi.Length]; await fs.ReadAsync(data, 0, data.Length); return(data); } } } return(null); }
private string CapabilitiesMapName(IServiceRequestContext context) { //if (!String.IsNullOrWhiteSpace(context.ServiceRequest.Folder)) //{ // return $"{ context.ServiceRequest.Folder }/{ context.ServiceRequest.Service }"; //} return(context.ServiceRequest.Service); }
private string MapName(IServiceRequestContext context) { if (!String.IsNullOrWhiteSpace(context.ServiceRequest.Folder)) { return($"{ context.ServiceRequest.Folder }/{ context.ServiceRequest.Service }"); } return(context.ServiceRequest.Service); }
private byte[] GetCompactTileBytes(IServiceRequestContext context, string path, int row, int col, string format) { string compactTileName = CompactTileName(row, col); string bundleFilename = path + @"\" + compactTileName + ".tilebundle"; string bundleIndexFilename = path + @"\" + compactTileName + ".tilebundlx"; FileInfo fi = new FileInfo(bundleIndexFilename); if (!fi.Exists) { return(CreateEmpty(format)); } CompactTileIndex bundleIndex = new CompactTileIndex(bundleIndexFilename); int bundleStartRow = CompactTileStart(row); int bundleStartCol = CompactTileStart(col); try { int tileLength, tilePosition = bundleIndex.TilePosition(row - bundleStartRow, col - bundleStartCol, out tileLength); if (tilePosition < 0) { return(CreateEmpty(format)); } using (FileStream fs = File.Open(bundleFilename, FileMode.Open, FileAccess.Read, FileShare.Read)) //new FileStream(bundleFilename, FileMode.Open, FileAccess.Read)) { fs.Position = tilePosition; byte[] data = new byte[tileLength]; fs.Read(data, 0, tileLength); return(data); } } catch (Exception ex) { using (var serviceMap = context.CreateServiceMapInstance()) { TileServiceMetadata metadata = serviceMap.MetadataProvider(_metaprovider) as TileServiceMetadata; using (System.Drawing.Bitmap bm = new Bitmap(metadata.TileWidth, metadata.TileHeight)) using (System.Drawing.Graphics gr = Graphics.FromImage(bm)) using (System.Drawing.Font font = new Font("Arial", 9f)) { gr.DrawString(ex.Message, font, Brushes.Red, new RectangleF(0f, 0f, (float)bm.Width, (float)bm.Height)); MemoryStream ms = new MemoryStream(); bm.Save(ms, format == ".png" ? ImageFormat.Png : ImageFormat.Jpeg); return(ms.ToArray()); } } } }
public override BaseTransferObject Execute(IServiceRequestContext context) { var result = new BaseTransferObject(); var requestContext = context as CustomerContext; int customerId = requestContext.CustomerId; // return(result); }
async public static Task LogAsync(IServiceRequestContext context, string header, string server, string service, StringBuilder axl) { if (context == null || context.MapServer == null || context.MapServer.LoggingEnabled(loggingMethod.request_detail_pro) == false) { return; } await LogAsync(context, header, server, service, axl.ToString()); }
protected override string SendRequest(IUserData userData, string axlRequest) { if (!(_dataset is ArcIMSDataset)) { return(""); } string server = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "server"); string service = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "service"); string user = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "user"); string pwd = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "pwd"); IServiceRequestContext context = (userData != null) ? userData.GetUserData("IServiceRequestContext") as IServiceRequestContext : null; if ((user == "#" || user == "$") && context != null && context.ServiceRequest != null && context.ServiceRequest.Identity != null) { string roles = String.Empty; if (user == "#" && context.ServiceRequest.Identity.UserRoles != null) { foreach (string role in context.ServiceRequest.Identity.UserRoles) { if (String.IsNullOrEmpty(role)) { continue; } roles += "|" + role; } } user = context.ServiceRequest.Identity.UserName + roles; pwd = context.ServiceRequest.Identity.HashedPassword; } dotNETConnector connector = new dotNETConnector(); if (!String.IsNullOrEmpty(user) || !String.IsNullOrEmpty(pwd)) { connector.setAuthentification(user, pwd); } string resp = String.Empty; ArcIMSClass.Log(context, "GetFeature Request", server, service, axlRequest); try { resp = connector.SendRequest(axlRequest, server, service, "Query"); } catch (Exception ex) { ArcIMSClass.ErrorLog(context, "Query", server, service, ex); return(String.Empty); } ArcIMSClass.Log(context, "GetFeature Response", server, service, resp); return(resp); }
async public Task <IActionResult> EsriMap(string cmd, string ServiceName, string content) { return(await SecureMethodHandler(async (identity) => { if (cmd == "ping") { return Result("gView MapServer Instance v" + gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain"); } if (cmd == "getversion") { return Result(gView.Framework.system.SystemVariables.gViewVersion.ToString(), "text/plain"); } if (cmd == "capabilities") { content = @"<?xml version=""1.0"" encoding=""UTF-8""?><ARCXML version=""1.1""><REQUEST><GET_SERVICE_INFO fields=""true"" envelope=""true"" renderer=""true"" extensions=""true"" /></REQUEST></ARCXML>"; } var interpreter = _mapServerService.GetInterpreter(typeof(ArcXMLRequest)); #region Request if (String.IsNullOrEmpty(content)) { content = await GetBody(); } ServiceRequest serviceRequest = new ServiceRequest(ServiceName.ServiceName(), ServiceName.FolderName(), content) { Identity = identity, OnlineResource = _mapServerService.Options.OnlineResource, OutputUrl = _mapServerService.Options.OutputUrl, }; #endregion #region Queue & Wait IServiceRequestContext context = await ServiceRequestContext.TryCreate( _mapServerService.Instance, interpreter, serviceRequest, checkSecurity: ServiceName.ToLower() != "catalog"); await _mapServerService.TaskQueue.AwaitRequest(interpreter.Request, context); #endregion return Result(serviceRequest.ResponseAsString, "text/xml"); })); }
// https://localhost:44331/tilewmts/tor_tiles/compact/ul/31256/default/8/14099/16266.jpg async public Task <IActionResult> TileWmts(string name, string cachetype, string origin, string epsg, string style, string level, string row, string col, string folder = "") { if (IfMatch()) { return(base.NotModified()); } #region Security Identity identity = Identity.FromFormattedString(_loginMananger.GetAuthToken(this.Request).Username); #endregion var interpreter = _mapServiceMananger.GetInterpreter(typeof(WMTSRequest)); #region Request string requestString = cachetype + "/" + origin + "/" + epsg + "/" + style + "/~" + level + "/" + row + "/" + col; ServiceRequest serviceRequest = new ServiceRequest(name, folder, requestString) { OnlineResource = _mapServiceMananger.Options.OnlineResource + "/ogc/" + name, OutputUrl = _mapServiceMananger.Options.OutputUrl, Identity = identity }; #endregion IServiceRequestContext context = await ServiceRequestContext.TryCreate( _mapServiceMananger.Instance, interpreter, serviceRequest); //await interpreter.Request(context); await _mapServiceMananger.TaskQueue.AwaitRequest(interpreter.Request, context); var imageData = serviceRequest.Response as byte[]; if (imageData != null) { if (serviceRequest.ResponseExpries.HasValue) { base.AppendEtag(serviceRequest.ResponseExpries.Value); } return(Result(imageData, serviceRequest.ResponseContentType)); } return(null); }
private string TmsCapabilities(IServiceRequestContext context, TileServiceMetadata metadata, int srs) { IEnvelope box = metadata.GetEPSGEnvelope(srs); if (box == null) { return(String.Empty); } ISpatialReference sRef = SpatialReference.FromID("epsg:" + srs); StringBuilder sb = new StringBuilder(); sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.Append("<TileMap version=\"1.0.0\" tilemapservice=\"" + context.ServiceRequest.OnlineResource + "\" >"); sb.Append("<Title>" + context.ServiceMap.Name + "</Title>"); sb.Append("<Abstract>gView Tile Cache</Abstract>"); sb.Append("<SRS>EPSG:" + srs + "</SRS>"); sb.Append("<BoundingBox minx=\"" + box.minx.ToString(_nhi) + "\" miny=\"" + box.miny.ToString(_nhi) + "\" maxx=\"" + box.maxx.ToString(_nhi) + "\" maxy=\"" + box.maxy.ToString(_nhi) + "\" />"); sb.Append("<Origin x=\"" + box.minx.ToString(_nhi) + "\" y=\"" + box.miny.ToString(_nhi) + "\" />"); sb.Append("<TileFormat width=\"" + metadata.TileWidth + "\" height=\"" + metadata.TileHeight + "\" mime-type=\"image/png\" extension=\"png\" />"); sb.Append("<TileSets>"); int level = 0; foreach (double scale in metadata.Scales) { double res = (double)scale / (metadata.Dpi / 0.0254); if (sRef.SpatialParameters.IsGeographic) { GeoUnitConverter converter = new GeoUnitConverter(); res = converter.Convert(res, GeoUnits.Meters, GeoUnits.DecimalDegrees); } sb.Append("<TileSet href=\"" + context.ServiceRequest.OnlineResource + "/" + level + "\" "); sb.Append("units-per-pixel=\"" + res.ToString(_nhi) + "\" order=\"" + level + "\" />"); level++; } sb.Append("</TileSets>"); sb.Append("</TileMap>"); return(sb.ToString()); }
private void WriteConfFile(IServiceRequestContext context, IServiceMap serviceMap, TileServiceMetadata metadata, string cacheFormat, int epsg, string format, GridOrientation orientation) { FileInfo configFileInfo = new FileInfo(_mapServer.TileCachePath + @"\" + serviceMap.Name + @"\_alllayers\" + cacheFormat + @"\" + TileServiceMetadata.EpsgPath(orientation, epsg) + @"\conf.json"); IPoint origin = orientation == GridOrientation.UpperLeft ? metadata.GetOriginUpperLeft(epsg) : metadata.GetOriginLowerLeft(epsg); IEnvelope bounds = metadata.GetEPSGEnvelope(epsg); if (origin == null || bounds == null) { return; } List <CompactTileConfig.LevelConfig> levels = new List <CompactTileConfig.LevelConfig>(); for (int i = 0; i < metadata.Scales.Count; i++) { levels.Add(new CompactTileConfig.LevelConfig() { Level = i, Scale = metadata.Scales[i] }); } CompactTileConfig config = new CompactTileConfig() { Epsg = epsg, Dpi = metadata.Dpi, Origin = new double[] { origin.X, origin.Y }, Extent = new double[] { bounds.minx, bounds.miny, bounds.maxx, bounds.maxy }, TileSize = new int[] { metadata.TileWidth, metadata.TileHeight }, Format = format, Orientation = orientation.ToString(), Levels = levels.ToArray() }; if (configFileInfo.Exists) { configFileInfo.Delete(); } if (!configFileInfo.Directory.Exists) { configFileInfo.Directory.Create(); } File.WriteAllText(configFileInfo.FullName, JsonConvert.SerializeObject(config, Formatting.Indented)); }
async protected override Task <string> SendRequest(IUserData userData, string axlRequest) { if (_dataset == null) { return(""); } string server = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "server"); string service = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "service"); IServiceRequestContext context = (userData != null) ? userData.GetUserData("IServiceRequestContext") as IServiceRequestContext : null; string user = ConfigTextStream.ExtractValue(_dataset.ConnectionString, "user"); string pwd = Identity.HashPassword(ConfigTextStream.ExtractValue(_dataset.ConnectionString, "pwd")); if ((user == "#" || user == "$") && context != null && context.ServiceRequest != null && context.ServiceRequest.Identity != null) { string roles = String.Empty; if (user == "#" && context.ServiceRequest.Identity.UserRoles != null) { foreach (string role in context.ServiceRequest.Identity.UserRoles) { if (String.IsNullOrEmpty(role)) { continue; } roles += "|" + role; } } user = context.ServiceRequest.Identity.UserName + roles; // ToDo: //pwd = context.ServiceRequest.Identity.HashedPassword; } ServerConnection conn = new ServerConnection(server); string resp = conn.Send(service, axlRequest, "BB294D9C-A184-4129-9555-398AA70284BC", user, pwd); try { return(conn.Send(service, axlRequest, "BB294D9C-A184-4129-9555-398AA70284BC", user, pwd)); } catch (Exception ex) { MapServerClass.ErrorLog(context, "Query", server, service, ex); return(String.Empty); } }
private void CheckAccess(IServiceRequestContext context, IMapServiceSettings settings) { if (settings?.AccessRules == null || settings.AccessRules.Length == 0) // No Settings -> free service { return; } string userName = context.ServiceRequest?.Identity?.UserName; var accessRule = settings .AccessRules .Where(r => r.Username.Equals(userName, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); // if user not found, use rules for anonymous if (accessRule == null) { accessRule = settings .AccessRules .Where(r => r.Username.Equals(Identity.AnonyomousUsername, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); } if (accessRule == null || accessRule.ServiceTypes == null) { throw new TokenRequiredException("forbidden (user:"******")"); } if (!accessRule.ServiceTypes.Contains("_all") && !accessRule.ServiceTypes.Contains("_" + context.ServiceRequestInterpreter.IdentityName.ToLower())) { throw new NotAuthorizedException(context.ServiceRequestInterpreter.IdentityName + " interface forbidden (user: "******")"); } var accessTypes = context.ServiceRequestInterpreter.RequiredAccessTypes(context); foreach (AccessTypes accessType in Enum.GetValues(typeof(AccessTypes))) { if (accessType != AccessTypes.None && accessTypes.HasFlag(accessType)) { if (!accessRule.ServiceTypes.Contains(accessType.ToString().ToLower())) { throw new NotAuthorizedException("Forbidden: " + accessType.ToString() + " access required (user: "******")"); } } } }
private static string ToMapName(IServiceRequestContext context) { string mapName = String.Empty; if (context != null && context.ServiceRequest != null) { if (!String.IsNullOrWhiteSpace(context.ServiceRequest.Folder)) { mapName = context.ServiceRequest.Folder + "/" + context.ServiceRequest.Service; } else { mapName = context.ServiceRequest.Service; } } return(mapName); }
public static void Log(IServiceRequestContext context, string header, string server, string service, string axl) { if (context == null || context.MapServer == null || context.MapServer.LoggingEnabled(loggingMethod.request_detail_pro) == false) { return; } StringBuilder sb = new StringBuilder(); sb.Append("\n"); sb.Append(header); sb.Append("\n"); sb.Append("Server: " + server + " Service: " + service); sb.Append("\n"); sb.Append(axl); context.MapServer.Log("gView.Interoperability.ArcXML", loggingMethod.request_detail_pro, sb.ToString()); }
public void Request(IServiceRequestContext context) { if (context == null || context.ServiceRequest == null) { return; } if (_mapServer == null) { context.ServiceRequest.Response = "<FATALERROR>MapServer Object is not available!</FATALERROR>"; return; } string service = context.ServiceRequest.Service; string request = context.ServiceRequest.Request; try { _mapServer.Log("Service:" + service, loggingMethod.request_detail, request); XmlDocument doc = new XmlDocument(); doc.LoadXml(request); XmlNode rNode = doc.SelectSingleNode("//TileRequest"); XmlNode rType = rNode.FirstChild; switch (rType.Name) { case "QueryTiles": PerformQueryTilesRequest(context, rType); break; } } catch (Exception ex) { _mapServer.Log("Service:" + service, loggingMethod.error, ex.Message + "\r\n" + ex.StackTrace); context.ServiceRequest.Response = CreateException(ex.Message); return; } }
private IServiceMap Map(string name, IServiceRequestContext context) { try { if (_doc == null) { return(null); } object locker = null; lock (_lockThis) { if (!_lockers.ContainsKey(name)) { _lockers.Add(name, new object()); } locker = _lockers[name]; } //lock (_lockThis) lock (locker) { string alias = name; IMapService ms = FindMapService(name); if (ms is MapServiceAlias) { name = ((MapServiceAlias)ms).ServiceName; } return(FindServiceMap(name, alias, context)); } } catch (Exception ex) { Log("MapServer.Map", loggingMethod.error, ex.Message + "\n" + ex.StackTrace); return(null); } }
public void Request(IServiceRequestContext context) { switch (context.ServiceRequest.Method.ToLower()) { case "export": ExportMapRequest(context); break; case "query": Query(context); break; case "legend": Legend(context); break; case "featureserver_query": Query(context, true); break; case "featureserver_addfeatures": AddFeatures(context); break; case "featureserver_updatefeatures": UpdateFeatures(context); break; case "featureserver_deletefeatures": DeleteFeatures(context); break; default: throw new NotImplementedException(context.ServiceRequest.Method + " is not support for arcgis server emulator"); } }
private Map FindMap(string name, IServiceRequestContext context) { foreach (IMap map in InternetMapServer.MapDocument.Maps) { if (map.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) && map is Map) { return((Map)map); } } if (name.Contains(",")) { return(null); } IMap m = InternetMapServer.LoadMap(name, context); if (m is Map) { return((Map)m); } return(null); }
async private Task <Map> FindMap(string name, IServiceRequestContext context) { foreach (IMap map in _mapServiceDeploymentMananger.MapDocument.Maps) { if (map.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) && map is Map) { return((Map)map); } } if (name.Contains(",")) { return(null); } IMap m = await _mapServiceDeploymentMananger.LoadMap(name); if (m is Map) { return((Map)m); } return(null); }