Reworked the Config system

This commit is contained in:
2024-08-06 19:07:08 +03:00
parent 8366de28cc
commit 721c28c283
28 changed files with 740 additions and 318 deletions

View File

@@ -5,8 +5,8 @@ namespace CppWrapper.Objects
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct ApplicationStruct
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 19)]
public string ServerId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public ulong[] ServerIds;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string Prefix;

View File

@@ -8,9 +8,9 @@ namespace CppWrapper.Objects
{
return new ApplicationStruct
{
Token = application.ApplicationEnvironmentVariables["token"],
Prefix = application.ApplicationEnvironmentVariables["prefix"],
ServerId = application.ServerID
Token = application.ApplicationEnvironmentVariables.Get<string>("token") ?? throw new Exception("Token not found"),
Prefix = application.ApplicationEnvironmentVariables.Get<string>("prefix") ?? throw new Exception("Prefix not found"),
ServerIds = application.ServerIDs.ToArray()
};
}
}