Skip to content

Commit

Permalink
playlist folder check
Browse files Browse the repository at this point in the history
  • Loading branch information
retropassdev committed Mar 25, 2023
1 parent 8f21c09 commit 2abcd9c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions RetroPass/DataSourceLaunchBox.cs
Expand Up @@ -260,17 +260,21 @@ public async Task<List<PlaylistLaunchBox>> LoadPlaylistsXmls(StorageFolder dataF
List<PlaylistLaunchBox> playlistLaunchBoxList = new List<PlaylistLaunchBox>();

StorageFolder playlistsFolder = await StorageUtils.GetFolderFromPathAsync(rootFolder + "\\Data\\Playlists");
IReadOnlyList<StorageFile> playlistFiles = await playlistsFolder.GetFilesAsync();
foreach (StorageFile xmlPlaylistFile in playlistFiles)
{
string xmlPlaylist = await FileIO.ReadTextAsync(xmlPlaylistFile);

using (TextReader reader = new StringReader(xmlPlaylist))
if (playlistsFolder != null)
{
IReadOnlyList<StorageFile> playlistFiles = await playlistsFolder.GetFilesAsync();
foreach (StorageFile xmlPlaylistFile in playlistFiles)
{
XmlSerializer serializer = new XmlSerializer(typeof(PlaylistLaunchBox));
// Call the Deserialize method to restore the object's state.
PlaylistLaunchBox playlistLaunchBox = serializer.Deserialize(reader) as PlaylistLaunchBox;
playlistLaunchBoxList.Add(playlistLaunchBox);
string xmlPlaylist = await FileIO.ReadTextAsync(xmlPlaylistFile);

using (TextReader reader = new StringReader(xmlPlaylist))
{
XmlSerializer serializer = new XmlSerializer(typeof(PlaylistLaunchBox));
// Call the Deserialize method to restore the object's state.
PlaylistLaunchBox playlistLaunchBox = serializer.Deserialize(reader) as PlaylistLaunchBox;
playlistLaunchBoxList.Add(playlistLaunchBox);
}
}
}

Expand Down

0 comments on commit 2abcd9c

Please sign in to comment.