|
|
|
@ -11,7 +11,7 @@ using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Model.Serialization;
|
|
|
|
|
|
|
|
|
|
public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
public class Linq_Xml_Serialization : IDataManager
|
|
|
|
|
{
|
|
|
|
|
private static string XMLPATH = Path.Combine(Environment.CurrentDirectory, "Data");
|
|
|
|
|
|
|
|
|
@ -75,7 +75,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LINQ_XML_Serialization()
|
|
|
|
|
public Linq_Xml_Serialization()
|
|
|
|
|
{
|
|
|
|
|
playlists = new List<Playlist>();
|
|
|
|
|
artists = new List<Artist>();
|
|
|
|
@ -195,7 +195,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
new XAttribute("Name", p.Name),
|
|
|
|
|
new XElement("Description", p.Description),
|
|
|
|
|
new XElement("ImageURL", p.ImageURL),
|
|
|
|
|
new XElement("Titles", p.Titles.Count() > 0 ? p.Titles.Select(a => a.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
new XElement("Titles", p.Titles.Any() ? p.Titles.Select(a => a.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
PlaylistFile.Add(new XElement("Playlists", playlist));
|
|
|
|
@ -247,7 +247,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
new XAttribute("Name", playlist.Name),
|
|
|
|
|
new XElement("Description", playlist.Description),
|
|
|
|
|
new XElement("ImageURL", playlist.ImageURL),
|
|
|
|
|
new XElement("Titles", playlist.Titles.Count() > 0 ? playlist.Titles.Select(p => p.ImageURL).Aggregate((playlistUrl, nextPlaylist) => playlistUrl + " " + nextPlaylist) : "")
|
|
|
|
|
new XElement("Titles", playlist.Titles.Any() ? playlist.Titles.Select(p => p.ImageURL).Aggregate((playlistUrl, nextPlaylist) => playlistUrl + " " + nextPlaylist) : "")
|
|
|
|
|
));
|
|
|
|
|
PlaylistsFichier.Add(new XElement("Playlists", playlist));
|
|
|
|
|
|
|
|
|
@ -398,10 +398,10 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
var album = albums.Select(p => new XElement("Album",
|
|
|
|
|
new XAttribute("Name", p.Name),
|
|
|
|
|
new XElement("ImageURL", p.ImageURL),
|
|
|
|
|
new XElement("Artist", p.Titles.Count() > 0 ? p.Titles.Select(a => a.Name).Aggregate((artistName, nextArtist) => artistName + " " + nextArtist) : ""),
|
|
|
|
|
new XElement("Artist", p.Titles.Any() ? p.Titles.Select(a => a.Name).Aggregate((artistName, nextArtist) => artistName + " " + nextArtist) : ""),
|
|
|
|
|
new XElement("Description", p.Description),
|
|
|
|
|
new XElement("Information", p.Information),
|
|
|
|
|
new XElement("Titles", p.Titles.Count() > 0 ? p.Titles.Select(a => a.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
new XElement("Titles", p.Titles.Any() ? p.Titles.Select(a => a.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
AlbumFile.Add(new XElement("Albums", album));
|
|
|
|
@ -460,7 +460,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
new XElement("Artist", a.Artist.Name),
|
|
|
|
|
new XElement("Description", a.Description),
|
|
|
|
|
new XElement("Information", a.Information),
|
|
|
|
|
new XElement("Titles", a.Titles.Count() > 0 ? a.Titles.Select(p => p.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
new XElement("Titles", a.Titles.Any() ? a.Titles.Select(p => p.ImageURL).Aggregate((albumUrl, nextAlbum) => albumUrl + " " + nextAlbum) : "")
|
|
|
|
|
));
|
|
|
|
|
AlbumsFile.Add(new XElement("Albums", album));
|
|
|
|
|
|
|
|
|
@ -488,7 +488,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
new XAttribute("Name", p.Name),
|
|
|
|
|
new XElement("ImageURL", p.ImageURL),
|
|
|
|
|
new XElement("Information", p.Information),
|
|
|
|
|
new XElement("Feats", p.Feat.Count() > 0 ? p.Feat.Select(a => a.Name).Aggregate((artistName, nextArtist) => artistName + " " + nextArtist) : ""),
|
|
|
|
|
new XElement("Feats", p.Feat.Any() ? p.Feat.Select(a => a.Name).Aggregate((artistName, nextArtist) => artistName + " " + nextArtist) : ""),
|
|
|
|
|
new XElement("Description", p.Description),
|
|
|
|
|
new XElement("Genre", p.Genre)
|
|
|
|
|
));
|
|
|
|
@ -547,7 +547,7 @@ public class LINQ_XML_Serialization : IDataManager
|
|
|
|
|
new XElement("Information", it.Information),
|
|
|
|
|
new XElement("Genre", it.Genre.ToString()),
|
|
|
|
|
new XElement("Description", it.Description),
|
|
|
|
|
new XElement("Feats", it.Feat.Count() > 0 ? it.Feat.Select(p => p.Name).Aggregate((featName, nextFeat) => featName + " " + nextFeat) : "")
|
|
|
|
|
new XElement("Feats", it.Feat.Any() ? it.Feat.Select(p => p.Name).Aggregate((featName, nextFeat) => featName + " " + nextFeat) : "")
|
|
|
|
|
));
|
|
|
|
|
InfosFile.Add(new XElement("InfoTitles", info));
|
|
|
|
|
|
|
|
|
|