using CoreRCON; using LANCommander.SDK.Enums; using LANCommander.Server.Data; using LANCommander.Server.Data.Models; using Microsoft.Extensions.Logging; using System.Diagnostics; using System.Net; using ZiggyCreatures.Caching.Fusion; namespace LANCommander.Server.Services { public class ServerConsoleService : BaseDatabaseService { public ServerConsoleService( ILogger logger, IFusionCache cache, RepositoryFactory repositoryFactory) : base(logger, cache, repositoryFactory) { } public async Task ReadLogAsync(Guid logId) { var log = await GetAsync(logId); if (log.Type != ServerConsoleType.LogFile) throw new Exception("Invalid console type"); var logPath = Path.Combine(log.Server.WorkingDirectory, log.Path); return await File.ReadAllLinesAsync(logPath); } } }