diff --git a/Sources/Model/Serialization/LINQ_XML_Serialization.cs b/Sources/Model/Serialization/LINQ_XML_Serialization.cs
index f9dcabd..e87d5e0 100644
--- a/Sources/Model/Serialization/LINQ_XML_Serialization.cs
+++ b/Sources/Model/Serialization/LINQ_XML_Serialization.cs
@@ -71,6 +71,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Constructeur de la classe LinqXmlSerialization
+ ///
+ /// Chemin d'accès des fichiers de sauvegarde des données
public LinqXmlSerialization(string pathDirectory)
{
XMLPATH = pathDirectory;
@@ -89,81 +93,145 @@ public class LinqXmlSerialization : IDataManager
LoadSerialization();
}
+
+ ///
+ /// Permet d'ajouter un objet Album à l'application
+ ///
+ /// Album à ajouter
public void AddAlbum(Album album)
{
albums.Add(album);
}
+ ///
+ /// Permet d'ajouter un objet Artist à l'application
+ ///
+ /// Artist à ajouter
public void AddArtist(Artist artist)
{
artists.Add(artist);
}
+ ///
+ /// Permet d'ajouter un objet CustomTitle à l'application
+ ///
+ /// CustomTitle à ajouter
public void AddCustomTitle(CustomTitle title)
{
customTitles.Add(title);
}
+ ///
+ /// Permet d'ajouter un objet InfoTitle à l'application
+ ///
+ /// InfoTitle à ajouter
public void AddInfoTitle(InfoTitle title)
{
infoTitles.Add(title);
}
+ ///
+ /// Permet d'ajouter un objet Playlist à l'application
+ ///
+ /// Playlist à ajouter
public void AddPlaylist(Playlist playlist)
{
playlists.Add(playlist);
}
+ ///
+ /// Permet d'obtenir une liste d'objets Album
+ ///
+ /// Retourne une liste d'objets Album
public ObservableCollection GetAlbums()
{
return albums;
}
+ ///
+ /// Permet d'obtenir une liste d'objets Artist
+ ///
+ /// Retourne une liste d'objets Artist
public List GetArtists()
{
return artists;
}
+ ///
+ /// Permet d'obtenir une liste d'objets CustomTitle
+ ///
+ /// Retourne une liste d'objets CustomTitle
public ObservableCollection GetCustomTitles()
{
return customTitles;
}
+ ///
+ /// Permet d'obtenir une liste d'objets InfoTitle
+ ///
+ /// Retourne une liste d'objets InfoTitle
public ObservableCollection GetInfoTitles()
{
return infoTitles;
}
+ ///
+ /// Permet d'obtenir une liste d'objets Playlist
+ ///
+ /// Retourne une liste d'objets Playlist
public ObservableCollection GetPlaylists()
{
return playlists;
}
+ ///
+ /// Permet de retirer un objet Album de l'application
+ ///
+ /// Album à retirer
public void RemoveAlbum(Album album)
{
albums.Remove(album);
}
+ ///
+ /// Permet de retirer un objet Artist de l'application
+ ///
+ /// Artist à retirer
public void RemoveArtist(Artist artist)
{
artists.Remove(artist);
}
+ ///
+ /// Permet de retirer un objet CustomTitle de l'application
+ ///
+ /// CustomTitle à retirer
public void RemoveCustomTitle(CustomTitle title)
{
customTitles.Remove(title);
}
+ ///
+ /// Permet de retirer un objet InfoTitle de l'application
+ ///
+ /// InfoTitle à retirer
public void RemoveInfoTitle(InfoTitle title)
{
infoTitles.Remove(title);
}
+ ///
+ /// Permet de retirer un objet Playlist de l'application
+ ///
+ /// Playlist à retirer
public void RemovePlaylist(Playlist playlist)
{
playlists.Remove(playlist);
}
+ ///
+ /// Permet de charger les données
+ ///
public void LoadSerialization()
{
LoadArtists();
@@ -173,6 +241,9 @@ public class LinqXmlSerialization : IDataManager
LoadPlaylists();
}
+ ///
+ /// Permet de sauvegarder l'état de l'application
+ ///
public void SaveSerialization()
{
SaveArtists();
@@ -182,6 +253,9 @@ public class LinqXmlSerialization : IDataManager
SaveAlbums();
}
+ ///
+ /// Permet de charger les playlists depuis le fichier correspondant
+ ///
public void LoadPlaylists()
{
if (!File.Exists(XMLFILEPLAYLISTS))
@@ -246,6 +320,9 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de sauvegarder les playlists dans le fichier correpondant
+ ///
public void SavePlaylists()
{
XDocument PlaylistsFichier = new XDocument();
@@ -269,17 +346,26 @@ public class LinqXmlSerialization : IDataManager
}
}
}
-
+
+ ///
+ /// Permet de charger les artistes depuis les stubs
+ ///
public void LoadArtists()
{
artists = StubInfoTitle.StubAlbum.StubArtist.GetArtists();
}
+ ///
+ /// Permet de sauvegarder les artistes. Ne fais rien car ce sont les stubs qui s'en occupent
+ ///
public void SaveArtists()
{
// Don't do anything because it's static data
}
+ ///
+ /// Permet de charger les CustomTitles depuis le fichier de sauvegarde correspondant
+ ///
public void LoadCustomTitles()
{
if (!File.Exists(XMLFILECUSTOMS))
@@ -317,6 +403,9 @@ public class LinqXmlSerialization : IDataManager
customTitles = new ObservableCollection(customTitles2);
}
+ ///
+ /// Permet de sauvegarder les CustomTitles dans le fichier correspondant
+ ///
public void SaveCustomTitles()
{
XDocument CustomsFile = new XDocument();
@@ -342,16 +431,25 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de charger les albums depuis les stubs
+ ///
public void LoadAlbums()
{
albums = StubInfoTitle.StubAlbum.GetAlbums();
}
+ ///
+ /// Permet de sauvegarder les albums. Ne fais rien car ce sont les stubs qui s'en occupent
+ ///
public void SaveAlbums()
{
// Don't do anything because it's static data
}
+ ///
+ /// Permet de charger les InfoTitles depuis les stubs
+ ///
public void LoadInfoTitles()
{
infoTitles = StubInfoTitle.GetInfoTitles();
@@ -361,11 +459,19 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de sauvegarder les InfoTitles. Ne fais rien car ce sont les stubs qui s'en occupent
+ ///
public void SaveInfoTitles()
{
// Don't do anything because it's static data
}
+ ///
+ /// Permet de passer d'un genre à son nom en chaîne de caractère
+ ///
+ /// Genre à transformer
+ /// Retourne la chaîne de caractère correspondant au genre
public static Genre GetGenreByName(string genre)
{
if (genre == "HIP_HOP") return Genre.HIP_HOP;
@@ -388,6 +494,11 @@ public class LinqXmlSerialization : IDataManager
else return Genre.K_POP;
}
+ ///
+ /// Permet d'obtenir un objet InfoTitle à partir de son nom
+ ///
+ /// Nom de l'objet InfoTitle
+ /// Retourne l'objet InfoTitle avec un nom équivalent à celui donné en paramètre
public InfoTitle GetInfoTitleByName(string name)
{
foreach(InfoTitle it in infoTitles)
@@ -400,6 +511,11 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Permet d'obtenir un objet Artist à partir de son nom
+ ///
+ /// Nom de l'objet Artist
+ /// Retourne l'objet Artist avec un nom équivalent à celui donné en paramètre
public Artist GetArtistByName(string name)
{
foreach(Artist a in artists)
@@ -412,6 +528,11 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Permet d'obtenir un objet Album à partir de son nom
+ ///
+ /// Nom de l'objet Album
+ /// Retourne l'objet Album avec un nom équivalent à celui donné en paramètre
public Album GetAlbumByName(string name)
{
foreach(Album a in albums)
@@ -424,6 +545,11 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Permet d'obtenir un objet Album à partir de son ID
+ ///
+ /// ID de l'objet Album
+ /// Retourne l'objet Album avec un ID équivalent à celui donné en paramètre
public Album GetAlbumById(long id)
{
foreach(Album a in albums)
@@ -433,6 +559,11 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Permet d'obtenir un objet CustomTitle à partir de son chemin d'accès
+ ///
+ /// Chemin d'accès de l'objet CustomTitle
+ /// Retourne l'objet CustomTitle avec un chemin d'accès équivalent à celui donné en paramètre
public CustomTitle GetCustomTitleByPath(string custom)
{
foreach(CustomTitle customTitle in customTitles)
@@ -445,6 +576,10 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Permet d'ajouter des objets Album à l'application
+ ///
+ /// Liste d'Album à ajouter
public void AddAlbums(List albumsList)
{
foreach(Album a in albumsList)
@@ -453,6 +588,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet d'ajouter des objets Artist à l'application
+ ///
+ /// Liste d'Artist à ajouter
public void AddArtists(List artistsList)
{
foreach (Artist a in artistsList)
@@ -461,6 +600,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet d'ajouter des objets Playlist à l'application
+ ///
+ /// Liste de Playlist à ajouter
public void AddPlaylists(List playlistsList)
{
foreach (Playlist p in playlistsList)
@@ -469,6 +612,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet d'ajouter des objets CustomTitle à l'application
+ ///
+ /// Liste de CustomTitle à ajouter
public void AddCustomTitles(List customTitlesList)
{
foreach (CustomTitle ct in customTitlesList)
@@ -477,6 +624,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet d'ajouter des objets InfoTitle à l'application
+ ///
+ /// Liste d'InfoTitle à ajouter
public void AddInfoTitles(List infoTitlesList)
{
foreach (InfoTitle it in infoTitlesList)
@@ -485,6 +636,11 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet d'obtenir un objet Playlist à partir de son nom
+ ///
+ /// Nom de l'objet Playlist
+ /// Retourne l'objet Playlist avec un nom équivalent à celui donné en paramètre
public Playlist GetPlaylistByName(string name)
{
foreach(Playlist p in playlists)
@@ -497,6 +653,14 @@ public class LinqXmlSerialization : IDataManager
return null;
}
+ ///
+ /// Modifie un objet CustomTitle avec les informations données en paramètre
+ ///
+ /// CustomTitle à modifier
+ /// Nom de l'objet CustomTitle
+ /// Chemin d'accès de l'image de l'objet CustomTitle
+ /// Informations de l'objet CustomTitle
+ /// Chemin d'accès de l'objet CustomTitle
public void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path)
{
title.Name = name;
@@ -505,6 +669,14 @@ public class LinqXmlSerialization : IDataManager
title.Path = path;
}
+ ///
+ /// Modifie un objet CustomTitle avec les informations données en paramètre
+ ///
+ /// Chemin d'accès du CustomTitle à modifier
+ /// Nom de l'objet CustomTitle
+ /// Chemin d'accès de l'image de l'objet CustomTitle
+ /// Informations de l'objet CustomTitle
+ /// Chemin d'accès de l'objet CustomTitle
public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
{
CustomTitle title = GetCustomTitleByPath(path);
@@ -517,6 +689,16 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Modifie un objet InfoTitle avec les informations données en paramètre
+ ///
+ /// InfoTitle à modifier
+ /// Nom de l'objet InfoTitle
+ /// Chemin d'accès de l'image de l'objet InfoTitle
+ /// Informations de l'objet InfoTitle
+ /// Artist de l'objet InfoTitle
+ /// Description de l'objet InfoTitle
+ /// Genre de l'objet InfoTitle
public void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre)
{
title.Name = name;
@@ -526,6 +708,15 @@ public class LinqXmlSerialization : IDataManager
title.Genre = genre;
}
+ ///
+ /// Modifie un objet InfoTitle avec les informations données en paramètre
+ ///
+ /// Nom de l'objet InfoTitle à modifier
+ /// Chemin d'accès de l'image de l'objet InfoTitle
+ /// Informations de l'objet InfoTitle
+ /// Artist de l'objet InfoTitle
+ /// Description de l'objet InfoTitle
+ /// Genre de l'objet InfoTitle
public void UpdateInfoTitleByName(string name, string newUrl, string info, Artist artist, string description, Genre genre)
{
InfoTitle title = GetInfoTitleByName(name);
@@ -539,6 +730,15 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Modifie un objet Album avec les informations données en paramètre
+ ///
+ /// Album à modifier
+ /// Nom de l'objet Album
+ /// Chemin d'accès de l'image de l'objet Album
+ /// Artist de l'objet Album
+ /// Description de l'objet Album
+ /// Informations de l'objet Album
public void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info)
{
album.Name = name;
@@ -548,6 +748,14 @@ public class LinqXmlSerialization : IDataManager
album.Information = info;
}
+ ///
+ /// Modifie un objet Album avec les informations données en paramètre
+ ///
+ /// Nom de l'objet Album à modifier
+ /// Chemin d'accès de l'image de l'objet Album
+ /// Artist de l'objet Album
+ /// Description de l'objet Album
+ /// Informations de l'objet Album
public void UpdateAlbumByName(string name, string newUrl, Artist artist, string description, string info)
{
Album album = GetAlbumByName(name);
@@ -561,6 +769,15 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Modifie un objet Album avec les informations données en paramètre
+ ///
+ /// Album à modifier
+ /// Nom de l'objet Album
+ /// Chemin d'accès de l'image de l'objet Album
+ /// Nom de l'artiste de l'objet Album
+ /// Description de l'objet Album
+ /// Informations de l'objet Album
public void UpdateAlbumByArtistName(Album album, string name, string url, string artist, string description, string info)
{
album.Name = name;
@@ -574,6 +791,14 @@ public class LinqXmlSerialization : IDataManager
album.Information = info;
}
+ ///
+ /// Modifie un objet Album avec les informations données en paramètre
+ ///
+ /// Nom de l'objet Album à modifier
+ /// Chemin d'accès de l'image de l'objet Album
+ /// Nom de l'artiste de l'objet Album
+ /// Description de l'objet Album
+ /// Informations de l'objet Album
public void UpdateAlbumByNameByArtistName(string name, string newUrl, string artist, string description, string info)
{
Album album = GetAlbumByName(name);
@@ -591,6 +816,13 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Modifie un objet Playlist avec les informations données en paramètre
+ ///
+ /// Playlist à modifier
+ /// Nom de l'objet Playlist
+ /// Description de l'objet Playlist
+ /// Chemin d'accès de l'image de l'objet Playlist
public void UpdatePlaylist(Playlist playlist, string name, string description, string url)
{
playlist.Name = name;
@@ -598,6 +830,12 @@ public class LinqXmlSerialization : IDataManager
playlist.ImageURL = url;
}
+ ///
+ /// Modifie un objet Playlist avec les informations données en paramètre
+ ///
+ /// Nom de l'objet Playlist à modifier
+ /// Description de l'objet Playlist
+ /// Chemin d'accès de l'image de l'objet Playlist
public void UpdatePlaylistByName(string name, string description, string newUrl)
{
Playlist playlist = GetPlaylistByName(name);
@@ -609,11 +847,21 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Modifie un objet Artist avec les informations données en paramètre
+ ///
+ /// Artiste à modifier
+ /// Nom de l'objet Artist
public void UpdateArtist(Artist artist, string name)
{
artist.Name = name;
}
+ ///
+ /// Modifie un objet Artist avec les informations données en paramètre
+ ///
+ /// Nom de l'objet Artist à modifier
+ /// Nouveau nom de l'objet Artist
public void UpdateArtistByName(string name, string newName)
{
Artist artist = GetArtistByName(newName);
@@ -623,6 +871,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de retirer des objets Album de l'application
+ ///
+ /// Liste des objets Album à retirer de l'application
public void RemoveAlbums(List albumsList)
{
foreach (Album album in albumsList)
@@ -631,6 +883,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de retirer des objets Artist de l'application
+ ///
+ /// Liste des objets Artist à retirer de l'application
public void RemoveArtists(List artistsList)
{
foreach(Artist artist in artistsList)
@@ -639,6 +895,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de retirer des objets Playlist de l'application
+ ///
+ /// Liste des objets Playlist à retirer de l'application
public void RemovePlaylists(List playlistsList)
{
foreach (Playlist playlist in playlistsList)
@@ -647,6 +907,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de retirer des objets CustomTitle de l'application
+ ///
+ /// Liste des objets CustomTitle à retirer de l'application
public void RemoveCustomTitles(List customTitlesList)
{
foreach(CustomTitle customTitle in customTitlesList)
@@ -655,6 +919,10 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de retirer des objets InfoTitle de l'application
+ ///
+ /// Liste des objets InfoTitle à retirer de l'application
public void RemoveInfoTitles(List infoTitlesList)
{
foreach (InfoTitle infoTitle in infoTitlesList)
@@ -663,6 +931,11 @@ public class LinqXmlSerialization : IDataManager
}
}
+ ///
+ /// Permet de savoir si un objet Playlist appartient ou non à l'application
+ ///
+ /// Playlist à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsPlaylist(Playlist playlist)
{
foreach(Playlist p in playlists)
@@ -675,6 +948,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet Playlist appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet Playlist à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsPlaylistByName(string name)
{
foreach(Playlist p in playlists)
@@ -687,6 +965,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet Album appartient ou non à l'application
+ ///
+ /// Album à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsAlbum(Album album)
{
foreach(Album a in albums)
@@ -699,6 +982,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet Album appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet Album à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsAlbumByName(string name)
{
foreach(Album a in albums)
@@ -711,6 +999,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet Artist appartient ou non à l'application
+ ///
+ /// Artist à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsArtist(Artist artist)
{
foreach (Artist a in artists)
@@ -723,6 +1016,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet Artist appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet Artist à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsArtistByName(string name)
{
foreach(Artist a in artists)
@@ -735,6 +1033,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet CustomTitle appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet CustomTitle à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsCustomTitle(CustomTitle title)
{
foreach(CustomTitle ct in customTitles)
@@ -747,6 +1050,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet CustomTitle appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet CustomTitle à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsCustomTitleByName(string name)
{
foreach(CustomTitle ct in customTitles)
@@ -759,6 +1067,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet InfoTitle appartient ou non à l'application
+ ///
+ /// InfoTitle à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsInfoTitle(InfoTitle title)
{
foreach(InfoTitle it in infoTitles)
@@ -771,6 +1084,11 @@ public class LinqXmlSerialization : IDataManager
return false;
}
+ ///
+ /// Permet de savoir si un objet InfoTitle appartient ou non à l'application selon son nom
+ ///
+ /// Nom de l'objet InfoTitle à vérifier
+ /// Booléen True s'il est contenu dans l'application, False sinon
public bool ExistsInfoTitleByName(string name)
{
foreach(InfoTitle it in infoTitles)