Fixed some of the compiler warnings.

This commit is contained in:
Tom
2024-12-28 21:19:28 +00:00
parent db1d57c218
commit 4f5dd8f24e
20 changed files with 93 additions and 131 deletions

View File

@ -1,49 +0,0 @@
namespace TwitchChatTTS.Hermes
{
public interface ICustomDataManager
{
void Add(string key, object value, string type);
void Change(string key, object value);
void Delete(string key);
object? Get(string key);
}
public class CustomDataManager : ICustomDataManager
{
private IDictionary<string, DataInfo> _data;
public CustomDataManager()
{
_data = new Dictionary<string, DataInfo>();
}
public void Add(string key, object value, string type)
{
throw new NotImplementedException();
}
public void Change(string key, object value)
{
throw new NotImplementedException();
}
public void Delete(string key)
{
throw new NotImplementedException();
}
public object? Get(string key)
{
throw new NotImplementedException();
}
}
// type: text (string), whole number (int), number (double), boolean, formula (string, data type of number)
public struct DataInfo
{
public string Id { get; set; }
public string Type { get; set; }
public object Value { get; set; }
}
}

View File

@ -1,4 +1,3 @@
using System.Text.Json;
using CommonSocketLibrary.Abstract;
using CommonSocketLibrary.Common;
using HermesSocketLibrary.Socket.Data;
@ -24,23 +23,30 @@ namespace TwitchChatTTS.Hermes.Socket.Handlers
_logger = logger;
}
public async Task Execute<Data>(SocketClient<WebSocketMessage> sender, Data data)
public Task Execute<Data>(SocketClient<WebSocketMessage> sender, Data data)
{
if (data is not RequestAckMessage message || message == null)
return;
return Task.CompletedTask;
if (message.Request == null)
{
_logger.Warning("Received a Hermes request message without a proper request.");
return;
return Task.CompletedTask;
}
_logger.Debug($"Received a Hermes request message [type: {message.Request.Type}][data: {string.Join(',', message.Request.Data?.Select(entry => entry.Key + '=' + entry.Value) ?? Array.Empty<string>())}]");
var json = message.Data?.ToString();
if (message.Request.Type == null)
{
return;
_logger.Warning("Request type is null. Unknown what acknowlegement this is for.");
return Task.CompletedTask;
}
if (!string.IsNullOrWhiteSpace(message.Error))
{
_logger.Warning("An error occured while processing the request on the server: " + message.Error);
return Task.CompletedTask;
}
_manager.Fulfill(message.Request.Type, message.Request.RequestId, json, message.Request.Data);
return Task.CompletedTask;
}
}

View File

@ -13,7 +13,7 @@ namespace TwitchChatTTS.Hermes.Socket.Requests
_logger = logger;
}
public void Fulfill(string type, string requestId, string data, IDictionary<string, object>? requestData)
public void Fulfill(string type, string requestId, string? data, IDictionary<string, object>? requestData)
{
if (!_acknowledgements.TryGetValue(type, out var ack))
{

View File

@ -1,13 +0,0 @@
public class TTSVoice
{
public string Label { get; set; }
public int Value { get; set; }
public string? Gender { get; set; }
public string? Language { get; set; }
}
public class TTSChatterSelectedVoice
{
public long ChatterId { get; set; }
public string Voice { get; set; }
}