Updated API for plugins to work with database from remote. Added PluginRepository and removed Installation Scripts
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
48
DiscordBotCore/Others/OS.cs
Normal file
48
DiscordBotCore/Others/OS.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user