public override bool Equals(object obj)
        {
            MovieCollectionInfo other = obj as MovieCollectionInfo;

            if (other == null)
            {
                return(false);
            }

            if (MovieDbId > 0 && other.MovieDbId > 0)
            {
                return(MovieDbId == other.MovieDbId);
            }
            foreach (var key in CustomIds.Keys)
            {
                if (other.CustomIds.ContainsKey(key))
                {
                    return(string.Equals(CustomIds[key], other.CustomIds[key], StringComparison.InvariantCultureIgnoreCase));
                }
            }

            //Name id is generated from name and can be unreliable so should only be used if matches
            if (!string.IsNullOrEmpty(NameId) && !string.IsNullOrEmpty(other.NameId) &&
                string.Equals(NameId, other.NameId, StringComparison.InvariantCultureIgnoreCase))
            {
                return(true);
            }

            if (!CollectionName.IsEmpty && !other.CollectionName.IsEmpty && CollectionName.Text == other.CollectionName.Text)
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is MovieInfo)
            {
                MovieInfo otherMovie = otherInstance as MovieInfo;
                MovieDbId           = otherMovie.MovieDbId;
                AllocinebId         = otherMovie.AllocinebId;
                CinePassionId       = otherMovie.CinePassionId;
                ImdbId              = otherMovie.ImdbId;
                NameId              = otherMovie.NameId;
                CollectionMovieDbId = otherMovie.CollectionMovieDbId;
                CollectionNameId    = otherMovie.CollectionNameId;
                return(true);
            }
            else if (otherInstance is MovieCollectionInfo)
            {
                MovieCollectionInfo otherCollection = otherInstance as MovieCollectionInfo;
                CollectionMovieDbId = otherCollection.MovieDbId;
                CollectionNameId    = otherCollection.NameId;
                return(true);
            }
            return(false);
        }
예제 #3
0
 public override T CloneBasicInstance <T>()
 {
     if (typeof(T) == typeof(MovieCollectionInfo))
     {
         MovieCollectionInfo info = new MovieCollectionInfo();
         info.MovieDbId      = MovieDbId;
         info.NameId         = NameId;
         info.CollectionName = CollectionName;
         return((T)(object)info);
     }
     return(default(T));
 }
예제 #4
0
 public override T CloneBasicInstance <T>()
 {
     if (typeof(T) == typeof(MovieCollectionInfo))
     {
         MovieCollectionInfo info = new MovieCollectionInfo();
         info.MovieDbId      = CollectionMovieDbId;
         info.NameId         = CollectionNameId;
         info.CollectionName = new SimpleTitle(CollectionName.Text, CollectionName.DefaultLanguage);
         info.Languages.AddRange(Languages);
         info.LastChanged = LastChanged;
         info.DateAdded   = DateAdded;
         return((T)(object)info);
     }
     return(default(T));
 }
 public override T CloneBasicInstance <T>()
 {
     if (typeof(T) == typeof(MovieCollectionInfo))
     {
         MovieCollectionInfo info = new MovieCollectionInfo();
         info.MovieDbId      = MovieDbId;
         info.NameId         = NameId;
         info.CollectionName = CollectionName;
         foreach (var keyVal in CustomIds)
         {
             info.CustomIds[keyVal.Key] = keyVal.Value;
         }
         return((T)(object)info);
     }
     return(default(T));
 }
        public MovieCollectionInfo Clone()
        {
            MovieCollectionInfo clone = (MovieCollectionInfo)this.MemberwiseClone();

            clone.CollectionName = new SimpleTitle(CollectionName.Text, CollectionName.DefaultLanguage);
            clone.Languages      = new List <string>();
            foreach (var l in Languages)
            {
                clone.Languages.Add(l);
            }
            clone.Movies = new List <MovieInfo>();
            foreach (var m in Movies)
            {
                clone.Movies.Add(m.Clone());
            }

            return(clone);
        }
예제 #7
0
 public override T CloneBasicInstance <T>()
 {
     if (typeof(T) == typeof(MovieCollectionInfo))
     {
         MovieCollectionInfo info = new MovieCollectionInfo();
         info.MovieDbId = CollectionMovieDbId;
         info.NameId    = CollectionNameId;
         foreach (var keyVal in CustomCollectionIds)
         {
             info.CustomIds[keyVal.Key] = keyVal.Value;
         }
         info.CollectionName = new SimpleTitle(CollectionName.Text, CollectionName.DefaultLanguage);
         info.Languages.AddRange(Languages);
         info.LastChanged       = LastChanged;
         info.DateAdded         = DateAdded;
         info.ForceOnlineSearch = ForceOnlineSearch;
         return((T)(object)info);
     }
     return(default(T));
 }
예제 #8
0
        public override bool CopyIdsFrom <T>(T otherInstance)
        {
            if (otherInstance == null)
            {
                return(false);
            }

            if (otherInstance is MovieInfo)
            {
                MovieInfo otherMovie = otherInstance as MovieInfo;
                MovieDbId           = otherMovie.MovieDbId;
                AllocinebId         = otherMovie.AllocinebId;
                CinePassionId       = otherMovie.CinePassionId;
                ImdbId              = otherMovie.ImdbId;
                NameId              = otherMovie.NameId;
                CollectionMovieDbId = otherMovie.CollectionMovieDbId;
                CollectionNameId    = otherMovie.CollectionNameId;
                foreach (var keyVal in otherMovie.CustomIds)
                {
                    CustomIds[keyVal.Key] = keyVal.Value;
                }
                foreach (var keyVal in otherMovie.CustomCollectionIds)
                {
                    CustomCollectionIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            else if (otherInstance is MovieCollectionInfo)
            {
                MovieCollectionInfo otherCollection = otherInstance as MovieCollectionInfo;
                CollectionMovieDbId = otherCollection.MovieDbId;
                CollectionNameId    = otherCollection.NameId;
                foreach (var keyVal in otherCollection.CustomIds)
                {
                    CustomCollectionIds[keyVal.Key] = keyVal.Value;
                }
                return(true);
            }
            return(false);
        }