mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-27 09:23:03 +03:00
whitespace removal
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace AMNet.Server;
|
||||
|
||||
@@ -9,9 +10,9 @@ namespace AMNet.Server;
|
||||
/// </summary>
|
||||
internal class CardPresenter
|
||||
{
|
||||
private readonly object _cardLock = new();
|
||||
private readonly Lock _cardLock = new();
|
||||
private StoredCard _currentCard;
|
||||
|
||||
|
||||
public record StoredCard(byte[] Value, string OriginalValue, long ExpiresAt)
|
||||
{
|
||||
public bool Expired => Environment.TickCount64 >= ExpiresAt;
|
||||
@@ -65,7 +66,7 @@ internal class CardPresenter
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var card = new StoredCard(bytes, matrixCode, Environment.TickCount64 + validFor);
|
||||
|
||||
lock (_cardLock)
|
||||
|
||||
@@ -14,17 +14,17 @@ internal static class Config
|
||||
{
|
||||
GameId = ReadKey(IOSection, "gameId", 4);
|
||||
ServerName = ReadKey(IOSection, "serverName", 26, Environment.MachineName);
|
||||
|
||||
|
||||
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 bool EnableAimeTxt { get; }
|
||||
public static string AimeTxtPath { get; }
|
||||
|
||||
|
||||
internal static unsafe string ReadKey(string section, string key, uint maxLength, string @default = null)
|
||||
{
|
||||
// +1 for null terminator
|
||||
|
||||
@@ -63,7 +63,7 @@ internal static partial class WebServer
|
||||
builder.Services.AddSingleton<CardPresenter>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
app.UseCors();
|
||||
|
||||
app.MapGet("/amnet/info", ServerInfo);
|
||||
@@ -83,7 +83,7 @@ internal static partial class WebServer
|
||||
Config.ServerName,
|
||||
Environment.TickCount64 - startedAt,
|
||||
lastPollAt < 0 ? null : Environment.TickCount64 - lastPollAt);
|
||||
|
||||
|
||||
return Results.Ok(state);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user