Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinkItem"/> class.
        /// </summary>
        /// <param name="link">The link.</param>
        public LinkItem(Link link) : base(link.Source)
        {
            Release = link.Release;
            Quality = link.Quality;
            Size    = link.Size;
            InfoURL = link.InfoURL;
            FileURL = link.FileURL;
            Infos   = link.Infos;
            Color   = "White";

            if (!Signature.IsActivated)
            {
                return;
            }

            switch (Source.Type)
            {
            case Types.Torrent:
                if (Infos.StartsWith("0 seed") && Settings.Get("Fade Dead Torrents", true))
                {
                    Color = "#50FFFFFF";
                }
                else if (Infos.Contains("Free") && Settings.Get <bool>("Highlight Free Torrents"))
                {
                    Color = "GreenYellow";
                }
                break;

            case Types.Usenet:
                var ret = Settings.Get("Usenet Retention", 0);

                if (ret != 0 && Infos.Contains("day") && int.Parse(Infos.Replace(",", string.Empty).Split(" ".ToCharArray()).First()) > ret)
                {
                    Color = "#50FFFFFF";
                }
                break;

            case Types.DirectHTTP:
                var typ = Settings.Get("One-Click Hoster List Type", "white");
                var lst = Settings.Get <List <string> >("One-Click Hoster List");

                if (typ == "white")
                {
                    if (string.IsNullOrWhiteSpace(FileURL) || !lst.Any(d => FileURL.Contains(d)))
                    {
                        Color = "#50FFFFFF";
                    }
                }
                else if (typ == "black")
                {
                    if (string.IsNullOrWhiteSpace(FileURL) || lst.Any(d => FileURL.Contains(d)))
                    {
                        Color = "#50FFFFFF";
                    }
                }
                break;
            }
        }