using System; using System.Runtime.Serialization; namespace Umbraco.Web.Models { [DataContract(Name = "imageCropFocalPoint")] public class ImageCropFocalPoint : IEquatable { [DataMember(Name = "left")] public decimal Left { get; set; } [DataMember(Name = "top")] public decimal Top { get; set; } /// /// Indicates whether the current object is equal to another object of the same type. /// /// /// true if the current object is equal to the parameter; otherwise, false. /// /// An object to compare with this object. public bool Equals(ImageCropFocalPoint other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Left == other.Left && Top == other.Top; } /// /// Determines whether the specified object is equal to the current object. /// /// /// true if the specified object is equal to the current object; otherwise, false. /// /// The object to compare with the current object. public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != GetType()) return false; return Equals((ImageCropFocalPoint) obj); } /// /// Serves as the default hash function. /// /// /// A hash code for the current object. /// public override int GetHashCode() { unchecked { return (Left.GetHashCode()*397) ^ Top.GetHashCode(); } } public static bool operator ==(ImageCropFocalPoint left, ImageCropFocalPoint right) { return Equals(left, right); } public static bool operator !=(ImageCropFocalPoint left, ImageCropFocalPoint right) { return Equals(left, right) == false; } } }