Add Stub and starting Model

pull/17/head
Corentin LEMAIRE 2 years ago
parent fabbd01efe
commit 4a47cba233

@ -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);
}

@ -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<Morceau> Morceaux { get; set; }
public IEnumerable<Title> 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();
}
}
}

@ -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);
}
}

@ -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;
}
}

@ -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
}

@ -0,0 +1,6 @@
namespace Model;
public interface IDataManager
{
//méthodes style IEnumerable<Groupe> RecupGFroupe();
}

@ -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();
}
}
}

@ -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);
}
}

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

@ -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);
}
}
}

@ -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);
}
}

@ -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));
}
}

@ -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;
}
}
}
Loading…
Cancel
Save