using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace Model.Classes { [DataContract(Name = "fruitdudemon")] public class FruitDuDemon : ObjetOhara { [DataMember(Name = "nomromanise")] private string? nomromanise; public string? NomRomanise { get=>nomromanise; set { if(nomromanise==value) return; nomromanise = value; OnPropertyChanged(); } } [DataMember(Name = "type")] private string? type; public string? Type { get=>type; set { if(type==value) return; type = value; OnPropertyChanged(); } } [DataMember(Name = "premierchap")] private int premierchap; public int PremierChap { get=>premierchap; set { if(premierchap==value) return; premierchap = value; OnPropertyChanged(); } } [DataMember(Name = "premierep")] private int premierep; public int PremierEp { get=>premierep; set { if (premierep==value) return; premierep=value; OnPropertyChanged(); } } [DataMember(Name = "description")] private string? description; public string? Description { get=>description; set { if (description==value) return; description = value; OnPropertyChanged(); } } [DataMember(Name = "forces")] private string? forces; public string? Forces { get=>forces; set { if (forces==value) return; forces = value; OnPropertyChanged(); } } [DataMember(Name = "faiblesses")] private string? faiblesses; public string? Faiblesses { get=>faiblesses; set { if (faiblesses == value) return; faiblesses = value; OnPropertyChanged(); } } [DataMember(Name = "utilisateur", EmitDefaultValue = false)] public List Utilisateur { get; set; } = new List(); public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom) { NomRomanise = nomRomanise; Type = type; if (premierEp < 0) { PremierEp = 0; } else { PremierEp = premierEp; } if (premierChap < 0) { PremierChap = 0; } else { PremierChap = premierChap; } Description = description; Forces = forces; Faiblesses = faiblesses; } public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses, string image) : this(nom, nomRomanise, type, premierChap, premierEp, description, forces, faiblesses) { 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 { FruitDuDemon o = (FruitDuDemon)obj; return o.Nom == Nom; } } public override int GetHashCode() { return HashCode.Combine(NomRomanise, Type, PremierChap, PremierEp, Description, Forces, Faiblesses); } public override string ToString() { return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image; } } }