using CoreRCON; using LANCommander.SDK.Enums; using LANCommander.Server.Data; using LANCommander.Server.Data.Models; using System.Diagnostics; using System.Net; namespace LANCommander.Server.Services { public class ServerConsoleService : BaseDatabaseService { public ServerConsoleService(DatabaseContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) { } public async Task ReadLog(Guid logId) { var log = await Get(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); } } }