using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace Model.Classes { [DataContract(Name = "bestiaire")] public class Bestiaire : ObjetOhara { [DataMember(Name = "origine")] private string? origine; public string? Origine { get=>origine; set { if (origine == value) return; origine = value; OnPropertyChanged(); } } [DataMember(Name = "description")] private string? description; public string? Description { get=>description; set { if (description == value) return; description = value; OnPropertyChanged(); } } [DataMember(Name = "caracteristique")] private string? caracteristique; public string? Caracteristique { get=>caracteristique; set { if(caracteristique == value) return; caracteristique = value; OnPropertyChanged(); } } public Bestiaire(string nom, string origine, string description, string caracteristique) : base(nom) { if (String.IsNullOrEmpty(origine)) origine = "Grand Line"; Origine = origine; if (String.IsNullOrEmpty(description)) description = "Pour décrire ..."; Description = description; if (String.IsNullOrEmpty(caracteristique)) caracteristique = "Les caracteristiques ..."; Caracteristique = caracteristique; } public Bestiaire(string nom, string origine, string description, string caracteristique, string image) : this(nom, origine, description, caracteristique) { if (String.IsNullOrWhiteSpace(image)) image = "baseimage.png"; Image = image; } public override bool Equals(object? obj) { if (obj == null) return false; if (this.GetType() != obj.GetType()) { return false; } else { Bestiaire o = (Bestiaire)obj; return o.Nom == Nom; } } public override int GetHashCode() { return HashCode.Combine(Origine, Description, Caracteristique); } public override string ToString() { return "Bestiaire :" + Nom +" "+EstFavori+ " " + Origine + " " + Description + " " + Caracteristique +" " + Image; } } }