Redesigned the DiscordBotCore by splitting it into multiple projects. Created a WebUI and preparing to remove the DiscordBot application
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class InstallationProgressIndicator
|
||||
{
|
||||
private readonly Dictionary<string, float> _DownloadProgress;
|
||||
|
||||
public InstallationProgressIndicator()
|
||||
{
|
||||
_DownloadProgress = new Dictionary<string, float>();
|
||||
}
|
||||
|
||||
public void SetProgress(string fileName, float progress)
|
||||
{
|
||||
_DownloadProgress[fileName] = progress;
|
||||
}
|
||||
}
|
||||
49
DiscordBotCore.PluginManagement/Models/LocalPlugin.cs
Normal file
49
DiscordBotCore.PluginManagement/Models/LocalPlugin.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class LocalPlugin
|
||||
{
|
||||
public string PluginName { get; private set; }
|
||||
public string PluginVersion { get; private set; }
|
||||
public string FilePath { get; private set; }
|
||||
public Dictionary<string, string> ListOfExecutableDependencies {get; private set;}
|
||||
public bool IsMarkedToUninstall {get; internal set;}
|
||||
public bool IsOfflineAdded { get; internal set; }
|
||||
public bool IsEnabled { get; internal set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public LocalPlugin(string pluginName, string pluginVersion, string filePath, Dictionary<string, string> listOfExecutableDependencies, bool isMarkedToUninstall, bool isOfflineAdded, bool isEnabled)
|
||||
{
|
||||
PluginName = pluginName;
|
||||
PluginVersion = pluginVersion;
|
||||
ListOfExecutableDependencies = listOfExecutableDependencies;
|
||||
IsMarkedToUninstall = isMarkedToUninstall;
|
||||
FilePath = filePath;
|
||||
IsOfflineAdded = isOfflineAdded;
|
||||
IsEnabled = isEnabled;
|
||||
}
|
||||
|
||||
private LocalPlugin(string pluginName, string pluginVersion, string filePath,
|
||||
Dictionary<string, string> listOfExecutableDependencies)
|
||||
{
|
||||
PluginName = pluginName;
|
||||
PluginVersion = pluginVersion;
|
||||
ListOfExecutableDependencies = listOfExecutableDependencies;
|
||||
IsMarkedToUninstall = false;
|
||||
FilePath = filePath;
|
||||
IsOfflineAdded = false;
|
||||
IsEnabled = true;
|
||||
}
|
||||
|
||||
public static LocalPlugin FromOnlineInfo(OnlinePlugin plugin, List<OnlineDependencyInfo> dependencies, string downloadLocation)
|
||||
{
|
||||
LocalPlugin localPlugin = new LocalPlugin(
|
||||
plugin.PluginName, plugin.LatestVersion, downloadLocation,
|
||||
dependencies.Where(dependency => dependency.IsExecutable)
|
||||
.ToDictionary(dependency => dependency.DependencyName, dependency => dependency.DownloadLocation)
|
||||
);
|
||||
|
||||
return localPlugin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class OnlineDependencyInfo
|
||||
{
|
||||
public string DependencyName { get; private set; }
|
||||
[JsonPropertyName("dependencyLink")]
|
||||
public string DownloadLink { get; private set; }
|
||||
[JsonPropertyName("dependencyLocation")]
|
||||
public string DownloadLocation { get; private set; }
|
||||
public bool IsExecutable { get; private set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public OnlineDependencyInfo(string dependencyName, string downloadLink, string downloadLocation, bool isExecutable)
|
||||
{
|
||||
DependencyName = dependencyName;
|
||||
DownloadLink = downloadLink;
|
||||
DownloadLocation = downloadLocation;
|
||||
IsExecutable = isExecutable;
|
||||
}
|
||||
}
|
||||
27
DiscordBotCore.PluginManagement/Models/OnlinePlugin.cs
Normal file
27
DiscordBotCore.PluginManagement/Models/OnlinePlugin.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace DiscordBotCore.PluginManagement.Models;
|
||||
|
||||
public class OnlinePlugin
|
||||
{
|
||||
public int PluginId { get; private set; }
|
||||
public string PluginName { get; private set; }
|
||||
public string PluginDescription { get; private set; }
|
||||
public string LatestVersion { get; private set; }
|
||||
public string PluginAuthor { get; private set; }
|
||||
public string PluginLink { get; private set; }
|
||||
public int OperatingSystem { get; private set; }
|
||||
|
||||
[JsonConstructor]
|
||||
public OnlinePlugin(int pluginId, string pluginName, string pluginDescription, string latestVersion,
|
||||
string pluginAuthor, string pluginLink, int operatingSystem)
|
||||
{
|
||||
PluginId = pluginId;
|
||||
PluginName = pluginName;
|
||||
PluginDescription = pluginDescription;
|
||||
LatestVersion = latestVersion;
|
||||
PluginAuthor = pluginAuthor;
|
||||
PluginLink = pluginLink;
|
||||
OperatingSystem = operatingSystem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user