Esempio n. 1
0
        private static string GetFileName(string fileName)
        {
            try
            {
                if (fileName.Length == 0)
                {
                    return(string.Empty);
                }
                if (fileName == "-")
                {
                    return(string.Empty);
                }
                string lowerFileName = fileName.ToLowerInvariant().Trim();
                if (lowerFileName.IndexOf(@"http:", StringComparison.Ordinal) >= 0)
                {
                    DownloadedImage image;
                    if (!_cacheDownload.TryGetValue(lowerFileName, out image))
                    {
                        image = new DownloadedImage(fileName);
                        _cacheDownload[lowerFileName] = image;
                    }

                    if (image.ShouldDownLoad)
                    {
                        image.Download();
                    }

                    return(image.FileName);
                }

                if (!MediaPortal.Util.Utils.FileExistsInCache(fileName))
                {
                    if (!Path.IsPathRooted(fileName))
                    {
                        return(GUIGraphicsContext.GetThemedSkinFile(@"\media\" + fileName));
                    }
                }
                return(fileName);
            }
            catch (Exception ex)
            {
                Log.Error("GUITextureManager GetFileName: '" + fileName + "' " + ex.Message);
                // ignored
                return(string.Empty);
            }
        }
Esempio n. 2
0
        private static string GetFileName(string fileName)
        {
            if (fileName.Length == 0)
            {
                return("");
            }
            if (fileName == "-")
            {
                return("");
            }
            string lowerFileName = fileName.ToLowerInvariant().Trim();

            if (lowerFileName.IndexOf(@"http:") >= 0)
            {
                DownloadedImage image;
                if (!_cacheDownload.TryGetValue(lowerFileName, out image))
                {
                    image = new DownloadedImage(fileName);
                    _cacheDownload[lowerFileName] = image;
                }

                if (image.ShouldDownLoad)
                {
                    image.Download();
                }

                return(image.FileName);
            }

            if (!MediaPortal.Util.Utils.FileExistsInCache(fileName))
            {
                if (!Path.IsPathRooted(fileName))
                {
                    return(GUIGraphicsContext.GetThemedSkinFile(@"\media\" + fileName));
                }
            }
            return(fileName);
        }
Esempio n. 3
0
    private static string GetFileName(string fileName)
    {
      if (fileName.Length == 0)
      {
        return "";
      }
      if (fileName == "-")
      {
        return "";
      }
      string lowerFileName = fileName.ToLowerInvariant().Trim();
      if (lowerFileName.IndexOf(@"http:") >= 0)
      {
        DownloadedImage image;
        if (!_cacheDownload.TryGetValue(lowerFileName, out image))
        {
          image = new DownloadedImage(fileName);
          _cacheDownload[lowerFileName] = image;
        }

        if (image.ShouldDownLoad)
        {
          image.Download();
        }

        return image.FileName;
      }

      if (!MediaPortal.Util.Utils.FileExistsInCache(fileName))
      {
        if (!Path.IsPathRooted(fileName))
        {
          return GUIGraphicsContext.GetThemedSkinFile(@"\media\" + fileName);
        }
      }
      return fileName;
    }