-
Notifications
You must be signed in to change notification settings - Fork 0
/
Json.cs
31 lines (23 loc) · 868 Bytes
/
Json.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SpotifyGPX by Simon Field
using SpotifyGPX.Broadcasting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
namespace SpotifyGPX.Output;
public sealed partial class Json : JsonSaveable
{
public override string FormatName => nameof(Json).ToLower();
public Json(Func<IEnumerable<SongPoint>> pairs, string? trackName, StringBroadcaster bcast) : base(pairs, trackName, bcast)
{
}
protected override List<JsonDocument> GetDocument(string? trackName)
{
IEnumerable<SongPoint> Pairs = DataProvider();
List<JsonDocument> objects = Pairs
.Select(pair => JsonDocument.Parse(JsonSerializer.Serialize(pair.Song.GetObject<SpotifyEntry>())))
.ToList();
return objects;
}
public override int Count => Document.Count; // Number of JObjects in list
}