2024-03-12 14:05:27 -04:00
|
|
|
using CommonSocketLibrary.Common;
|
|
|
|
using CommonSocketLibrary.Abstract;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2024-06-16 20:19:31 -04:00
|
|
|
using Serilog;
|
2024-03-12 14:05:27 -04:00
|
|
|
using System.Text.Json;
|
|
|
|
|
|
|
|
namespace TwitchChatTTS.OBS.Socket
|
|
|
|
{
|
2024-06-16 20:19:31 -04:00
|
|
|
public class OBSSocketClient : WebSocketClient
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
private bool _live;
|
2024-06-16 20:19:31 -04:00
|
|
|
public bool? Live
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
get => Connected ? _live : null;
|
2024-06-16 20:19:31 -04:00
|
|
|
set
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
if (value.HasValue)
|
|
|
|
_live = value.Value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public OBSSocketClient(
|
2024-06-16 20:19:31 -04:00
|
|
|
ILogger logger,
|
2024-03-12 14:05:27 -04:00
|
|
|
[FromKeyedServices("obs")] HandlerManager<WebSocketClient, IWebSocketHandler> handlerManager,
|
|
|
|
[FromKeyedServices("obs")] HandlerTypeManager<WebSocketClient, IWebSocketHandler> typeManager
|
2024-06-16 20:19:31 -04:00
|
|
|
) : base(logger, handlerManager, typeManager, new JsonSerializerOptions()
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
PropertyNameCaseInsensitive = false,
|
|
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
2024-06-16 20:19:31 -04:00
|
|
|
})
|
|
|
|
{
|
2024-03-12 14:05:27 -04:00
|
|
|
_live = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|