Flow.Launcher/Plugins/Flow.Launcher.Plugin.PluginsManager/Models/PluginsManifest.cs

31 lines
1.1 KiB
C#
Raw Permalink Normal View History

2020-12-06 08:58:27 +00:00
using Flow.Launcher.Infrastructure.Http;
using Flow.Launcher.Infrastructure.Logger;
using System;
using System.Collections.Generic;
using System.Text.Json;
2020-12-13 21:41:18 +00:00
using System.Threading.Tasks;
2020-12-06 08:58:27 +00:00
2020-12-06 10:10:22 +00:00
namespace Flow.Launcher.Plugin.PluginsManager.Models
2020-12-06 08:58:27 +00:00
{
2020-12-06 20:40:42 +00:00
internal class PluginsManifest
2020-12-06 08:58:27 +00:00
{
2021-01-02 14:21:45 +00:00
internal List<UserPlugin> UserPlugins { get; private set; } = new List<UserPlugin>();
2020-12-13 21:41:18 +00:00
internal async Task DownloadManifest()
2020-12-06 08:58:27 +00:00
{
2020-12-13 21:41:18 +00:00
try
{
await using var jsonStream = await Http.GetStreamAsync("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json")
.ConfigureAwait(false);
2020-12-06 08:58:27 +00:00
UserPlugins = await JsonSerializer.DeserializeAsync<List<UserPlugin>>(jsonStream).ConfigureAwait(false);
2020-12-13 21:41:18 +00:00
}
catch (Exception e)
2020-12-06 08:58:27 +00:00
{
2020-12-13 21:41:18 +00:00
Log.Exception("|PluginManagement.GetManifest|Encountered error trying to download plugins manifest", e);
2020-12-06 08:58:27 +00:00
2020-12-13 21:41:18 +00:00
UserPlugins = new List<UserPlugin>();
2020-12-06 08:58:27 +00:00
}
}
}
}