diff --git a/Sources/Linaris/FooterPage.xaml.cs b/Sources/Linaris/FooterPage.xaml.cs index 64b0c9f..adaa690 100644 --- a/Sources/Linaris/FooterPage.xaml.cs +++ b/Sources/Linaris/FooterPage.xaml.cs @@ -19,7 +19,7 @@ public partial class FooterPage : ContentView // (s,a) = convention, s = sender, a = arguments, si appli fermée, on free tout outputDevice.PlaybackStopped += PlaybackStoppedHandler; - morceauEnCours = "U:\\Utils\\Musics\\peaches.mp3"; + morceauEnCours = "D:\\Musique\\Création\\winter.mp3"; audioFile = new AudioFileReader(morceauEnCours); outputDevice.Init(audioFile); } diff --git a/Sources/Model/Album.cs b/Sources/Model/Album.cs index 1eafa3e..7dab8f9 100644 --- a/Sources/Model/Album.cs +++ b/Sources/Model/Album.cs @@ -1,32 +1,92 @@ namespace Model { - public class Album + public class Album { - public string Nom { get; set; } + public string Name + { + get => name; - public string File_Name { get; set; } + set + { + if (value != null && value.Length < 75) + { + name = value; + } + } + } - public Artiste Artiste { get; set; } + private string name; - public string Description { get; set; } + public string Description + { + get => description; + + set + { + if (value != null && value.Length < 500) + { + description = value; + } + } + } - public string Informations { get; set; } + private string description; - public IEnumerable Morceaux { get; set; } + public IEnumerable Titles { get; set; } - public Album(string nom, string file_Name, Artiste artiste, string description, string informations) + public string ImageURL { - Nom = nom; - File_Name = file_Name; - Artiste = artiste; + get => imageURL; + + set + { + if (value != null && value.Contains('.')) + { + imageURL = value; + } + } + } + + private string imageURL; + + public Artiste Artist { get; set; } + + public string Information + { + get => information; + + set + { + if (value != null && value.Length < 500) + { + information = value; + } + } + } + + private string information; + + public Album(string name, string file_Name, Artiste artist, string description, string information) + { + Name = name; + ImageURL = file_Name; + Artist = artist; Description = description; - Informations = informations; - Morceaux = new List<Morceau>(); + Information = information; + Titles = new List<Title>(); + } + + public void AddTitle(Title title) + { + Titles.Prepend(title); } - public void addMorceau(Morceau morceau) + public void RemoveTitle(Title title) { - Morceaux.Prepend(morceau); + foreach(var item in Titles) + { + Titles = Titles.Where(item => item != title).ToList(); + } } } diff --git a/Sources/Model/Artiste.cs b/Sources/Model/Artiste.cs index fa84929..bcab081 100644 --- a/Sources/Model/Artiste.cs +++ b/Sources/Model/Artiste.cs @@ -1,26 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace Model; -namespace Model +public class Artiste { - public class Artiste + public string Name { - public string Nom { get; set; } + get => name; - public IEnumerable<Album> Albums { get; set; } - - public Artiste(string nom) + set { - Nom = nom; - Albums = new List<Album>(); + if (value != null && value.Length < 75) + { + name = value; + } } + } - public void addAlbum(Album album) - { - Albums.Prepend(album); - } + private string name = "Unknown"; + + public IEnumerable<Album> Albums { get; set; } + + public Artiste(string name) + { + Name = name; + Albums = new List<Album>(); + } + + public void AddAlbum(Album album) + { + Albums.Prepend(album); } } diff --git a/Sources/Model/CustomTitle.cs b/Sources/Model/CustomTitle.cs new file mode 100644 index 0000000..9b41237 --- /dev/null +++ b/Sources/Model/CustomTitle.cs @@ -0,0 +1,24 @@ +namespace Model; + +public class CustomTitle : Title { + + public string Path + { + get => path; + + set + { + if (value != null && value.Length < 500) + { + path = value; + } + } + } + + private string path; + + public CustomTitle(string name, string imageURL, string information, string path) : base(name, imageURL, information) + { + Path = path; + } +} diff --git a/Sources/Model/Genre.cs b/Sources/Model/Genre.cs new file mode 100644 index 0000000..4298509 --- /dev/null +++ b/Sources/Model/Genre.cs @@ -0,0 +1,6 @@ +namespace Model; + +public enum Genre +{ + HIP_HOP, POP, ROCK, ELECTRO, CLASSIQUE, JAZZ, VARIETE_FRANCAISE, VARIETE_INTERNATIONALE, REGGAE, RAP, RNB, DISCO, BLUES, COUNTRY, FUNK, GOSPEL, METAL, K_POP +} diff --git a/Sources/Model/IDataManager.cs b/Sources/Model/IDataManager.cs new file mode 100644 index 0000000..4799ef5 --- /dev/null +++ b/Sources/Model/IDataManager.cs @@ -0,0 +1,6 @@ +namespace Model; + +public interface IDataManager +{ + //méthodes style IEnumerable<Groupe> RecupGFroupe(); +} \ No newline at end of file diff --git a/Sources/Model/InfoTitle.cs b/Sources/Model/InfoTitle.cs new file mode 100644 index 0000000..bb9eb4d --- /dev/null +++ b/Sources/Model/InfoTitle.cs @@ -0,0 +1,46 @@ +namespace Model; + +public class InfoTitle : Title +{ + public Artiste Artiste { get; set; } + + public string Description + { + get => description; + + set + { + if (value != null && value.Length < 500) + { + description = value; + } + } + } + + private string description; + + public IEnumerable<Artiste> Feat { get; set; } + + public Genre Genre { get; set; } + + public InfoTitle(string name, string imageURL, string information, Artiste artist, string description, Genre genre) : base(name,imageURL,information) + { + Artiste = artist; + Description = description; + Genre = genre; + Feat = new List<Artiste>(); + } + + public void AddFeat(Artiste artist) + { + Feat.Prepend(artist); + } + public void RemoveFeat(Artiste artiste) + { + foreach (var item in Feat) + { + Feat = Feat.Where(item => item != artiste).ToList(); + } + } + +} diff --git a/Sources/Model/Manager.cs b/Sources/Model/Manager.cs new file mode 100644 index 0000000..9de8d13 --- /dev/null +++ b/Sources/Model/Manager.cs @@ -0,0 +1,51 @@ +namespace Model.Stub; + +public class Manager +{ + public IDataManager DataManager { get; set; } + + public IEnumerable<Album> Albums; + + public IEnumerable<Title> Titles; + + public IEnumerable<Playlist> Playlists; + + public Manager() + { + DataManager = new Stub(); + // Albums = DataManager.GetAlbum(); + Albums = new List<Album>(); + Titles = new List<Title>(); + Playlists = new List<Playlist>(); + } + + public void AddAlbum(Album album) + { + Albums.Prepend(album); + } + + public void AddTitle(Title title) + { + Titles.Prepend(title); + } + public void AddPlaylist(Playlist playlist) + { + Playlists.Prepend(playlist); + } + + public void RemoveAlbum(Album album) + { + Albums.ToList().Remove(album); + } + + public void RemoveTitle(Title title) + { + Titles.ToList().Remove(title); + } + + public void RemovePlaylist(Playlist playlist) + { + Playlists.ToList().Remove(playlist); + } + +} diff --git a/Sources/Model/Model.csproj b/Sources/Model/Model.csproj deleted file mode 100644 index 4658cbf..0000000 --- a/Sources/Model/Model.csproj +++ /dev/null @@ -1,9 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>net7.0</TargetFramework> - <ImplicitUsings>enable</ImplicitUsings> - <Nullable>enable</Nullable> - </PropertyGroup> - -</Project> diff --git a/Sources/Model/Morceau.cs b/Sources/Model/Morceau.cs deleted file mode 100644 index 670d754..0000000 --- a/Sources/Model/Morceau.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Model -{ - public class Morceau - { - public string Nom { get; set; } - - public string File_Name { get; set; } - - public string Artiste { get; set; } - - public string Description { get; set; } - - public string Informations { get; set; } - - public IEnumerable<Artiste> feat { get; set; } - - public Morceau(string nom, string file_Name, string artiste, string description, string informations) - { - Nom = nom; - File_Name = file_Name; - Artiste = artiste; - Description = description; - Informations = informations; - feat = new List<Artiste>(); - } - - public void addFeat(Artiste artiste) - { - feat.Prepend(artiste); - } - } -} diff --git a/Sources/Model/Playlist.cs b/Sources/Model/Playlist.cs index 797c593..97d3e43 100644 --- a/Sources/Model/Playlist.cs +++ b/Sources/Model/Playlist.cs @@ -1,35 +1,70 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace Model; -namespace Model +public class Playlist { - public class Playlist + public string Name { - public string Nom { get; set; } + get => name; - public string Description { get; set; } - - public IEnumerable<Morceau> Morceaux { get; set; } - - public Playlist(string nom, string description) + set { - Nom = nom; - Description = description; - Morceaux = new List<Morceau>(); + if (value != null && value.Length < 75) + { + name = value; + } } + } + + private string name; + + public string Description + { + get => description; - public void addMorceau(Morceau morceau) + set { - Morceaux.Prepend(morceau); + if (value != null && value.Length < 500) + { + description = value; + } } + } + + private string description; + + public IEnumerable<Title> Morceaux { get; set; } + + public string ImageURL + { + get => imageURL; - public void removeMorceau(Morceau morceau) + set { - Morceaux.ToList().Remove(morceau); + if (value != null && value.Contains('.')) + { + imageURL = value; + } } + } + + private string imageURL; + + public Playlist(string nom, string description, string imageURL) + { + Name = nom; + Description = description; + Morceaux = new List<Title>(); + this.imageURL = imageURL; + } + public void AddTitle(Title morceau) + { + Morceaux.Prepend(morceau); } + + public void RemoveTitle(Title morceau) + { + Morceaux.ToList().Remove(morceau); + } + } diff --git a/Sources/Model/Stub/Stub.cs b/Sources/Model/Stub/Stub.cs new file mode 100644 index 0000000..9a60c86 --- /dev/null +++ b/Sources/Model/Stub/Stub.cs @@ -0,0 +1,49 @@ +namespace Model.Stub; + +public class Stub : IDataManager +{ + + public IEnumerable<Artiste> Artistes; + + public IEnumerable<Album> Albums; + + public IEnumerable<Playlist> Playlists; + + public IEnumerable<Title> Titles; + + public Stub() + { + Artistes = new List<Artiste>(); + Albums = new List<Album>(); + Playlists = new List<Playlist>(); + Titles = new List<Title>(); + + Artiste Artiste1 = new Artiste("Critien"); + Artiste Artiste2 = new Artiste("Gouriet"); + Artiste Artiste3 = new Artiste("Poulifer"); + Artiste Artiste4 = new Artiste("Credian"); + + Album Album1 = new Album("la street", "lastreet.png", Artiste1, "c'est la street", "plein d'infos1"); + Album Album4 = new Album("la pas le choix", "peutetre.png", Artiste4, "c'est la parterre", "plein d'infos4"); + + Artiste1.AddAlbum(Album1); + Artiste1.AddAlbum(new Album("la jsp", "oui.png", Artiste1, "c'est la couri", "plein d'infos2")); + Artiste2.AddAlbum(new Album("la pas le temps", "non.png", Artiste3, "c'est pas la street", "plein d'infos3")); + Artiste2.AddAlbum(Album4); + + Playlist Playlist1 = new Playlist("Playlist1", "desc1", "url1.png"); + Playlist Playlist2 = new Playlist("Playlist2", "desc2", "url2.png"); + Playlist Playlist3 = new Playlist("Playlist3", "desc3", "url3.png"); + Playlist Playlist4 = new Playlist("Playlist4", "desc4", "url4.png"); + + Playlist1.AddTitle(new CustomTitle("custom1", "url1.png", "info1", "chemin1")); + Playlist1.AddTitle(new CustomTitle("custom2", "url2.png", "info2", "chemin2")); + Playlist1.AddTitle(new CustomTitle("custom3", "url3.png", "info3", "chemin3")); + Playlist2.AddTitle(new CustomTitle("custom4", "url4.png", "info4", "chemin4")); + + Album1.AddTitle(new InfoTitle("info1", "url1.png", "info1", Artiste2, "desc1", Genre.K_POP)); + Album1.AddTitle(new InfoTitle("info2", "url2.png", "info2", Artiste3, "desc2", Genre.GOSPEL)); + Album1.AddTitle(new InfoTitle("info3", "url3.png", "info3", Artiste4, "desc3", Genre.BLUES)); + Album4.AddTitle(new InfoTitle("info4", "url4.png", "info4", Artiste3, "desc4", Genre.DISCO)); + } +} diff --git a/Sources/Model/Title.cs b/Sources/Model/Title.cs new file mode 100644 index 0000000..1d985e8 --- /dev/null +++ b/Sources/Model/Title.cs @@ -0,0 +1,58 @@ +namespace Model +{ + public class Title + { + public string Name + { + get => name; + + set + { + if (value != null && value.Length < 75) + { + name = value; + } + } + } + + private string name; + + public string ImageURL + { + get => imageURL; + + set + { + if (value != null && value.Contains('.')) + { + imageURL = value; + } + } + } + + private string imageURL; + + public string Information + { + get => information; + + set + { + if (value != null && value.Length < 500) + { + information = value; + } + } + } + + private string information; + + public Title(string nom, string file_Name, string informations) + { + Name = nom; + ImageURL = file_Name; + Information = informations; + } + + } +}