Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HasTitle)
            {
                hash ^= Title.GetHashCode();
            }
            if (HasAuthor)
            {
                hash ^= Author.GetHashCode();
            }
            if (cover_ != null)
            {
                hash ^= Cover.GetHashCode();
            }
            hash ^= stickers_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #2
0
        public override int GetHashCode()
        {
            unchecked
            {
                int result = Title != null?Title.GetHashCode() : 0;

                result = (result * 397) ^ (Year.HasValue ? Year.Value : 0);
                result = (result * 397) ^ (ImdbId != null ? ImdbId.GetHashCode() : 0);
                result = (result * 397) ^ (ImdbRating.HasValue ? ImdbRating.Value.GetHashCode() : 0);
                result = (result * 397) ^ (Cover != null ? Cover.GetHashCode() : 0);
                result = (result * 397) ^ TimeAdded;
                result = (result * 397) ^ (Duration.HasValue ? Duration.Value : 0);
                result = (result * 397) ^ (Plot != null ? Plot.GetHashCode() : 0);
                result = (result * 397) ^ (GuessedTitle != null ? GuessedTitle.GetHashCode() : 0);

                foreach (var s in Files.Concat(Principals).Concat(Directors).Concat(Genres).Concat(Writers).Concat(Tags))
                {
                    result = (result * 397) ^ (s != null ? s.GetHashCode() : 0);
                }

                return(result);
            }
        }