Updated API for plugins to work with database from remote. Added PluginRepository and removed Installation Scripts

This commit is contained in:
2025-01-26 20:34:34 +02:00
parent 8b2169dc7b
commit 84b19e2069
35 changed files with 435 additions and 1056 deletions

View File

@@ -26,15 +26,6 @@ public enum InternalActionRunType
OnStartupAndCall
}
[Flags]
public enum OSType: byte
{
NONE = 0,
WINDOWS = 1 << 0,
LINUX = 2 << 1,
MACOSX = 3 << 2
}
public enum PluginType
{
UNKNOWN,

View File

@@ -93,7 +93,12 @@ public static class JsonManager
text.Position = 0;
var obj = await JsonSerializer.DeserializeAsync<T>(text);
JsonSerializerOptions options = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = true
};
var obj = await JsonSerializer.DeserializeAsync<T>(text, options);
await text.FlushAsync();
text.Close();

View File

@@ -0,0 +1,48 @@
using System;
namespace DiscordBotCore.Others;
public class OS
{
public enum OperatingSystem : int
{
Windows = 0,
Linux = 1,
MacOS = 2
}
public static OperatingSystem GetOperatingSystem()
{
if(System.OperatingSystem.IsLinux()) return OperatingSystem.Linux;
if(System.OperatingSystem.IsWindows()) return OperatingSystem.Windows;
if(System.OperatingSystem.IsMacOS()) return OperatingSystem.MacOS;
throw new PlatformNotSupportedException();
}
public static string GetOperatingSystemString(OperatingSystem os)
{
return os switch
{
OperatingSystem.Windows => "Windows",
OperatingSystem.Linux => "Linux",
OperatingSystem.MacOS => "MacOS",
_ => throw new ArgumentOutOfRangeException()
};
}
public static OperatingSystem GetOperatingSystemFromString(string os)
{
return os.ToLower() switch
{
"windows" => OperatingSystem.Windows,
"linux" => OperatingSystem.Linux,
"macos" => OperatingSystem.MacOS,
_ => throw new ArgumentOutOfRangeException()
};
}
public static int GetOperatingSystemInt()
{
return (int) GetOperatingSystem();
}
}