fixed maxParallel downloads default value not being automatically selected at first boot
This commit is contained in:
@@ -2,12 +2,15 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using DiscordBot.Utilities;
|
using DiscordBot.Utilities;
|
||||||
|
|
||||||
using PluginManager;
|
using PluginManager;
|
||||||
using PluginManager.Interfaces;
|
using PluginManager.Interfaces;
|
||||||
using PluginManager.Loaders;
|
using PluginManager.Loaders;
|
||||||
using PluginManager.Online;
|
using PluginManager.Online;
|
||||||
using PluginManager.Others;
|
using PluginManager.Others;
|
||||||
|
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
|
||||||
namespace DiscordBot.Bot.Actions.Extra;
|
namespace DiscordBot.Bot.Actions.Extra;
|
||||||
@@ -109,12 +112,10 @@ internal static class PluginMethods
|
|||||||
downloadTasks.Add(new Tuple<ProgressTask, IProgress<float>, string, string>(task, progress, dependency.DownloadLink, dependency.DownloadLocation));
|
downloadTasks.Add(new Tuple<ProgressTask, IProgress<float>, string, string>(task, progress, dependency.DownloadLink, dependency.DownloadLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!int.TryParse(Config.AppSettings["MaxParallelDownloads"], out var maxParallelDownloads))
|
int maxParallelDownloads = 5;
|
||||||
{
|
|
||||||
maxParallelDownloads = 5;
|
if (Config.AppSettings.ContainsKey("MaxParallelDownloads"))
|
||||||
Config.AppSettings.Add("MaxParallelDownloads", "5");
|
maxParallelDownloads = int.Parse(Config.AppSettings["MaxParallelDownloads"]);
|
||||||
await Config.AppSettings.SaveToFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
var options = new ParallelOptions()
|
var options = new ParallelOptions()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user