mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-12 09:28:10 +03:00
add idm/access code preference for physical cards (server)
This commit is contained in:
+12
-1
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
|
||||
@@ -6,21 +7,31 @@ namespace AMNet.Server;
|
||||
|
||||
internal static class Config
|
||||
{
|
||||
internal const string IOSection = "aimeio";
|
||||
private const string ConfigFileName = @".\segatools.ini";
|
||||
|
||||
internal const string IOSection = "aimeio";
|
||||
/// <summary>
|
||||
/// Valid physical card identification methods.
|
||||
/// IDm - uses the idm of the card to generate a 20-digit identifier (also known as the 0008 number)
|
||||
/// Access - prefer the real access code of the card. if not available (i.e. Suica card), fallback to the IDm.
|
||||
/// </summary>
|
||||
private static readonly string[] ValidPhysicalCardIdentifiers = ["idm", "access"];
|
||||
|
||||
static Config()
|
||||
{
|
||||
GameId = ReadKey(IOSection, "gameId", 4);
|
||||
ServerName = ReadKey(IOSection, "serverName", 26, Environment.MachineName);
|
||||
|
||||
var physicalCardIdentifierPreference = ReadKey(IOSection, "physicalCardIdentifier", 10);
|
||||
PhysicalCardIdentifierPreference = ValidPhysicalCardIdentifiers.Contains(physicalCardIdentifierPreference) ? physicalCardIdentifierPreference : ValidPhysicalCardIdentifiers[^1];
|
||||
|
||||
EnableAimeTxt = PInvoke.GetPrivateProfileInt(IOSection, "enableKeyboardMode", 1, ConfigFileName) > 0;
|
||||
AimeTxtPath = ReadKey("aime", "aimePath", PInvoke.MAX_PATH, @"DEVICE\aime.txt");
|
||||
}
|
||||
|
||||
public static string GameId { get; }
|
||||
public static string ServerName { get; }
|
||||
public static string PhysicalCardIdentifierPreference { get; }
|
||||
|
||||
public static bool EnableAimeTxt { get; }
|
||||
public static string AimeTxtPath { get; }
|
||||
|
||||
Reference in New Issue
Block a user