public static void CreateDefaultThemes()
    {
      // Define list of effects to be applied to source logo, order matters here. Add only effects that are enabled by configuration.
      List<AbstractEffect> effects = new List<AbstractEffect>
      {
        new EffectAutoCrop(),
        new EffectResize {TargetSize = new Size(200, 110), MaxSize = new Size(200, 110)},
        // new EffectGlow {Color = Color.Red, Radius = 15},
        new EffectShadow {Color = Color.FromArgb(200, 0, 0, 0), Radius = 5, ShadowXOffset = 5, ShadowYOffset = 5},
        new EffectOuterGlow {Color = Color.Black, Width = 1, Transparency = 0.8f}
      };

      ThemeHandler themeHandler = new ThemeHandler();
      string theme = string.Format("{0}-{1}", DESIGN, THEMES[0]);
      if (!File.Exists(theme))
      {
        Theme themeModern = new Theme { DesignName = DESIGN, ThemeName = THEMES[0] };
        themeHandler.Save(theme, themeModern);
      }
      theme = string.Format("{0}-{1}", DESIGN, THEMES[1]);
      if (!File.Exists(theme))
      {
        Theme themeModernMaxEffects = new Theme { DesignName = DESIGN, ThemeName = THEMES[1], Effects = effects };
        themeHandler.Save(theme, themeModernMaxEffects);
      }
    }
    /// <summary>
    /// Gets a list of <see cref="FanArtImage"/>s for a requested <paramref name="mediaType"/>, <paramref name="fanArtType"/> and <paramref name="name"/>.
    /// The name can be: Series name, Actor name, Artist name depending on the <paramref name="mediaType"/>.
    /// </summary>
    /// <param name="mediaType">Requested FanArtMediaType</param>
    /// <param name="fanArtType">Requested FanArtType</param>
    /// <param name="name">Requested name of Series, Actor, Artist...</param>
    /// <param name="maxWidth">Maximum width for image. <c>0</c> returns image in original size.</param>
    /// <param name="maxHeight">Maximum height for image. <c>0</c> returns image in original size.</param>
    /// <param name="singleRandom">If <c>true</c> only one random image URI will be returned</param>
    /// <param name="result">Result if return code is <c>true</c>.</param>
    /// <returns><c>true</c> if at least one match was found.</returns>
    public bool TryGetFanArt(FanArtConstants.FanArtMediaType mediaType, FanArtConstants.FanArtType fanArtType, string name, int maxWidth, int maxHeight, bool singleRandom, out IList<IResourceLocator> result)
    {
      result = null;
      if (mediaType != FanArtConstants.FanArtMediaType.ChannelTv && mediaType != FanArtConstants.FanArtMediaType.ChannelRadio)
        return false;

      try
      {
        string designsFolder = FileUtils.BuildAssemblyRelativePath("Designs");

        ChannelType logoChannelType = mediaType == FanArtConstants.FanArtMediaType.ChannelTv ? ChannelType.Tv : ChannelType.Radio;
        ThemeHandler themeHandler = new ThemeHandler();
        Theme theme = themeHandler.Load(Path.Combine(designsFolder, _settings.LogoTheme));

        string logoFolder = Path.Combine(_dataFolder, string.Format("{0}-{1}-{2}", logoChannelType, theme.DesignName, theme.ThemeName));
        string logoFileName = Path.Combine(logoFolder, FileUtils.GetSafeFilename(string.Format("{0}.png", name)));

        if (!Directory.Exists(logoFolder))
          Directory.CreateDirectory(logoFolder);

        if (File.Exists(logoFileName))
        {
          result = new List<IResourceLocator>{new ResourceLocator(ResourcePath.BuildBaseProviderPath(LocalFsResourceProviderBase.LOCAL_FS_RESOURCE_PROVIDER_ID, logoFileName))};
          return true;
        }

        LogoProcessor processor = new LogoProcessor { DesignsFolder = designsFolder };

        // From repository
        using (var repo = new LogoRepository { RepositoryUrl = _settings.RepositoryUrl })
        {
          var stream = repo.Download(name, logoChannelType, _country.TwoLetterISORegionName);
          if (stream == null)
            return false;
          using (stream)
            if (processor.CreateLogo(theme, stream, logoFileName))
            {
              result = new List<IResourceLocator> { new ResourceLocator(ResourcePath.BuildBaseProviderPath(LocalFsResourceProviderBase.LOCAL_FS_RESOURCE_PROVIDER_ID, logoFileName)) };
              return true;
            }
        }
      }
      catch (Exception ex)
      {
        ServiceRegistration.Get<ILogger>().Error("SlimTv Logos: Error processing logo image.", ex);
      }
      return false;
    }
 public static IEnumerable<Theme> LoadAllThemes()
 {
   ThemeHandler themeHandler = new ThemeHandler();
   return THEMES.Select(theme => string.Format("{0}-{1}", DESIGN, theme)).Select(themeHandler.Load);
 }