コード例 #1
0
ファイル: SeriesInfo.cs プロジェクト: zeroxist/MediaPortal-2
 public override T CloneBasicInstance <T>()
 {
     if (typeof(T) == typeof(SeriesInfo))
     {
         SeriesInfo info = new SeriesInfo();
         info.CopyIdsFrom(this);
         info.SeriesName     = SeriesName;
         info.SeriesNameSort = SeriesNameSort;
         info.FirstAired     = FirstAired;
         return((T)(object)info);
     }
     else if (typeof(T) == typeof(SeasonInfo))
     {
         SeasonInfo info = new SeasonInfo();
         info.CopyIdsFrom(this);
         info.SeriesName = SeriesName;
         return((T)(object)info);
     }
     else if (typeof(T) == typeof(EpisodeInfo))
     {
         EpisodeInfo info = new EpisodeInfo();
         info.CopyIdsFrom(this);
         info.SeriesName = SeriesName;
         return((T)(object)info);
     }
     return(default(T));
 }
コード例 #2
0
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is SeriesInfo)
            {
                SeriesInfo otherSeries = otherInstance as SeriesInfo;
                MovieDbId = otherSeries.MovieDbId;
                ImdbId    = otherSeries.ImdbId;
                TvdbId    = otherSeries.TvdbId;
                TvMazeId  = otherSeries.TvMazeId;
                TvRageId  = otherSeries.TvRageId;
                NameId    = otherSeries.NameId;
                foreach (var keyVal in otherSeries.CustomIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            else if (otherInstance is SeasonInfo)
            {
                SeasonInfo seriesSeason = otherInstance as SeasonInfo;
                MovieDbId    = seriesSeason.SeriesMovieDbId;
                ImdbId       = seriesSeason.SeriesImdbId;
                TvdbId       = seriesSeason.SeriesTvdbId;
                TvMazeId     = seriesSeason.SeriesTvMazeId;
                TvRageId     = seriesSeason.SeriesTvRageId;
                NameId       = seriesSeason.SeriesNameId;
                SearchSeason = seriesSeason.SeasonNumber;
                foreach (var keyVal in seriesSeason.CustomSeriesIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            else if (otherInstance is EpisodeInfo)
            {
                EpisodeInfo seriesEpisode = otherInstance as EpisodeInfo;
                MovieDbId = seriesEpisode.SeriesMovieDbId;
                ImdbId    = seriesEpisode.SeriesImdbId;
                TvdbId    = seriesEpisode.SeriesTvdbId;
                TvMazeId  = seriesEpisode.SeriesTvMazeId;
                TvRageId  = seriesEpisode.SeriesTvRageId;
                NameId    = seriesEpisode.SeriesNameId;
                foreach (var keyVal in seriesEpisode.CustomSeriesIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                SearchSeason = seriesEpisode.SeasonNumber;
                if (seriesEpisode.EpisodeNumbers.Count > 0)
                {
                    SearchEpisode = seriesEpisode.FirstEpisodeNumber;
                }
                return(true);
            }
            return(false);
        }
コード例 #3
0
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is SeriesInfo)
            {
                SeriesInfo seasonSeries = otherInstance as SeriesInfo;
                SeriesImdbId    = seasonSeries.ImdbId;
                SeriesMovieDbId = seasonSeries.MovieDbId;
                SeriesTvdbId    = seasonSeries.TvdbId;
                SeriesTvMazeId  = seasonSeries.TvMazeId;
                SeriesTvRageId  = seasonSeries.TvRageId;
                SeriesNameId    = seasonSeries.NameId;
                return(true);
            }
            else if (otherInstance is SeasonInfo)
            {
                SeasonInfo otherSeason = otherInstance as SeasonInfo;
                MovieDbId = otherSeason.MovieDbId;
                ImdbId    = otherSeason.ImdbId;
                TvdbId    = otherSeason.TvdbId;
                TvMazeId  = otherSeason.TvMazeId;
                TvRageId  = otherSeason.TvRageId;

                SeriesImdbId    = otherSeason.SeriesImdbId;
                SeriesMovieDbId = otherSeason.SeriesMovieDbId;
                SeriesTvdbId    = otherSeason.SeriesTvdbId;
                SeriesTvMazeId  = otherSeason.SeriesTvMazeId;
                SeriesTvRageId  = otherSeason.SeriesTvRageId;
                SeriesNameId    = otherSeason.SeriesNameId;
                return(true);
            }
            else if (otherInstance is EpisodeInfo)
            {
                EpisodeInfo seasonEpisode = otherInstance as EpisodeInfo;
                SeriesImdbId    = seasonEpisode.SeriesImdbId;
                SeriesMovieDbId = seasonEpisode.SeriesMovieDbId;
                SeriesTvdbId    = seasonEpisode.SeriesTvdbId;
                SeriesTvMazeId  = seasonEpisode.SeriesTvMazeId;
                SeriesTvRageId  = seasonEpisode.SeriesTvRageId;
                SeriesNameId    = seasonEpisode.SeriesNameId;
                return(true);
            }
            return(false);
        }
コード例 #4
0
ファイル: SeriesInfo.cs プロジェクト: zeroxist/MediaPortal-2
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is SeriesInfo)
            {
                SeriesInfo otherSeries = otherInstance as SeriesInfo;
                MovieDbId = otherSeries.MovieDbId;
                ImdbId    = otherSeries.ImdbId;
                TvdbId    = otherSeries.TvdbId;
                TvMazeId  = otherSeries.TvMazeId;
                TvRageId  = otherSeries.TvRageId;
                NameId    = otherSeries.NameId;
                return(true);
            }
            else if (otherInstance is SeasonInfo)
            {
                SeasonInfo seriesSeason = otherInstance as SeasonInfo;
                MovieDbId    = seriesSeason.SeriesMovieDbId;
                ImdbId       = seriesSeason.SeriesImdbId;
                TvdbId       = seriesSeason.SeriesTvdbId;
                TvMazeId     = seriesSeason.SeriesTvMazeId;
                TvRageId     = seriesSeason.SeriesTvRageId;
                NameId       = seriesSeason.SeriesNameId;
                SearchSeason = seriesSeason.SeasonNumber;
                return(true);
            }
            else if (otherInstance is EpisodeInfo)
            {
                EpisodeInfo seriesEpisode = otherInstance as EpisodeInfo;
                MovieDbId    = seriesEpisode.SeriesMovieDbId;
                ImdbId       = seriesEpisode.SeriesImdbId;
                TvdbId       = seriesEpisode.SeriesTvdbId;
                TvMazeId     = seriesEpisode.SeriesTvMazeId;
                TvRageId     = seriesEpisode.SeriesTvRageId;
                NameId       = seriesEpisode.SeriesNameId;
                SearchSeason = seriesEpisode.SeasonNumber;
                if (seriesEpisode.EpisodeNumbers.Count > 0)
                {
                    SearchEpisode = seriesEpisode.FirstEpisodeNumber;
                }
                return(true);
            }
            return(false);
        }
