Пример #1
0
        public int CompareTo(IShowInfo other)
        {
            Weapon temp = other as Weapon;

            switch (IShowInfo.Choice)
            {
            case ConsoleKey.D1:
                if (_Damage < temp._Damage)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }

            case ConsoleKey.D2:
                if (WeaponName[0] < temp.WeaponName[0])
                {
                    return(-1);
                }
                else
                {
                    return(1);
                }

            default:
                return(1);
            }
        }
Пример #2
0
        public int CompareTo(IShowInfo other)
        {
            Player temp  = other as Player;
            Player temp2 = this;

            switch (IShowInfo.Choice)
            {
            case ConsoleKey.D1:
                if (Health < temp.Health)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }

            case ConsoleKey.D2:
                if (ClassName[0] < temp.ClassName[0])
                {
                    return(-1);
                }
                else
                {
                    return(1);
                }

            default:
                return(1);
            }
        }
Пример #3
0
        public int CompareTo(IShowInfo other)
        {
            Potion temp = other as Potion;

            if (_Name[0] < temp._Name[0])
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        }
Пример #4
0
        public async Task<IList<IEpisodeInfo>> GetEpisodeListAsync(IShowInfo showInfo, CancellationToken cancellationToken)
        {
            var epkey = epPrefixKey + showInfo.Title;

            var epset = cache.Get(epkey) as IList<IEpisodeInfo>;
            if (epset == null)
            {
                epset = new List<IEpisodeInfo>();

                await GetEpisodesAsync(showInfo, (s) => epset.Add(s), cancellationToken);

                cache.Set(epkey, epset, DateTimeOffset.Now.AddHours(8));
            }
            return epset;
        }
Пример #5
0
        public async Task <IList <IEpisodeInfo> > GetEpisodeListAsync(IShowInfo showInfo, CancellationToken cancellationToken)
        {
            var epkey = epPrefixKey + showInfo.Title;

            var epset = cache.Get(epkey) as IList <IEpisodeInfo>;

            if (epset == null)
            {
                epset = new List <IEpisodeInfo>();

                await GetEpisodesAsync(showInfo, (s) => epset.Add(s), cancellationToken);

                cache.Set(epkey, epset, DateTimeOffset.Now.AddHours(8));
            }
            return(epset);
        }
Пример #6
0
        public async Task GetEpisodesAsync(IShowInfo show, Action <IEpisodeInfo> episodeHandler,
                                           CancellationToken cancellationToken)
        {
            if (show == null)
            {
                throw new ArgumentNullException("show");
            }
            if (episodeHandler == null)
            {
                throw new ArgumentNullException("episodeHandler");
            }
            var epShow = show as ShowInfo;

            if (epShow == null)
            {
                throw new ArgumentException("invalid show object type", "show");
            }

            using (
                var reader =
                    await
                    DataClient.ReadDataAsync(
                        new Uri(@"http://epguides.com/common/exportToCSV.asp?rage=" + epShow.TvRage),
                        cancellationToken))
            {
                // filter our <pre> and </pre>
                await DataClient.SkipUntilAsync(reader, "<pre>");

                await DataClient.ProcessRecordsAsync(reader, "</pre>", record =>
                {
                    int season;
                    int.TryParse(record[0], out season);
                    int episode;
                    int.TryParse(record[1], out episode);

                    episodeHandler(
                        new EpisodeInfo
                    {
                        Show    = show.Title,
                        Season  = season,
                        Episode = episode,
                        Title   = record[2]
                    });
                }, "season", "episode", "title");
            }
        }
Пример #7
0
        public int CompareTo(IShowInfo other)
        {
            Enemy temp = other as Enemy;

            switch (IShowInfo.Choice)
            {
            case ConsoleKey.D1:
                if (Health < temp.Health)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }

            case ConsoleKey.D2:
                if (Damage < temp.Damage)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }

            case ConsoleKey.D3:
                if (EnemyName[0] < temp.EnemyName[0])
                {
                    return(-1);
                }
                else
                {
                    return(1);
                }

            default:
                return(1);
            }
        }
Пример #8
0
        public async Task GetEpisodesAsync(IShowInfo show, Action<IEpisodeInfo> episodeHandler,
            CancellationToken cancellationToken)
        {
            if (show == null) throw new ArgumentNullException("show");
            if (episodeHandler == null) throw new ArgumentNullException("episodeHandler");
            var epShow = show as ShowInfo;
            if (epShow == null) throw new ArgumentException("invalid show object type", "show");

            using (
                var reader =
                    await
                        DataClient.ReadDataAsync(
                            new Uri(@"http://epguides.com/common/exportToCSV.asp?rage=" + epShow.TvRage),
                            cancellationToken))
            {
                // filter our <pre> and </pre>
                await DataClient.SkipUntilAsync(reader, "<pre>");

                await DataClient.ProcessRecordsAsync(reader, "</pre>", record =>
                {
                    int season;
                    int.TryParse(record[0], out season);
                    int episode;
                    int.TryParse(record[1], out episode);

                    episodeHandler(
                        new EpisodeInfo
                        {
                            Show = show.Title,
                            Season = season,
                            Episode = episode,
                            Title = record[2]
                        });
                }, "season", "episode", "title");
            }
        }
Пример #9
0
 public void SetShowInfo(IShowInfo s)
 {
     _showInfo = s;
 }
Пример #10
0
 public static void Register(IShowInfo obj)
 {
     obj.Show();
 }
Пример #11
0
        //public static void DengJi(Person person) //(Chinese cn)
        //{
        //   person.Show();
        //}

        public static void DengJi(IShowInfo lbjn)
        {
            lbjn.Show();
        }