Moved to Json Database for online plugins

This commit is contained in:
2024-02-26 23:36:19 +02:00
parent 196fb6d3d1
commit 14f280baef
16 changed files with 376 additions and 299 deletions

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,68 @@
using System.Diagnostics;
using PluginManager;
using PluginManager.Online.Helpers;
using PluginManager.Others;
using PluginManager.Plugin;
if (args.Length == 1)
{
PluginOnlineInfo? result = await JsonManager.ConvertFromJson<PluginOnlineInfo>(args[0]);
// print all rows
Console.WriteLine($"Name: {result.Name}");
Console.WriteLine($"Version: {result.Version.ToShortString()}");
Console.WriteLine($"Description: {result.Description}");
Console.WriteLine($"Download link: {result.DownLoadLink}");
Console.WriteLine($"Supported OS: {((result.SupportedOS & OSType.WINDOWS) != 0 ? "Windows" : "")} {((result.SupportedOS & OSType.LINUX) != 0 ? "Linux" : "")} {((result.SupportedOS & OSType.MACOSX) != 0 ? "MacOSX" : "")}");
Console.WriteLine($"Has dependencies: {result.HasDependencies}");
Console.WriteLine($"Dependencies: {result.Dependencies.Count}");
return;
}
var _levelingSystem = new PluginOnlineInfo(
"Leveling System",
new PluginVersion(0, 0, 1),
"A simple leveling system for your server",
"https://github.com/andreitdr/SethPlugins/raw/releases/LevelingSystem/LevelingSystem.dll",
OSType.WINDOWS | OSType.LINUX
);
var _musicPlayerWindows = new PluginOnlineInfo(
"Music Player (Windows)", new PluginVersion(0, 0, 1),
"A simple music player for your server",
"https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/MusicPlayer.dll",
OSType.WINDOWS,
[
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/windows/ffmpeg.exe", "ffmpeg.exe"),
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/windows/libopus.dll", "libopus.dll"),
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/windows/libsodium.dll", "libsodium.dll"),
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/windows/opus.dll", "opus.dll"),
new OnlineDependencyInfo("https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_x86.exe", "yt-dlp.exe")
]
);
var _musicPlayerLINUX = new PluginOnlineInfo(
"Music Player (Linux)", new PluginVersion(0, 0, 1),
"A simple music player for your server",
"https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/MusicPlayer.dll",
OSType.LINUX,
[
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/linux/ffmpeg", "ffmpeg"),
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/linux/libopus.so", "libopus.so"),
new OnlineDependencyInfo("https://github.com/andreitdr/SethPlugins/raw/releases/MusicPlayer/libs/linux/libsodium.so", "libsodium.so"),
new OnlineDependencyInfo("https://github.com/yt-dlp/yt-dlp/releases/download/2023.10.13/yt-dlp", "yt-dlp")
]
);
List<PluginOnlineInfo> plugins =
[
_levelingSystem,
_musicPlayerWindows,
_musicPlayerLINUX
];
Directory.CreateDirectory("output");
await JsonManager.SaveToJsonFile("./output/PluginsList.json", plugins);
Process.Start("notepad.exe", "./output/PluginsList.json");