Ejemplo n.º 1
0
        public JsonResult ServerInfo()
        {
            var serverInfo = _serverQueries.GetServerInfo();

            if (serverInfo.IsAlive)
            {
                var mapInfo = _strapiApi.GetMapInfo(serverInfo.Map);
                if (mapInfo == null)
                {
                    return(Json(serverInfo));
                }

                serverInfo.ImageUrl    = mapInfo.Image?.FullUrl;
                serverInfo.Description = mapInfo.Description;
            }
            else
            {
                serverInfo.ImageUrl = _strapiApi.GetImage(BusinessFacade.Constants.ImagesIds.DefaultImage)?.Image.FullUrl;
                serverInfo.Map      = "Server is down";
            }

            return(Json(serverInfo));
        }
 private static string GetMapImage(string mapName)
 {
     return(_mapInfos.FirstOrDefault(y => y.MapName == mapName)?.Image.FullUrl
            ?? _strapiApi.GetImage(BusinessFacade.Constants.ImagesIds.DefaultImage)?.Image.FullUrl
            ?? "");
 }