Esempio n. 1
0
        public override string ToString()
        {
            string temp = "";

            if ((Duration / 60) == 1)
            {
                temp = (Duration / 60) + " hour ";
            }
            else if ((Duration / 60) > 1)
            {
                temp = (Duration / 60) + " hours ";
            }

            temp += (Duration % 60) + " minutes";

            if (EpisodeTitle.ToString().Length == 0 && Description.ToString().Length != 0)
            {
                return(Title + " : " + Description + "\r\n" + Channel.ToString() + " " + StartTime.Day + "/" + StartTime.Month + " " + StartTime.ToString("t") + " " + temp);
            }
            else if (Description.ToString().Length == 0 && EpisodeTitle.ToString().Length != 0)
            {
                return(Title + " : " + EpisodeTitle + "\r\n" + Channel.ToString() + " " + StartTime.Day + "/" + StartTime.Month + " " + StartTime.ToString("t") + " " + temp);
            }
            else if (EpisodeTitle.ToString().Length == 0 && Description.ToString().Length == 0)
            {
                return(Title + "\r\n" + Channel.ToString() + " " + StartTime.Day + "/" + StartTime.Month + " " + StartTime.ToString("t") + " " + temp);
            }
            else
            {
                return(Title + " : " + EpisodeTitle + " : " + Description + "\r\n" + Channel.ToString() + " " + StartTime.Day + "/" + StartTime.Month + " " + StartTime.ToString("t") + " " + temp);
            }
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int ret = (Title != null) ? Title.GetHashCode() : 0;

            ret  = (ret * 397) ^ ((EpisodeNumber != null) ? EpisodeNumber.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((EpisodeTitle != null) ? EpisodeTitle.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Synopsis != null) ? Synopsis.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Team1 != null) ? Team1.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Team2 != null) ? Team2.GetHashCode() : 0);
            ret  = (ret * 397) ^ SeriesID.GetHashCode();
            ret &= 0x7fffffff;

            return(ret);
        }
Esempio n. 3
0
        public IActionResult ViewEpisode()
        {
            bool   isValid    = false;
            string episodeUrl = RouteData.Values["Episode"].ToString();
            string epUrl      = episodeUrl;

            if (episodeUrl.ToLower().Contains("_") && !episodeUrl.ToLower().Contains("veiwpic"))
            {
                episodeUrl = episodeUrl.ToLower().Replace(".php", "").Replace("_", "-");
            }
            EpisodeTitle ep = EpCapsList.S1List.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();

            if (ep != null && !String.IsNullOrWhiteSpace(ep.Title))
            {
                isValid = true;
            }
            if (ep == null)
            {
                ep = EpCapsList.S2List.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();
                if (!String.IsNullOrWhiteSpace(ep?.Title))
                {
                    isValid = true;
                }
            }
            if (ep == null)
            {
                ep = EpCapsList.S3List.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();
                if (!String.IsNullOrWhiteSpace(ep?.Title))
                {
                    isValid = true;
                }
            }
            if (ep == null)
            {
                ep = EpCapsList.S4List.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();
                if (!String.IsNullOrWhiteSpace(ep?.Title))
                {
                    isValid = true;
                }
            }
            if (ep == null)
            {
                ep = EpCapsList.MovieList.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();
                if (!String.IsNullOrWhiteSpace(ep?.Title))
                {
                    isValid = true;
                }
            }
            if (ep == null)
            {
                ep = EpCapsList.MiscList.Where(p => p.UrlLabel == episodeUrl).SingleOrDefault();
                if (!String.IsNullOrWhiteSpace(ep?.Title))
                {
                    isValid = true;
                }
            }
            if (RedirectTable.CapsList.ContainsKey(epUrl))
            {
                if (RedirectTable.CapsList[epUrl].StartsWith("/"))
                {
                    return(RedirectPermanent(RedirectTable.CapsList[epUrl]));
                }
                else
                {
                    return(RedirectPermanent($"/Caps/{RedirectTable.CapsList[epUrl]}"));
                }
            }
            if (!isValid)
            {
                using (FileStream fs = new FileStream(AppDomain.CurrentDomain.MapPath("~/App_Data/Urls.txt"), FileMode.Append))
                {
                    byte[] url = System.Text.Encoding.UTF8.GetBytes(Request.GetEncodedPathAndQuery() + "\r\n");
                    fs.Write(url, 0, url.Length);
                }
                return(Redirect("/Caps"));
            }
            if (isValid && epUrl.ToLower().Contains("_"))
            {
                return(RedirectPermanent("/Caps/" + episodeUrl));
            }

            var epData = _context.Episodes.SingleOrDefault(x => x.UrlLabel == epUrl);

            if (epData != null)
            {
                ep.Description = epData.Description;
            }

            return(View("EpisodeCaps", ep));
        }