コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Runtime;
         hashCode = (hashCode * 397) ^ Year;
         hashCode = (hashCode * 397) ^ (PosterPath != null ? PosterPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Reviews != null ? Reviews.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #2
0
        /// <summary>
        /// Gets the actual Movie Poster for this Movie
        /// </summary>
        /// <param name="size"></param>
        /// <returns></returns>
        public Image GetMoviePoster(PosterSize size)
        {
            Image x = null;

            if (PosterPath != null)
            {
                String cachePath = PrivateData.GetAppPath() + @"\Cache\Images\Movie\" + PosterPath.Replace("/", "");

                if (File.Exists(cachePath))
                {
                    x = Image.FromFile(cachePath); // Use Image from Cache
                }
                else
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(cachePath));  // Insure Directory Exists

                    Uri uri = Uri(size);
                    var wc  = new WebClient();
                    x = Image.FromStream(wc.OpenRead(uri)); //Read from the Internet
                    x.Save(cachePath);                      //Save Image in Cache
                }
            }
            return(x);
        }