mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-01 03:07:55 +03:00
move card storage/web server handlers to separate files
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
namespace AMNet.Server;
|
||||
|
||||
internal static class Config
|
||||
{
|
||||
private const string ConfigFileName = @".\segatools.ini";
|
||||
|
||||
internal const string IOSection = "aimeio";
|
||||
|
||||
static Config()
|
||||
{
|
||||
GameId = ReadKey(IOSection, "gameId", 4);
|
||||
ServerName = ReadKey(IOSection, "serverName", 26, Environment.MachineName);
|
||||
}
|
||||
|
||||
public static string GameId { get; }
|
||||
public static string ServerName { get; }
|
||||
|
||||
internal static unsafe string ReadKey(string section, string key, uint maxLength, string @default = null)
|
||||
{
|
||||
var buffer = stackalloc char[(int)maxLength + 1];
|
||||
var bufferStr = new PWSTR(buffer);
|
||||
|
||||
PInvoke.GetPrivateProfileString(section, key, @default ?? string.Empty, bufferStr, maxLength, ConfigFileName);
|
||||
|
||||
return bufferStr.ToString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user