Added File Download, abstracted JSON
This commit is contained in:
parent
08675d678b
commit
93c0f3d5ab
|
@ -98,7 +98,7 @@ namespace Tesses.YouTubeDownloader
|
||||||
LastSubscriptionTime=date;
|
LastSubscriptionTime=date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async IAsyncEnumerable<Subscription> GetSubscriptionsAsync()
|
public virtual async IAsyncEnumerable<Subscription> GetSubscriptionsAsync()
|
||||||
{
|
{
|
||||||
|
|
||||||
await foreach(var item in EnumerateFilesAsync("Subscriptions"))
|
await foreach(var item in EnumerateFilesAsync("Subscriptions"))
|
||||||
|
@ -128,7 +128,7 @@ namespace Tesses.YouTubeDownloader
|
||||||
Subscriptions.Add(sub);
|
Subscriptions.Add(sub);
|
||||||
await SaveSubscription(sub);
|
await SaveSubscription(sub);
|
||||||
}
|
}
|
||||||
public async Task SaveSubscription(Subscription sub)
|
public virtual async Task SaveSubscription(Subscription sub)
|
||||||
{
|
{
|
||||||
await WriteAllTextAsync($"Subscriptions/{sub.Id}.json",JsonConvert.SerializeObject(sub));
|
await WriteAllTextAsync($"Subscriptions/{sub.Id}.json",JsonConvert.SerializeObject(sub));
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace Tesses.YouTubeDownloader
|
||||||
{
|
{
|
||||||
return Subscriptions;
|
return Subscriptions;
|
||||||
}
|
}
|
||||||
public void Unsubscribe(ChannelId id)
|
public virtual void Unsubscribe(ChannelId id)
|
||||||
{
|
{
|
||||||
Subscription sub= Subscriptions.FirstOrDefault(e=>e.Id==id.Value);
|
Subscription sub= Subscriptions.FirstOrDefault(e=>e.Id==id.Value);
|
||||||
if(sub != null)
|
if(sub != null)
|
||||||
|
|
Loading…
Reference in New Issue