コード例 #5
0
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is SubtitleInfo)
            {
                SubtitleInfo other = otherInstance as SubtitleInfo;
                MovieDbId  = other.MovieDbId;
                ImdbId     = other.ImdbId;
                TvdbId     = other.TvdbId;
                SubtitleId = other.SubtitleId;
                foreach (var keyVal in other.CustomIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            else if (otherInstance is MovieInfo)
            {
                MovieInfo other = otherInstance as MovieInfo;
                MovieDbId = other.MovieDbId;
                ImdbId    = other.ImdbId;
                foreach (var keyVal in other.CustomIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            else if (otherInstance is EpisodeInfo)
            {
                EpisodeInfo other = otherInstance as EpisodeInfo;
                MovieDbId = other.MovieDbId;
                ImdbId    = other.ImdbId;
                TvdbId    = other.TvdbId;
                foreach (var keyVal in other.CustomIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            return(false);
        }
コード例 #6
0
        public override T CloneBasicInstance <T>()
        {
            if (typeof(T) == typeof(SeriesInfo))
            {
                SeriesInfo info = new SeriesInfo();
                info.ImdbId    = SeriesImdbId;
                info.MovieDbId = SeriesMovieDbId;
                info.TvdbId    = SeriesTvdbId;
                info.TvMazeId  = SeriesTvMazeId;
                info.TvRageId  = SeriesTvRageId;
                info.NameId    = SeriesNameId;

                info.SeriesName   = new SimpleTitle(SeriesName.Text, SeriesName.DefaultLanguage);
                info.SearchSeason = SeasonNumber;
                info.LastChanged  = LastChanged;
                info.DateAdded    = DateAdded;
                return((T)(object)info);
            }
            else if (typeof(T) == typeof(SeasonInfo))
            {
                SeasonInfo info = new SeasonInfo();
                info.CopyIdsFrom(this);
                info.SeriesName   = SeriesName;
                info.SeasonNumber = SeasonNumber;
                return((T)(object)info);
            }
            else if (typeof(T) == typeof(EpisodeInfo))
            {
                EpisodeInfo info = new EpisodeInfo();
                info.CopyIdsFrom(this);
                info.SeriesName   = SeriesName;
                info.SeasonNumber = SeasonNumber;
                return((T)(object)info);
            }
            return(default(T));
        }