diff --git a/Sources/Model/InfoTitle.cs b/Sources/Model/InfoTitle.cs index 444a6ff..1bb263e 100644 --- a/Sources/Model/InfoTitle.cs +++ b/Sources/Model/InfoTitle.cs @@ -5,17 +5,7 @@ namespace Model; public class InfoTitle : Title { - public Artist Artist - { - get - { - return artist; - } - set - { - artist = value; - } - } + public Artist Artist { get; set; } private Artist artist = new Artist(); diff --git a/Sources/Model/Manager.cs b/Sources/Model/Manager.cs index a084883..008c17e 100644 --- a/Sources/Model/Manager.cs +++ b/Sources/Model/Manager.cs @@ -14,7 +14,7 @@ public class Manager public IDataManager DataManager { get; set; } - private List albums = new List(); + private List albums; public IEnumerable Albums { @@ -24,7 +24,7 @@ public class Manager } } - private List customTitles = new List(); + private List customTitles; public IEnumerable CustomTitles { @@ -34,7 +34,7 @@ public class Manager } } - private List infoTitles = new List(); + private List infoTitles; public IEnumerable InfoTitles { @@ -44,7 +44,7 @@ public class Manager } } - private List playlists = new List(); + private List playlists; public IEnumerable Playlists { @@ -54,7 +54,7 @@ public class Manager } } - private List artists = new List(); + private List artists; public IEnumerable Artists { diff --git a/Sources/Model/Playlist.cs b/Sources/Model/Playlist.cs index 0a323fb..25dd7eb 100644 --- a/Sources/Model/Playlist.cs +++ b/Sources/Model/Playlist.cs @@ -84,20 +84,34 @@ public class Playlist { index = 0; } - else - { - return; - } } } private int index = 0; - public bool Shuffle = false; + public bool Shuffle + { + get => shuffle; + set { shuffle = value; } + } + + private bool shuffle = false; - public bool Loop = false; + public bool Loop + { + get => loop; + set { loop = value; } + } + + private bool loop = false; + + public bool LoopTitle + { + get => loopTitle; + set { loopTitle = value; } + } - public bool LoopTitle = false; + private bool loopTitle = false; private readonly List played = new List(); @@ -167,7 +181,7 @@ public class Playlist } else { - if (played.Count == 0) + if (!played.Any()) { return; } diff --git a/Sources/Model/Serialization/LINQ_XML_Serialization.cs b/Sources/Model/Serialization/LINQ_XML_Serialization.cs index c38ff66..c0a4b44 100644 --- a/Sources/Model/Serialization/LINQ_XML_Serialization.cs +++ b/Sources/Model/Serialization/LINQ_XML_Serialization.cs @@ -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(); artists = new List(); @@ -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)); diff --git a/Sources/Model/Stub/StubManager.cs b/Sources/Model/Stub/StubManager.cs index 7f86638..91d1431 100644 --- a/Sources/Model/Stub/StubManager.cs +++ b/Sources/Model/Stub/StubManager.cs @@ -148,12 +148,12 @@ public class StubManager : IDataManager public void LoadSerialization() { - return; + } public void SaveSerialization() { - return; + } public CustomTitle? GetCustomTitleByUrl(string custom)